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, $vars, $template_name = '')
\r
27 if ( is_string($query) )
\r
29 $resource = DB::getResult($query);
\r
37 $contents .= call_user_func("listplug_{$type}", $vars, 'HEAD', $template_name);
\r
40 foreach ( $resource as $row )
\r
42 $vars['current'] = $row;
\r
43 $contents .= call_user_func("listplug_{$type}", $vars, 'BODY', $template_name);
\r
47 $contents .= call_user_func("listplug_{$type}", $vars, 'FOOT', $template_name);
\r
49 /* close SQL resource */
\r
50 if ( is_string($query) )
\r
52 $resource->closeCursor();
\r
58 function listplug_select($vars, $type, $template_name = '')
\r
62 $templates = array();
\r
63 if ( !empty($template_name) )
\r
65 $templates =& $manager->getTemplate($template_name);
\r
71 if ( !array_key_exists('SHOWLIST_LISTPLUG_SELECT_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_SELECT_HEAD']) )
\r
73 $template = "<select name=\"<%name%>\" tabindex=\"<%tabindex%>\" <%javascript%>>\n"
\r
74 . "<%extraoption%>\n";
\r
78 $template = $templates['SHOWLIST_LISTPLUG_SELECT_HEAD'];
\r
81 'name' => $vars['name'],
\r
82 'tabindex' => $vars['tabindex'],
\r
83 'javascript' => !array_key_exists('javascript', $vars) ? '' : $vars['javascript'],
\r
84 'extraoption' => !array_key_exists('extra', $vars) ? '' : "<option value=\"\">{$vars['extra']}</option>"
\r
88 $current = $vars['current'];
\r
89 if ( !array_key_exists('SHOWLIST_LISTPLUG_SELECT_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_SELECT_BODY']) )
\r
91 $template = "<option value=\"<%value%>\" <%selected%> title=\"<%title%>\"><%option%></option>\n";
\r
95 $template = $templates['SHOWLIST_LISTPLUG_SELECT_BODY'];
\r
98 'value' => Entity::hsc($current['value']),
\r
99 'selected' => ($vars['selected'] == $current['value']) ? 'selected="selected"' : '',
\r
101 if ( array_key_exists('shorten', $vars) && $vars['shorten'] > 0 )
\r
103 $data['title'] = Entity::hsc($current['text']);
\r
104 $data['option'] = Entity::hsc(Entity::shorten($current['text'], $vars['shorten'], $vars['shortenel']));
\r
108 $data['title'] = '';
\r
110 $data['option'] = Entity::hsc($current['text']);
\r
113 if ( !array_key_exists('SHOWLIST_LISTPLUG_SELECT_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_SELECT_FOOT']) )
\r
115 $template = "</select>\n";
\r
119 $template = $templates['SHOWLIST_LISTPLUG_SELECT_FOOT'];
\r
125 return Template::fill($template, $data);
\r
128 function listplug_table($vars, $type, $template_name = '')
\r
132 $templates = array();
\r
133 if ( !empty($template_name) )
\r
135 $templates =& $manager->getTemplate($template_name);
\r
141 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_HEAD']) )
\r
143 $template = "<table frame=\"box\" rules=\"all\" summary=\"{$template_name}\">\n"
\r
153 $template = $templates['SHOWLIST_LISTPLUG_TABLE_HEAD'];
\r
156 'typehead' => call_user_func("listplug_table_" . $vars['content'] , $vars, 'HEAD', $template_name)
\r
160 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_BODY']) )
\r
162 $template = "<tr onmouseover=\"focusRow(this);\" onmouseout=\"blurRow(this);\">\n"
\r
168 $template = $templates['SHOWLIST_LISTPLUG_TABLE_BODY'];
\r
170 // tabletype specific thingies
\r
172 'typebody' => call_user_func("listplug_table_" . $vars['content'] , $vars, 'BODY', $template_name)
\r
176 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_FOOT']) )
\r
178 $template = "<%typefoot%>\n"
\r
184 $template = $templates['SHOWLIST_LISTPLUG_TABLE_FOOT'];
\r
186 // tabletype specific thingies
\r
188 'typefoot' => call_user_func("listplug_table_" . $vars['content'] , $vars, 'FOOT', $template_name)
\r
193 return Template::fill($template, $data);
\r
196 function listplug_table_memberlist($vars, $type, $template_name = '')
\r
200 $templates = array();
\r
201 if ( !empty($template_name) )
\r
203 $templates =& $manager->getTemplate($template_name);
\r
209 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_MEMBLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_MEMBLIST_HEAD']) )
\r
211 $template = "<th><%colmembername%></th>\n"
\r
212 . "<th><%colmemberrname%></th>\n"
\r
213 . "<th><%colmemberurl%></th>\n"
\r
214 . "<th><%colmemberadmin%><%helplink(superadmin)%></th>\n"
\r
215 . "<th><%colmemberlogin%><%helplink(canlogin)%></th>\n"
\r
216 . "<th colspan=\"2\"><%colactions%></th>\n";
\r
220 $template = $templates['SHOWLIST_LISTPLUG_TABLE_MEMBLIST_HEAD'];
\r
223 'colmembername' => _LIST_MEMBER_NAME,
\r
224 'colmemberrname' => _LIST_MEMBER_RNAME,
\r
225 'colmemberurl' => _LIST_MEMBER_URL,
\r
226 'colmemberadmin' => _LIST_MEMBER_ADMIN,
\r
227 'colmemberlogin' => _LIST_MEMBER_LOGIN,
\r
228 'colactions' => _LISTS_ACTIONS,
\r
232 $current = $vars['current'];
\r
233 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_MEMBLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_MEMBLIST_BODY']) )
\r
235 $template = "<td>\n"
\r
236 . "<input type=\"checkbox\" id=\"batch<%id%>\" name=\"batch[<%id%>]\" value=\"<%memberid%>\" />\n"
\r
237 . "<label for=\"batch<%id%>\">\n"
\r
238 . "<a href=\"mailto:<%mailaddress%>\" tabindex=\"<%tabindex%>\"><%name%></a>\n"
\r
239 . "</label>\n</td>\n"
\r
240 . "<td><%realname%></td>\n"
\r
241 . "<td><a href=\"<%url%>\" tabindex=\"<%tabindex%>\"><%url%></a></td>\n"
\r
242 . "<td><%admin%></td>\n"
\r
243 . "<td><%login%></td>\n"
\r
244 . "<td><a href=\"index.php?action=memberedit&memberid=<%memberid%>\" tabindex=\"<%tabindex%>\"><%editbtn%></a></td>\n"
\r
245 . "<td><a href=\"index.php?action=memberdelete&memberid=<%memberid%>\" tabindex=\"<%tabindex%>\"><%deletebtn%></a></td>\n";
\r
249 $template = $templates['SHOWLIST_LISTPLUG_TABLE_MEMBLIST_BODY'];
\r
252 'id' => listplug_nextBatchId(),
\r
253 'memberid' => $current['mnumber'],
\r
254 'mailaddress' => Entity::hsc($current['memail']),
\r
255 'tabindex' => $vars['tabindex'],
\r
256 'name' => Entity::hsc($current['mname']),
\r
257 'realname' => Entity::hsc($current['mrealname']),
\r
258 'url' => Entity::hsc($current['murl']),
\r
259 'admin' => $current['madmin'] ? _YES : _NO,
\r
260 'login' => $current['mcanlogin'] ? _YES : _NO,
\r
261 'editbtn' => _LISTS_EDIT,
\r
262 'deletebtn' => _LISTS_DELETE,
\r
266 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_MEMBLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_MEMBLIST_FOOT']) )
\r
272 $template = $templates['SHOWLIST_LISTPLUG_TABLE_MEMBLIST_FOOT'];
\r
277 return Template::fill($template, $data);
\r
280 function listplug_table_teamlist($vars, $type, $template_name = '')
\r
284 $templates = array();
\r
285 if ( !empty($template_name) )
\r
287 $templates =& $manager->getTemplate($template_name);
\r
293 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_TEAMLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_TEAMLIST_HEAD']) )
\r
295 $template = "<th><%colmembername%></th>\n"
\r
296 . "<th><%colmemberrname%></th>\n"
\r
297 . "<th><%colteamadmin%><%helplink(teamadmin)%></th>\n"
\r
298 . "<th colspan=\"2\"><%colactions%></th>\n";
\r
302 $template = $templates['SHOWLIST_LISTPLUG_TABLE_TEAMLIST_HEAD'];
\r
305 'colmembername' => _LIST_MEMBER_NAME,
\r
306 'colmemberrname' => _LIST_MEMBER_RNAME,
\r
307 'colteamadmin' => _LIST_TEAM_ADMIN,
\r
308 'colactions' => _LISTS_ACTIONS,
\r
312 $current = $vars['current'];
\r
313 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_TEAMLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_TEAMLIST_BODY']) )
\r
315 $template = "<td>\n"
\r
316 . "<input type=\"checkbox\" id=\"batch<%id%>\" name=\"batch[<%id%>]\" value=\"<%memberid%>\" />\n"
\r
317 . "<label for=\"batch<%id%>\">\n"
\r
318 . "<a href=\"mailto:<%mailaddress%>\" tabindex=\"<%tabindex%>\"><%name%></a>\n"
\r
319 . "</label>\n</td>\n"
\r
320 . "<td><%realname%></td>\n"
\r
321 . "<td><%admin%></td>\n"
\r
322 . "<td><a href=\"index.php?action=teamdelete&memberid=<%memberid%>&blogid=<%blogid%>\" tabindex=\"<%tabindex%>\"><%deletebtn%></a></td>\n"
\r
323 . "<td><a href=\"<%chadminurl%>\" tabindex=\"<%tabindex%>\"><%chadminbtn%></a></td>\n";
\r
327 $template = $templates['SHOWLIST_LISTPLUG_TABLE_TEAMLIST_BODY'];
\r
329 $url = 'index.php?action=teamchangeadmin&memberid=' . intval($current['tmember']) . '&blogid=' . intval($current['tblog']);
\r
330 $url = $manager->addTicketToUrl($url);
\r
332 'id' => listplug_nextBatchId(),
\r
333 'memberid' => $current['tmember'],
\r
334 'mailaddress' => Entity::hsc($current['memail']),
\r
335 'tabindex' => $vars['tabindex'],
\r
336 'name' => Entity::hsc($current['mname']),
\r
337 'realname' => Entity::hsc($current['mrealname']),
\r
338 'admin' => ($current['tadmin'] ? _YES : _NO),
\r
339 'blogid' => $current['tblog'],
\r
340 'deletebtn' => '<%text(_LISTS_DELETE)%>',
\r
341 'chadminurl' => Entity::hsc($url),
\r
342 'chadminbtn' => '<%text(_LIST_TEAM_CHADMIN)%>'
\r
346 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_TEAMLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_TEAMLIST_FOOT']) )
\r
352 $template = $templates['SHOWLIST_LISTPLUG_TABLE_TEAMLIST_FOOT'];
\r
357 return Template::fill($template, $data);
\r
360 function listplug_table_pluginlist($vars, $type, $template_name = '')
\r
362 static $plugins = array();
\r
365 $templates = array();
\r
366 if ( !empty($template_name) )
\r
368 $templates =& $manager->getTemplate($template_name);
\r
374 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HEAD']) )
\r
376 $template = "<th><%colinfo%></th>\n"
\r
377 . "<th><%coldesc%></th>\n"
\r
378 . "<th colspan=\"2\"><%colactions%></th>\n";
\r
382 $template = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HEAD'];
\r
385 'colinfo' => _LISTS_INFO,
\r
386 'coldesc' => _LISTS_DESC,
\r
387 'colactions' => _LISTS_ACTIONS,
\r
391 $current = $vars['current'];
\r
393 $plug =& $manager->getPlugin($current['pfile']);
\r
396 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY']) )
\r
398 $template = "<td>\n"
\r
399 . "<strong><%plugname%></strong><br />\n"
\r
400 . "<%autherlabel%> <%plugauther%><br />\n"
\r
401 . "<%versionlabel%> <%plugversion%><br />\n"
\r
402 . "<%pluggeturl%><br />\n"
\r
405 . "<%desclabel%><br /><%plugdesc%>\n"
\r
406 . "<%eventlist%>\n"
\r
407 . "<%needupdate%>\n"
\r
408 . "<%dependlist%>\n"
\r
409 . "<%depreqlist%>\n"
\r
414 $template = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY'];
\r
417 'plugname' => Entity::hsc($plug->getName()),
\r
418 'autherlabel' => _LIST_PLUGS_AUTHOR,
\r
419 'plugauther' => Entity::hsc($plug->getAuthor()),
\r
420 'versionlabel' => _LIST_PLUGS_VER,
\r
421 'plugversion' => Entity::hsc($plug->getVersion()),
\r
422 'tabindex' => $vars['tabindex'],
\r
423 'desclabel' => _LIST_PLUGS_DESC,
\r
424 'plugdesc' => Entity::hen($plug->getDescription()),
\r
426 if ( $plug->getURL() )
\r
428 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGLIST_GURL', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_GURL']) )
\r
430 $subTpl = "<a href=\"<%plugurl%>\" tabindex=\"<%tabindex%>\"><%plugsite%></a>";
\r
434 $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_GURL'];
\r
437 'plugurl' => Entity::hsc($plug->getURL()),
\r
438 'tabindex' => $vars['tabindex'],
\r
439 'plugsite' => _LIST_PLUGS_SITE,
\r
441 $data['pluggeturl'] = Template::fill($subTpl, $subData);
\r
445 $data['pluggeturl'] = '';
\r
447 if ( count($plug->getEventList()) > 0 )
\r
449 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGEVENTLIST', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGEVENTLIST']) )
\r
451 $subTpl = "<br /><br /><%evntlstlbl%><br /><%eventlist%>";
\r
455 $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGEVENTLIST'];
\r
458 'evntlstlbl' => _LIST_PLUGS_SUBS,
\r
459 'eventlist' => Entity::hsc(implode(', ', $plug->getEventList())),
\r
461 $data['eventlist'] = Template::fill($subTpl, $subData);
\r
465 $data['eventlist'] = '';
\r
467 if ( !$plug->subscribtionListIsUptodate() )
\r
469 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGNEDUPDATE', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGNEDUPDATE']) )
\r
471 $subTpl = "<br /><br /><strong><%updatealert%></strong>";
\r
475 $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGNEDUPDATE'];
\r
478 'updatealert' => _LIST_PLUG_SUBS_NEEDUPDATE,
\r
480 $data['needupdate'] = Template::fill($subTpl, $subData);
\r
484 $data['needupdate'] = '';
\r
486 if ( count($plug->getPluginDep() ) > 0)
\r
488 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPEND', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPEND']) )
\r
490 $subTpl = "<br /><br /><%deplistlbl%><br /><%dependlist%>";
\r
494 $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPEND'];
\r
497 'deplistlbl' => _LIST_PLUGS_DEP,
\r
498 'dependlist' => Entity::hsc(implode(', ', $plug->getPluginDep())),
\r
500 $data['dependlist'] = Template::fill($subTpl, $subData);
\r
504 $data['dependlist'] = '';
\r
506 /* check dependency */
\r
507 if ( empty($plugins) )
\r
509 $plugins = DB::getResult('SELECT pfile FROM ' . sql_table('plugin'));
\r
512 foreach ( $plugins as $plugin )
\r
514 $preq =& $manager->getPlugin($plugin['pfile']);
\r
517 $depList = $preq->getPluginDep();
\r
518 foreach ( $depList as $depName )
\r
520 if ( $current['pfile'] == $depName )
\r
522 $req[] = $plugin['pfile'];
\r
528 if ( count($req) > 0 )
\r
530 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPREQ', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPREQ']) )
\r
532 $subTpl = "<br /><br /><%deprlstlbl%><br /><%depreqlist%>";
\r
536 $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPREQ'];
\r
539 'deprlstlbl' => _LIST_PLUGS_DEPREQ,
\r
540 'depreqlist' => Entity::hsc(implode(', ', $req)),
\r
542 $data['depreqlist'] = Template::fill($subTpl, $subData);
\r
546 $data['depreqlist'] = '';
\r
551 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGLISTFALSE', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLISTFALSE']) )
\r
553 $template = "<td colspan=\"2\"><%noplugalert%></td>\n";
\r
557 $template = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLISTFALSE'];
\r
560 'noplugalert' => sprintf(_PLUGINFILE_COULDNT_BELOADED, Entity::hsc($current['pfile'])),
\r
563 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ACTN', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ACTN']) )
\r
565 $template .= "<td>\n"
\r
566 . "<a href=\"<%actionupurl%>\" tabindex=\"<%tabindex%>\"><%actionuptxt%></a><br />\n"
\r
567 . "<a href=\"<%actiondownurl%>\" tabindex=\"<%tabindex%>\"><%actiondowntxt%></a><br />\n"
\r
568 . "<a href=\"<%actuninsturl%>\" tabindex=\"<%tabindex%>\"><%actuninsttxt%></a><br />"
\r
569 . "<%plugadminurl%>\n"
\r
570 . "<%plughelpurl%>\n"
\r
571 . "<%plugoptsetting%>\n"
\r
576 $template .= $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ACTN'];
\r
579 $baseUrl = 'index.php?plugid=' . $current['pid'] . '&action=';
\r
580 $upUrl = $manager->addTicketToUrl($baseUrl . 'pluginup');
\r
581 $downUrl = $manager->addTicketToUrl($baseUrl . 'plugindown');
\r
583 $data['actionuptxt'] = _LIST_PLUGS_UP;
\r
584 $data['actionupurl'] = Entity::hsc($upUrl);
\r
585 $data['actiondowntxt'] = _LIST_PLUGS_DOWN;
\r
586 $data['actiondownurl'] = Entity::hsc($downUrl);
\r
587 $data['actuninsttxt'] = _LIST_PLUGS_UNINSTALL;
\r
588 $data['actuninsturl'] = 'index.php?action=plugindelete&plugid=' . $current['pid'];
\r
590 if ( $plug && ($plug->hasAdminArea() > 0) )
\r
592 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ADMN', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ADMN']) )
\r
594 $subTpl = "<a href=\"<%actadminurl%>\" tabindex=\"<%tabindex%>\"><%actadmintxt%></a><br />\n";
\r
598 $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ADMN'];
\r
601 'actadminurl' => Entity::hsc($plug->getAdminURL()),
\r
602 'tabindex' => $vars['tabindex'],
\r
603 'actadmintxt' => _LIST_PLUGS_ADMIN,
\r
605 $data['plugadminurl'] = Template::fill($subTpl, $subData);
\r
609 $data['plugadminurl'] = '';
\r
611 if ( $plug && ($plug->supportsFeature('HelpPage') > 0) )
\r
613 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HELP', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HELP']) )
\r
615 $subTpl = "<a href=\"<%acthelpurl%>\" tabindex=\"<%tabindex%>\"><%acthelptxt%></a><br />\n";
\r
619 $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HELP'];
\r
622 'acthelpurl' => 'index.php?action=pluginhelp&plugid=' . $current['pid'],
\r
623 'tabindex' => $vars['tabindex'],
\r
624 'acthelptxt' => _LIST_PLUGS_HELP,
\r
626 $data['plughelpurl'] = Template::fill($subTpl, $subData);
\r
630 $data['plughelpurl'] = '';
\r
632 $optQuery = 'SELECT '
\r
633 . ' COUNT(*) AS result '
\r
635 . sql_table('plugin_option_desc') . ' '
\r
637 . ' ocontext = "global" '
\r
639 $pOptions = DB::getValue(sprintf($optQuery, $current['pid']));
\r
640 if ( $pOptions > 0 )
\r
642 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGOPTSETURL', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGOPTSETURL']) )
\r
644 $subTpl = "<a href=\"<%actoptionurl%>\" tabindex=\"<%tabindex%>\"><%actoptiontxt%></a>\n";
\r
648 $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGOPTSETURL'];
\r
651 'actoptionurl' => 'index.php?action=pluginoptions&plugid=' . $current['pid'],
\r
652 'tabindex' => $vars['tabindex'],
\r
653 'actoptiontxt' => _LIST_PLUGS_OPTIONS,
\r
655 $data['plugoptsetting'] = Template::fill($subTpl, $subData);
\r
659 $data['plugoptsetting'] = '';
\r
663 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_FOOT']) )
\r
669 $template = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_FOOT'];
\r
674 return Template::fill($template, $data);
\r
677 function listplug_table_plugoptionlist($vars, $type, $template_name = '')
\r
681 $templates = array();
\r
682 if ( !empty($template_name) )
\r
684 $templates =& $manager->getTemplate($template_name);
\r
690 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_POPTLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_POPTLIST_HEAD']) )
\r
692 $template = "<th><%colinfo%></th>\n"
\r
693 . "<th><%colvalue%></th>\n";
\r
697 $template = $templates['SHOWLIST_LISTPLUG_TABLE_POPTLIST_HEAD'];
\r
700 'colinfo' => _LISTS_INFO,
\r
701 'colvalue' => _LISTS_VALUE,
\r
705 $current = $vars['current'];
\r
706 $template = listplug_plugOptionRow($current, $template_name);
\r
710 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_POPTLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_POPTLIST_FOOT']) )
\r
712 $template = "<tr>\n"
\r
713 . "<th colspan=\"2\"><%savetext%></th>\n"
\r
716 . "<td><%savetext%></td>\n"
\r
717 . "<td><input type=\"submit\" value=\"<%savetext%>\" /></td>\n"
\r
722 $template = $templates['SHOWLIST_LISTPLUG_TABLE_POPTLIST_FOOT'];
\r
725 'savetext' => _PLUGS_SAVE,
\r
730 return Template::fill($template, $data);
\r
733 function listplug_plugOptionRow($current, $template_name = '')
\r
737 $templates = array();
\r
738 if ( !empty($template_name) )
\r
740 $templates =& $manager->getTemplate($template_name);
\r
743 $varname = "plugoption[{$current['oid']}][{$current['contextid']}]";
\r
745 // retreive the optionmeta
\r
746 $meta = NucleusPlugin::getOptionMeta($current['typeinfo']);
\r
748 // only if it is not a hidden option write the controls to the page
\r
749 if ( in_array('access', $meta) && $meta['access'] == 'hidden' )
\r
755 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_POPTLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_POPTLIST_BODY']) )
\r
757 $template = "<td><%description%></td>\n"
\r
762 $template = $templates['SHOWLIST_LISTPLUG_TABLE_POPTLIST_BODY'];
\r
767 switch($current['type'])
\r
770 $template .= listplug_input_yesno($varname, $current['value'], 0, 'yes', 'no', _YES, _NO, 0, $template_name, 1);
\r
773 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OPWORD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OPWORD']) )
\r
775 $template .= "<input type=\"password\" size=\"40\" maxlength=\"128\" name=\"<%varname%>\" value=\"<%value%>\" />\n";
\r
779 $template .= $templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OPWORD'];
\r
782 'varname' => Entity::hsc($varname),
\r
783 'value' => Entity::hsc($current['value']),
\r
787 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEP', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEP']) )
\r
789 $template .= "<select name=\"<%varname%>\">\n";
\r
793 $template .= $templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEP'];
\r
795 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEO', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEO']) )
\r
797 $subTpl = "<option value=\"<%value%>\"<%selected%>><%optname%></option>\n";
\r
801 $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEO'];
\r
803 $options = NucleusPlugin::getOptionSelectValues($current['typeinfo']);
\r
804 $options = preg_split('#\|#', $options);
\r
806 for ( $i=0; $i<(count($options)-1); $i+=2 )
\r
808 $name = $options[$i];
\r
809 $value = $options[$i+1];
\r
810 if ( defined($name) )
\r
812 $name = constant($name);
\r
816 'optname' => Entity::hsc($name),
\r
817 'value' => Entity::hsc($value)
\r
819 if ($value != $current['value'])
\r
821 $subData['selected'] = '';
\r
825 $subData['selected'] = ' selected="selected"';
\r
827 $template .= Template::fill($subTpl, $subData);
\r
829 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEC', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEC']) )
\r
831 $template .= "</select>\n";
\r
835 $template .= $templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEC'];
\r
837 $data['varname'] = Entity::hsc($varname);
\r
840 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OTAREA', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OTAREA']) )
\r
842 $template .= "<textarea class=\"pluginoption\" cols=\"30\" rows=\"5\" name=\"<%varname%>\"<%readonly%>><%value%></textarea>\n";
\r
846 $template .= $templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OTAREA'];
\r
849 'varname' => Entity::hsc($varname),
\r
850 'value' => Entity::hsc($current['value'])
\r
852 if ( !array_key_exists('access', $current) || $current['access'] != 'readonly')
\r
854 $data['readonly'] = '';
\r
858 $data['readonly'] = ' readonly="readonly"';
\r
863 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OITEXT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OITEXT']) )
\r
865 $template .= "<input type=\"text\" size=\"40\" maxlength=\"128\" name=\"<%varname%>\" value=\"<%value%>\"<%datatype%><%readonly%> />\n";
\r
869 $template .= $templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OITEXT'];
\r
872 'varname' => Entity::hsc($varname),
\r
873 'value' => Entity::hsc($current['value'])
\r
875 if ( !array_key_exists('datatype', $current) || $current['datatype'] != 'numerical')
\r
877 $data['datatype'] = '';
\r
881 $data['datatype'] = ' onkeyup="checkNumeric(this)" onblur="checkNumeric(this)"';
\r
883 if ( !array_key_exists('access', $current) || $current['access'] != 'readonly')
\r
885 $data['readonly'] = '';
\r
889 $data['readonly'] = ' readonly="readonly"';
\r
893 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGOPTN_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGOPTN_FOOT']) )
\r
895 $template .= "<%extra%></td>\n";
\r
899 $template .= $templates['SHOWLIST_LISTPLUG_TABLE_PLUGOPTN_FOOT'];
\r
902 if ( !array_key_exists('extra', $current) )
\r
904 $data['extra'] = '';
\r
908 $data['extra'] = Entity::hsc($current['extra']);
\r
911 if ( !array_key_exists('description', $current) )
\r
913 $data['description'] = Entity::hsc($current['name']);
\r
915 else if ( !defined($current['description']) )
\r
917 $data['description'] = Entity::hsc($current['description']);
\r
921 $data['description'] = Entity::hsc(constant($current['description']));
\r
924 return Template::fill($template, $data, 1);
\r
928 * listplug_templateEditRow()
\r
930 * @param array $content content of target template
\r
931 * @param string $desc description of target template
\r
932 * @param string $name name of target template
\r
933 * @param string $help help text
\r
934 * @param integer $tabindex a number for tab index
\r
935 * @param boolean $big large or small textarea
\r
936 * @param array $template_name name of template for filling
\r
939 function listplug_templateEditRow($content, $desc, $name, $help = '', $tabindex = 0, $big = 0, $template_name = '')
\r
948 $templates = array();
\r
949 if ( $template_name )
\r
951 $templates =& $manager->getTemplate($template_name);
\r
955 'description' => $desc,
\r
956 'help' => empty($help) ? '' : helpHtml('template' . $help),
\r
957 'count' => $count++,
\r
959 'tabindex' => $tabindex,
\r
960 'rows' => $big ? 10 : 5,
\r
966 if ( !array_key_exists('TEMPLATE_EDIT_ROW_HEAD', $templates) || empty($tmplt['TEMPLATE_EDIT_ROW_HEAD']) )
\r
968 $template = "</tr>"
\r
970 . "<td><%description%><%help%></td>\n"
\r
971 . "<td id=\"td<%count%>\">\n"
\r
972 . "<textarea class=\"templateedit\" name=\"<%name%>\" tabindex=\"<%tabindex%>\" cols=\"50\" rows=\"<%rows%>\" id=\"textarea<%count%>\">";
\r
976 $template = $tmplt['TEMPLATE_EDIT_ROW_HEAD'];
\r
978 $message .= TEMPLATE::fill($template, $data);
\r
981 $message .= ENTITY::hsc($content);
\r
984 if ( !array_key_exists('TEMPLATE_EDIT_ROW_TAIL', $templates) || empty($tmplt['TEMPLATE_EDIT_ROW_TAIL']) )
\r
986 $template = "</textarea>\n"
\r
991 $template = $tmplt['TEMPLATE_EDIT_ROW_TAIL'];
\r
993 $message .= TEMPLATE::fill($template, $data);
\r
998 function listplug_table_itemlist($vars, $type, $template_name = '')
\r
1004 $templates = array();
\r
1005 if ( !empty($template_name) )
\r
1007 $templates =& $manager->getTemplate($template_name);
\r
1013 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_ITEMLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_ITEMLIST_HEAD']) )
\r
1015 $template = "<th><%colinfo%></th>\n"
\r
1016 . "<th><%colcontent%></th>\n"
\r
1017 . "<th style=\"white-space:nowrap\"><%colaction%></th>\n";
\r
1021 $template = $templates['SHOWLIST_LISTPLUG_TABLE_ITEMLIST_HEAD'];
\r
1024 'colinfo' => _LIST_ITEM_INFO,
\r
1025 'colcontent' => _LIST_ITEM_CONTENT,
\r
1026 'colaction' => _LISTS_ACTIONS
\r
1030 $current = $vars['current'];
\r
1031 // string -> unix timestamp
\r
1032 $current['itime'] = strtotime($current['itime']);
\r
1033 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_ITEMLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_ITEMLIST_BODY']) )
\r
1035 $template = "<td<%cssclass%>>\n"
\r
1036 . "<%bshortlabel%> <%bshortnameval%><br />\n"
\r
1037 . "<%categorylabel%> <%categorynameval%><br />\n"
\r
1038 . "<%authorlabel%> <%authornameval%><br />\n"
\r
1039 . "<%itemdatelabel%> <%itemdateval%><br />\n"
\r
1040 . "<%itemtimelabel%> <%itemtimeval%>\n"
\r
1042 . "<td<%cssclass%>>\n"
\r
1043 . "<input type=\"checkbox\" id=\"batch<%batchid%>\" name=\"batch[<%batchid%>]\" value=\"<%itemid%>\" />\n"
\r
1044 . "<label for=\"batch<%batchid%>\"><b><%itemtitle%></b></label><br />\n"
\r
1045 . "<%itembody%>\n"
\r
1047 . "<td<%cssclass%>>\n"
\r
1048 . "<a href=\"index.php?action=itemedit&itemid=<%itemid%>\"><%editbtn%></a><br />\n"
\r
1050 . "<a href=\"index.php?action=itemmove&itemid=<%itemid%>\"><%movebtn%></a><br />\n"
\r
1051 . "<a href=\"index.php?action=itemdelete&itemid=<%itemid%>\"><%delbtn%></a><br />\n"
\r
1056 $template = $templates['SHOWLIST_LISTPLUG_TABLE_ITEMLIST_BODY'];
\r
1060 if ( $current['idraft'] == 1 )
\r
1062 $cssclass = ' class="draft"';
\r
1065 // (can't use offset time since offsets might vary between blogs)
\r
1066 if ( $current['itime'] > $vars['now'] )
\r
1068 $cssclass = ' class="future"';
\r
1070 $body = strip_tags($current['ibody']);
\r
1072 'cssclass' => $cssclass,
\r
1073 'bshortlabel' => _LIST_ITEM_BLOG,
\r
1074 'bshortnameval' => Entity::hsc($current['bshortname']),
\r
1075 'categorylabel' => _LIST_ITEM_CAT,
\r
1076 'categorynameval' => Entity::hsc($current['cname']),
\r
1077 'authorlabel' => _LIST_ITEM_AUTHOR,
\r
1078 'authornameval' => Entity::hsc($current['mname']),
\r
1079 'itemdatelabel' => _LIST_ITEM_DATE,
\r
1080 'itemdateval' => date("Y-m-d",$current['itime']),
\r
1081 'itemdatelabel' => _LIST_ITEM_TIME,
\r
1082 'itemdateval' => date("H:i",$current['itime']),
\r
1083 'batchid' => listplug_nextBatchId(),
\r
1084 'itemid' => $current['inumber'],
\r
1085 'itemtitle' => Entity::hsc(strip_tags($current['ititle'])),
\r
1086 'itembody' => Entity::hsc(Entity::shorten($body, 300, '...')),
\r
1087 'editbtn' => _LISTS_EDIT,
\r
1088 'movebtn' => _LISTS_MOVE,
\r
1089 'delbtn' => _LISTS_DELETE,
\r
1091 // evaluate amount of comments for the item
\r
1092 $comment = new Comments($current['inumber']);
\r
1093 $camount = $comment->amountComments();
\r
1094 if ( $camount > 0 )
\r
1096 $data['camount'] = "<a href=\"index.php?action=itemcommentlist&itemid={$current['inumber']}\">(" . sprintf(_LIST_ITEM_COMMENTS, $comment->amountComments()) . ")</a><br />\n";
\r
1100 $data['camount'] = _LIST_ITEM_NOCONTENT . "<br />\n";
\r
1104 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_ITEMLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_ITEMLIST_FOOT']) )
\r
1110 $template = $templates['SHOWLIST_LISTPLUG_TABLE_ITEMLIST_FOOT'];
\r
1115 return Template::fill($template, $data);
\r
1118 // for batch operations: generates the index numbers for checkboxes
\r
1119 function listplug_nextBatchId()
\r
1125 function listplug_table_commentlist($vars, $type, $template_name = '')
\r
1129 $templates = array();
\r
1130 if ( !empty($template_name) )
\r
1132 $templates =& $manager->getTemplate($template_name);
\r
1138 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_CMNTLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_HEAD']) )
\r
1140 $template = "<th><%colinfo%></th>\n"
\r
1141 . "<th><%colcontent%></th>\n"
\r
1142 . "<th colspan=\"3\"><%colaction%></th>\n";
\r
1146 $template = $templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_HEAD'];
\r
1149 'colinfo' => _LISTS_INFO,
\r
1150 'colcontent' => _LIST_COMMENT,
\r
1151 'colaction' => _LISTS_ACTIONS
\r
1155 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_CMNTLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_BODY']) )
\r
1157 $template = "<td><%commentdate%><br /><%commentator%><br /><%commentsite%><br /><%commentmail%><br /></td>\n"
\r
1159 . "<input type=\"checkbox\" id=\"batch<%batchid%>\" name=\"batch[<%batchid%>]\" value=\"<%commentid%>\" />"
\r
1160 . "<label for=\"batch<%batchid%>\"><%commentbody%></label>\n"
\r
1162 . "<td style=\"white-space:nowrap\">\n"
\r
1163 . "<a href=\"index.php?action=commentedit&commentid=<%commentid%>\"><%editbtn%></a>\n"
\r
1165 . "<td style=\"white-space:nowrap\">\n"
\r
1166 . "<a href=\"index.php?action=commentdelete&commentid=<%commentid%>\"><%delbtn%></a>\n"
\r
1168 . "<%addbanlist%>";
\r
1172 $template = $templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_BODY'];
\r
1174 $current = $vars['current'];
\r
1175 $body = strip_tags($current['cbody']);
\r
1177 'commentdate' => date("Y-m-d@H:i", strtotime($current['ctime'])),
\r
1178 'batchid' => listplug_nextBatchId(),
\r
1179 'commentid' => $current['cnumber'],
\r
1180 'commentbody' => Entity::hsc(Entity::shorten($current['cbody'], 300, '...')),
\r
1181 'editbtn' => _LISTS_EDIT,
\r
1182 'delbtn' => _LISTS_DELETE,
\r
1184 if ( isset($current['mname']) )
\r
1186 $data['commentator'] = Entity::hsc($current['mname']) . ' ' . _LIST_COMMENTS_MEMBER;
\r
1190 $data['commentator'] = Entity::hsc($current['cuser']);
\r
1192 if ( isset($current['cmail']) && $current['cmail'] )
\r
1194 $data['commentsite'] = Entity::hsc($current['cmail']);
\r
1198 $data['commentsite'] = '';
\r
1200 if ( isset($current['cemail']) && $current['cemail'] )
\r
1202 $data['commentmail'] = Entity::hsc($current['cemail']);
\r
1206 $data['commentmail'] = '';
\r
1208 if ( $vars['canAddBan'] )
\r
1210 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_CMNTLIST_ABAN', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_ABAN']) )
\r
1212 $subTpl = "<td style=\"white-space:nowrap\">"
\r
1213 . "<a href=\"index.php?action=banlistnewfromitem&itemid=<%itemid%>&ip=<%banip%>\" title=\"<%banhost%>\"><%banbtn%></a>"
\r
1218 $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_ABAN'];
\r
1221 'itemid' => $current['citem'],
\r
1222 'banip' => Entity::hsc($current['cip']),
\r
1223 'banbtn' => _LIST_COMMENT_BANIP,
\r
1225 $data['addbanlist'] = Template::fill($subTpl, $subData);
\r
1229 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_CMNTLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_FOOT']) )
\r
1235 $template = $templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_FOOT'];
\r
1240 return Template::fill($template, $data);
\r
1243 function listplug_table_bloglist($vars, $type, $template_name = '')
\r
1247 $templates = array();
\r
1248 if ( !empty($template_name) )
\r
1250 $templates =& $manager->getTemplate($template_name);
\r
1256 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_BLOGLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_BLOGLIST_HEAD']) )
\r
1258 $template = "<th><%blognames%></th>\n"
\r
1259 . "<th colspan=\"7\"><%actionshead%></th>\n";
\r
1263 $template = $templates['SHOWLIST_LISTPLUG_TABLE_BLOGLIST_HEAD'];
\r
1266 'blognames' => _NAME,
\r
1267 'actionshead' => _LISTS_ACTIONS,
\r
1271 $current = $vars['current'];
\r
1272 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_BLOGLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_BLOGLIST_BODY']) )
\r
1274 $template = "<td title=\"blogid:<%blogid%> shortname:<%shortname%>\">\n"
\r
1275 . "<a href=\"<%blogurl%>\"><img src=\"images/globe.gif\" width=\"13\" height=\"13\" alt=\"<%iconalt%>\" /></a><%blogname%></td>\n"
\r
1276 . "<td><a href=\"index.php?action=createitem&blogid=<%blogid%>\" title=\"<%ttaddtext%>\"><%addtext%></a></td>\n"
\r
1277 . "<td><a href=\"index.php?action=itemlist&blogid=<%blogid%>\" title=\"<%ttedittext%>\"><%edittext%></a></td>\n"
\r
1278 . "<td><a href=\"index.php?action=blogcommentlist&blogid=<%blogid%>\" title=\"<%ttcommenttext%>\"><%commenttext%></a></td>\n"
\r
1279 . "<td><a href=\"index.php?action=bookmarklet&blogid=<%blogid%>\" title=\"<%ttbmlettext%>\"><%bmlettext%></a></td>\n";
\r
1283 $template = $templates['SHOWLIST_LISTPLUG_TABLE_BLOGLIST_BODY'];
\r
1286 'blogid' => $current['bnumber'],
\r
1287 'shortname' => Entity::hsc($current['bshortname']),
\r
1288 'blogurl' => $current['burl'],
\r
1289 'blogname' => Entity::hsc($current['bname']),
\r
1290 'ttaddtext' => _BLOGLIST_TT_ADD,
\r
1291 'addtext' => _BLOGLIST_ADD,
\r
1292 'ttedittext' => _BLOGLIST_TT_EDIT,
\r
1293 'edittext' => _BLOGLIST_EDIT,
\r
1294 'ttcommenttext' => _BLOGLIST_TT_COMMENTS,
\r
1295 'commenttext' => _BLOGLIST_COMMENTS,
\r
1296 'ttbmlettext' => _BLOGLIST_TT_BMLET,
\r
1297 'bmlettext' => _BLOGLIST_BMLET,
\r
1299 if ( $current['tadmin'] == 1 )
\r
1301 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_BLIST_BD_TADM', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_BLIST_BD_TADM']) )
\r
1303 $template .= "<td><a href=\"index.php?action=blogsettings&blogid=<%blogid%>\" title=\"<%ttsettingtext%>\"><%settingtext%></a></td>\n"
\r
1304 . "<td><a href=\"index.php?action=banlist&blogid=<%blogid%>\" title=\"<%ttbanstext%>\"><%banstext%></a></td>\n";
\r
1308 $template .= $templates['SHOWLIST_LISTPLUG_TABLE_BLIST_BD_TADM'];
\r
1310 $data['ttsettingtext'] = _BLOGLIST_TT_SETTINGS;
\r
1311 $data['settingtext'] = _BLOGLIST_SETTINGS;
\r
1312 $data['ttbanstext'] = _BLOGLIST_TT_BANS;
\r
1313 $data['banstext'] = _BLOGLIST_BANS;
\r
1316 if ( $vars['superadmin'] )
\r
1318 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_BLIST_BD_SADM', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_BLIST_BD_TADM']) )
\r
1320 $template .= "<td><a href=\"index.php?action=deleteblog&blogid=<%blogid%>\" title=\"<%ttdeletetext%>\"><%deletetext%></a></td>\n";
\r
1324 $template .= $templates['SHOWLIST_LISTPLUG_TABLE_BLIST_BD_SADM'];
\r
1326 $data['ttdeletetext'] = _BLOGLIST_TT_DELETE;
\r
1327 $data['deletetext'] = _BLOGLIST_DELETE;
\r
1331 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_BLOGLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_BLOGLIST_FOOT']) )
\r
1337 $template = $templates['SHOWLIST_LISTPLUG_TABLE_BLOGLIST_FOOT'];
\r
1342 return Template::fill($template, $data);
\r
1345 function listplug_table_shortblognames($vars, $type, $template_name = '')
\r
1349 $templates = array();
\r
1350 if ( !empty($template_name) )
\r
1352 $templates =& $manager->getTemplate($template_name);
\r
1358 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_HEAD']) )
\r
1360 $template = "<th><%colshortname%></th>\n"
\r
1361 . "<th><%colblogname%></th>\n";
\r
1365 $template = $templates['SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_HEAD'];
\r
1368 'colshortname' => _EBLOG_SHORTNAME,
\r
1369 'colblogname' => _EBLOG_NAME,
\r
1373 $current = $vars['current'];
\r
1374 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_BODY']) )
\r
1376 $template = "<td><%bshortname%></td>\n"
\r
1377 . "<td><%blogname%></td>\n";
\r
1381 $template = $templates['SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_BODY'];
\r
1384 'bshortname' => Entity::hsc($current['bshortname']),
\r
1385 'blogname' => Entity::hsc($current['bname']),
\r
1389 $current = $vars['current'];
\r
1390 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_FOOT']) )
\r
1396 $template = $templates['SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_FOOT'];
\r
1401 return Template::fill($template, $data);
\r
1404 function listplug_table_shortnames($vars, $type, $template_name = '')
\r
1408 $templates = array();
\r
1409 if ( !empty($template_name) )
\r
1411 $templates =& $manager->getTemplate($template_name);
\r
1417 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_SHORTNAM_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_SHORTNAM_HEAD']) )
\r
1419 $template = "<th><%colname%></th>\n"
\r
1420 . "<th><%coldesc%></th>\n";
\r
1424 $template = $templates['SHOWLIST_LISTPLUG_TABLE_SHORTNAM_HEAD'];
\r
1427 'colname' => _NAME,
\r
1428 'coldesc' => _LISTS_DESC,
\r
1432 $current = $vars['current'];
\r
1433 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_SHORTNAM_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_SHORTNAM_BODY']) )
\r
1435 $template = "<td><%name%></td>\n"
\r
1436 . "<td><%desc%></td>\n";
\r
1440 $template = $templates['SHOWLIST_LISTPLUG_TABLE_SHORTNAM_BODY'];
\r
1443 'name' => Entity::hsc($current['name']),
\r
1444 'desc' => Entity::hsc($current['description']),
\r
1448 $current = $vars['current'];
\r
1449 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_SHORTNAM_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_SHORTNAM_FOOT']) )
\r
1455 $template = $templates['SHOWLIST_LISTPLUG_TABLE_SHORTNAM_FOOT'];
\r
1460 return Template::fill($template, $data);
\r
1463 function listplug_table_categorylist($vars, $type, $template_name = '')
\r
1467 $templates = array();
\r
1468 if ( !empty($template_name) )
\r
1470 $templates =& $manager->getTemplate($template_name);
\r
1476 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_CATELIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_CATELIST_HEAD']) )
\r
1478 $template = "<th><%colname%></th>\n"
\r
1479 . "<th><%coldesc%></th>\n"
\r
1480 . "<th colspan=\"2\"><%colact%></th>\n";
\r
1484 $template = $templates['SHOWLIST_LISTPLUG_TABLE_CATELIST_HEAD'];
\r
1487 'colname' => _LISTS_NAME,
\r
1488 'coldesc' => _LISTS_DESC,
\r
1489 'colact' => _LISTS_ACTIONS,
\r
1493 $current = $vars['current'];
\r
1494 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_CATELIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_CATELIST_BODY']) )
\r
1496 $template = "<td>\n"
\r
1497 . "<input type=\"checkbox\" id=\"batch<%batchid%>\" name=\"batch[<%batchid%>]\" value=\"<%catid%>\" />\n"
\r
1498 . "<label for=\"batch<%batchid%>\"><%catname%></label>\n"
\r
1500 . "<td><%catdesc%></td>\n"
\r
1501 . "<td><a href=\"index.php?action=categoryedit&blogid=<%blogid%>&catid=<%catid%>\" tabindex=\"<%tabindex%>\"><%editbtn%></a></td>\n"
\r
1502 . "<td><a href=\"index.php?action=categorydelete&blogid=<%blogid%>&catid=<%catid%>\" tabindex=\"<%tabindex%>\"><%delbtn%></a></td>\n";
\r
1506 $template = $templates['SHOWLIST_LISTPLUG_TABLE_CATELIST_BODY'];
\r
1510 'batchid' => listplug_nextBatchId(),
\r
1511 'catid' => intval($current['catid']),
\r
1512 'catname' => Entity::hsc($current['cname']),
\r
1513 'catdesc' => Entity::hsc($current['cdesc']),
\r
1514 'blogid' => intval($current['cblog']),
\r
1515 'tabindex' => intval($vars['tabindex']),
\r
1516 'editbtn' => _LISTS_EDIT,
\r
1517 'delbtn' => _LISTS_DELETE,
\r
1521 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_CATELIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_CATELIST_FOOT']) )
\r
1527 $template = $templates['SHOWLIST_LISTPLUG_TABLE_CATELIST_FOOT'];
\r
1532 return Template::fill($template, $data);
\r
1535 function listplug_table_templatelist($vars, $type, $template_name = '')
\r
1537 global $manager, $CONF;
\r
1539 $templates = array();
\r
1540 if ( !empty($template_name) )
\r
1542 $templates =& $manager->getTemplate($template_name);
\r
1548 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_TPLTLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_HEAD']) )
\r
1550 $template = "<th><%colname%></th>\n"
\r
1551 . "<th><%coldesc%></th>\n"
\r
1552 . "<th colspan=\"3\"><%colact%></th>\n";
\r
1556 $template = $templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_HEAD'];
\r
1559 'colname' => _LISTS_NAME,
\r
1560 'coldesc' => _LISTS_DESC,
\r
1561 'colact' => _LISTS_ACTIONS,
\r
1565 $current = $vars['current'];
\r
1566 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_TPLTLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_BODY']) )
\r
1568 $template = "<td><%templatename%></td>\n"
\r
1569 . "<td><%templatedesc%></td>\n"
\r
1570 . "<td style=\"white-space:nowrap\">"
\r
1571 . "<a href=\"<%editurl%>\" tabindex=\"<%tabindex%>\"><%editbtn%></a>\n"
\r
1573 . "<td style=\"white-space:nowrap\">\n"
\r
1574 . "<a href=\"<%cloneurl%>\" tabindex=\"<%tabindex%>\"><%clonebtn%></a>\n"
\r
1576 . "<td style=\"white-space:nowrap\">\n"
\r
1577 . "<a href=\"<%deleteurl%>\" tabindex=\"<%tabindex%>\"><%delbtn%></a>\n"
\r
1582 $template = $templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_BODY'];
\r
1586 'templatename' => Entity::hsc($current['tdname']),
\r
1587 'templatedesc' => Entity::hsc($current['tddesc']),
\r
1588 'templateid' => (integer) $current['tdnumber'],
\r
1589 'tabindex' => (integer) $vars['tabindex'],
\r
1591 'clonebtn' => _LISTS_CLONE,
\r
1592 'cloneaction' => $vars['cloneaction'],
\r
1593 'cloneurl' => "{$CONF['AdminURL']}index.php?action={$vars['cloneaction']}&templateid={$current['tdnumber']}",
\r
1595 'delbtn' => _LISTS_DELETE,
\r
1596 'deleteaction' => $vars['deleteaction'],
\r
1597 'deleteurl' => "{$CONF['AdminURL']}index.php?action={$vars['deleteaction']}&templateid={$current['tdnumber']}",
\r
1599 'editbtn' => _LISTS_EDIT,
\r
1600 'editaction' => $vars['editaction'],
\r
1601 'editurl' => "{$CONF['AdminURL']}index.php?action={$vars['editaction']}&templateid={$current['tdnumber']}"
\r
1605 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_TPLTLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_FOOT']) )
\r
1611 $template = $templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_FOOT'];
\r
1616 return Template::fill($template, $data);
\r
1619 function listplug_table_skinlist($vars, $type, $template_name = '')
\r
1621 global $CONF, $DIR_SKINS, $manager;
\r
1623 $templates = array();
\r
1624 if ( !empty($template_name) )
\r
1626 $templates =& $manager->getTemplate($template_name);
\r
1632 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_SKINLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_HEAD']) )
\r
1634 $template = "<th><%colname%></th>\n"
\r
1635 . "<th><%coldesc%></th>\n"
\r
1636 . "<th colspan=\"3\"><%colact%></th>\n";
\r
1640 $template = $templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_HEAD'];
\r
1643 'colname' => _LISTS_NAME,
\r
1644 'coldesc' => _LISTS_DESC,
\r
1645 'colact' => _LISTS_ACTIONS,
\r
1649 $current = $vars['current'];
\r
1650 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_SKINLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_BODY']) )
\r
1652 $template = "<td><%skinname%><br /><br />\n"
\r
1653 . "<%skintypelabel%> <%skintype%><br />\n"
\r
1654 . "<%incmodelabel%> <%incmode%><br />\n"
\r
1655 . "<%incpreflabel%> <%incpref%><br />\n"
\r
1657 . "<%readme%></td>\n"
\r
1658 . "<td class=\"availableSkinTypes\"><%skindesc%><%skinparts%></td>\n"
\r
1659 . "<td style=\"white-space:nowrap\">"
\r
1660 . "<a href=\"index.php?action=skinedit&skinid=<%skinid%>\" tabindex=\"<%tabindex%>\"><%editbtn%></a>"
\r
1662 . "<td style=\"white-space:nowrap\">"
\r
1663 . "<a href=\"<%cloneurl%>\" tabindex=\"<%tabindex%>\"><%clonebtn%></a>"
\r
1665 . "<td style=\"white-space:nowrap\">"
\r
1666 . "<a href=\"index.php?action=skindelete&skinid=<%skinid%>\" tabindex=\"<%tabindex%>\"><%delbtn%></a>"
\r
1671 $template = $templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_BODY'];
\r
1675 'tabindex' => $vars['tabindex']++,
\r
1677 'skinid' => (integer) $current['sdnumber'],
\r
1678 'skindesc' => Entity::hsc($current['sddesc']),
\r
1680 'skintypelabel' => _LISTS_TYPE,
\r
1681 'skintype' => Entity::hsc($current['sdtype']),
\r
1683 'incmodelabel' => _LIST_SKINS_INCMODE,
\r
1684 'incmode' => ($current['sdincmode'] == 'skindir') ? _PARSER_INCMODE_SKINDIR : _PARSER_INCMODE_NORMAL,
\r
1686 'incpreflabel' => ($current['sdincpref']) ? _LIST_SKINS_INCMODE : '',
\r
1687 'incpref' => ($current['sdincpref']) ? Entity::hsc($current['sdincpref']) : '',
\r
1689 'editbtn' => _LISTS_EDIT,
\r
1690 'editaction' => $vars['editaction'],
\r
1691 'editurl' => "{$CONF['AdminURL']}index.php?action={$vars['editaction']}&skinid={$current['sdnumber']}",
\r
1693 'clonebtn' => _LISTS_CLONE,
\r
1694 'cloneaction' => $vars['cloneaction'],
\r
1695 'cloneurl' => "{$CONF['AdminURL']}index.php?action={$vars['cloneaction']}&skinid={$current['sdnumber']}",
\r
1697 'delbtn' => _LISTS_DELETE,
\r
1698 'deleteaction' => $vars['deleteaction'],
\r
1699 'deleteurl' => "{$CONF['AdminURL']}index.php?action={$vars['deleteaction']}&skinid={$current['sdnumber']}"
\r
1702 if ( $current['sdnumber'] != $vars['default'] )
\r
1704 $data['skinname'] = Entity::hsc($current['sdname']);
\r
1708 $data['skinname'] = '<strong>' . Entity::hsc($current['sdname']) . '</strong>';
\r
1711 // add preview image when present
\r
1712 if ( $current['sdincpref'] && @file_exists("{$DIR_SKINS}{$current['sdincpref']}preview.png") )
\r
1714 $data['skinthumb'] = "<p>\n";
\r
1716 $alternatve_text = sprintf(_LIST_SKIN_PREVIEW, $current['sdname']);
\r
1717 $has_enlargement = @file_exists($DIR_SKINS . $current['sdincpref'] . 'preview-large.png');
\r
1718 if ( $has_enlargement )
\r
1720 $data['skinthumb'] .= '<a href="' . $CONF['SkinsURL'] . Entity::hsc($current['sdincpref']) . 'preview-large.png" title="' . _LIST_SKIN_PREVIEW_VIEWLARGER . "\">\n";
\r
1722 $data['skinthumb'] .= '<img class="skinpreview" src="' . $CONF['SkinsURL'] . Entity::hsc($current['sdincpref']) . 'preview.png" width="100" height="75" alt="' . $alternatve_text . "\" />\n";
\r
1723 if ( $has_enlargement )
\r
1725 $data['skinthumb'] .= "</a><br />\n";
\r
1728 if ( @file_exists("{$DIR_SKINS}{$current['sdincpref']}readme.html") )
\r
1730 $url = $CONF['SkinsURL'] . Entity::hsc($current['sdincpref']) . 'readme.html';
\r
1731 $title = sprintf(_LIST_SKIN_README, $current['sdname']);
\r
1732 $data['readme'] = "<a href=\"{$url}\" title=\"{$title}\">" . _LIST_SKIN_README_TXT . "</a>\n";
\r
1736 $data['readme'] ="";
\r
1739 $data['skinthumb'] .= "</p>\n";
\r
1742 if ( !preg_match('#^admin#', $current['sdname']) )
\r
1744 $skin =& $manager->getSkin($current['sdnumber']);
\r
1748 $skin =& $manager->getSkin($current['sdnumber'], 'AdminActions');
\r
1750 $available_types = $skin->getAvailableTypes();
\r
1752 $data['skinparts'] = _LIST_SKINS_DEFINED
\r
1754 foreach ( $available_types as $type => $label )
\r
1756 if ( $label === FALSE )
\r
1758 $label = ucfirst($type);
\r
1759 $article = 'skinpartspecial';
\r
1763 $article = "skinpart{$type}";
\r
1765 $data['skinparts'] .= "<li>\n"
\r
1766 . helpHtml($article) . "\n"
\r
1767 . "<a href=\"{$CONF['AdminURL']}index.php?action={$vars['edittypeaction']}&skinid={$current['sdnumber']}&type={$type}\" tabindex=\"{$vars['tabindex']}\">"
\r
1768 . Entity::hsc($label)
\r
1772 $data['skinparts'] .= "</ul>\n";
\r
1775 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_SKINLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_FOOT']) )
\r
1781 $template = $templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_FOOT'];
\r
1786 return Template::fill($template, $data);
\r
1789 function listplug_table_draftlist($vars, $type, $template_name = '')
\r
1793 $templates = array();
\r
1794 if ( !empty($template_name) )
\r
1796 $templates =& $manager->getTemplate($template_name);
\r
1801 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_DRFTLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_DRFTLIST_HEAD']) )
\r
1803 $template = "<th><%colblog%></th>\n"
\r
1804 . "<th><%coldesc%></th>\n"
\r
1805 . "<th colspan=\"2\"><%colact%></th>\n";
\r
1809 $template = $templates['SHOWLIST_LISTPLUG_TABLE_DRFTLIST_HEAD'];
\r
1812 'colblog' => _LISTS_BLOG,
\r
1813 'coldesc' => _LISTS_TITLE,
\r
1814 'colact' => _LISTS_ACTIONS,
\r
1818 $current = $vars['current'];
\r
1819 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_DRFTLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_DRFTLIST_BODY']) )
\r
1821 $template = "<td><%bshortname%></td>\n"
\r
1822 . "<td><%ititle%></td>\n"
\r
1823 . "<td><a href=\"index.php?action=itemedit&itemid=<%itemid%>\"><%editbtn%></a></td>\n"
\r
1824 . "<td><a href=\"index.php?action=itemdelete&itemid=<%itemid%>\"><%delbtn%></a></td>\n";
\r
1828 $template = $templates['SHOWLIST_LISTPLUG_TABLE_DRFTLIST_BODY'];
\r
1831 'bshortname' => Entity::hsc($current['bshortname']),
\r
1832 'ititle' => Entity::hsc(strip_tags($current['ititle'])),
\r
1833 'itemid' => intval($current['inumber']),
\r
1834 'editbtn' => _LISTS_EDIT,
\r
1835 'delbtn' => _LISTS_DELETE,
\r
1839 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_DRFTLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_DRFTLIST_FOOT']) )
\r
1845 $template = $templates['SHOWLIST_LISTPLUG_TABLE_DRFTLIST_FOOT'];
\r
1850 return Template::fill($template, $data);
\r
1853 function listplug_table_otherdraftlist($vars, $type, $template_name = '')
\r
1857 $templates = array();
\r
1858 if ( !empty($template_name) )
\r
1860 $templates =& $manager->getTemplate($template_name);
\r
1866 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_HEAD']) )
\r
1868 $template = "<th><%colblog%></th>\n"
\r
1869 . "<th><%coldesc%></th>\n"
\r
1870 . "<th><%colautr%></th>\n"
\r
1871 . "<th colspan=\"2\"><%colact%></th>\n";
\r
1875 $template = $templates['SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_HEAD'];
\r
1878 'colblog' => _LISTS_BLOG,
\r
1879 'coldesc' => _LISTS_TITLE,
\r
1880 'colautr' => _LISTS_AUTHOR,
\r
1881 'colact' => _LISTS_ACTIONS,
\r
1885 $current = $vars['current'];
\r
1886 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_BODY']) )
\r
1888 $template = "<td><%bshortname%></td>\n"
\r
1889 . "<td><%ititle%></td>\n"
\r
1890 . "<td><%iauthor%></td>\n"
\r
1891 . "<td><a href=\"index.php?action=itemedit&itemid=<%itemid%>\"><%editbtn%></a></td>\n"
\r
1892 . "<td><a href=\"index.php?action=itemdelete&itemid=<%itemid%>\"><%delbtn%></a></td>\n";
\r
1896 $template = $templates['SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_BODY'];
\r
1899 'bshortname' => Entity::hsc($current['bshortname']),
\r
1900 'ititle' => Entity::hsc(strip_tags($current['ititle'])),
\r
1901 'iauthor' => Entity::hsc(strip_tags($current['mname'])),
\r
1902 'itemid' => intval($current['inumber']),
\r
1903 'editbtn' => _LISTS_EDIT,
\r
1904 'delbtn' => _LISTS_DELETE,
\r
1908 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_FOOT']) )
\r
1914 $template = $templates['SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_FOOT'];
\r
1919 return Template::fill($template, $data);
\r
1922 function listplug_table_actionlist($vars, $type, $template_name = '')
\r
1926 $templates = array();
\r
1927 if ( !empty($template_name) )
\r
1929 $templates =& $manager->getTemplate($template_name);
\r
1935 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_ACTNLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_ACTNLIST_HEAD']) )
\r
1937 $template = "<th><%coltime%></th>\n"
\r
1938 . "<th><%colmesg%></th>\n";
\r
1942 $template = $templates['SHOWLIST_LISTPLUG_TABLE_ACTNLIST_HEAD'];
\r
1945 'coltime' => _LISTS_TIME,
\r
1946 'colmesg' => _LIST_ACTION_MSG,
\r
1950 $current = $vars['current'];
\r
1951 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_ACTNLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_ACTNLIST_BODY']) )
\r
1953 $template = "<td><%timestamp%></td>\n"
\r
1954 . "<td><%message%></td>\n";
\r
1958 $template = $templates['SHOWLIST_LISTPLUG_TABLE_ACTNLIST_BODY'];
\r
1961 'timestamp' => Entity::hsc($current['timestamp']),
\r
1962 'message' => Entity::hsc($current['message']),
\r
1966 $current = $vars['current'];
\r
1967 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_ACTNLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_ACTNLIST_FOOT']) )
\r
1973 $template = $templates['SHOWLIST_LISTPLUG_TABLE_ACTNLIST_FOOT'];
\r
1978 return Template::fill($template, $data);
\r
1981 function listplug_table_banlist($vars, $type, $template_name = '')
\r
1985 $templates = array();
\r
1986 if ( !empty($template_name) )
\r
1988 $templates =& $manager->getTemplate($template_name);
\r
1994 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_IBANLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_IBANLIST_HEAD']) )
\r
1996 $template = "<th><%iprange%></th>\n"
\r
1997 . "<th><%reason%></th>\n"
\r
1998 . "<th><%colact%></th>\n";
\r
2002 $template = $templates['SHOWLIST_LISTPLUG_TABLE_IBANLIST_HEAD'];
\r
2005 'iprange' => _LIST_BAN_IPRANGE,
\r
2006 'reason' => _LIST_BAN_REASON,
\r
2007 'colact' => _LISTS_ACTIONS,
\r
2011 $current = $vars['current'];
\r
2012 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_IBANLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_IBANLIST_BODY']) )
\r
2014 $template = "<td><%iprange%></td>\n"
\r
2015 . "<td><%reason%></td>\n"
\r
2016 . "<td><a href=\"index.php?action=banlistdelete&blogid=<%blogid%>&iprange=<%iprange%>\"><%delbtn%></a></td>\n";
\r
2020 $template = $templates['SHOWLIST_LISTPLUG_TABLE_IBANLIST_BODY'];
\r
2023 'iprange' => Entity::hsc($current['iprange']),
\r
2024 'reason' => Entity::hsc($current['reason']),
\r
2025 'blogid' => intval($current['blogid']),
\r
2026 'delbtn' => _LISTS_DELETE,
\r
2030 $current = $vars['current'];
\r
2031 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_IBANLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_IBANLIST_FOOT']) )
\r
2037 $template = $templates['SHOWLIST_LISTPLUG_TABLE_IBANLIST_FOOT'];
\r
2042 return Template::fill($template, $data);
\r
2046 * listplug_list_normalskinlist()
\r
2048 * @param array $vars array for variables
\r
2049 * @param string $type HEAD/BODY/FOOT
\r
2050 * @param string $template_name name of template
\r
2051 * @return string marked-up string
\r
2053 function listplug_list_normalskinlist($vars, $type, $template_name = '')
\r
2055 global $manager, $CONF;
\r
2057 /* available variables as a default */
\r
2059 'skinid' => (integer) $vars['skinid'],
\r
2060 'skinname' => Entity::hsc($vars['skinname']),
\r
2063 $templates = array();
\r
2064 if ( $template_name )
\r
2066 $templates =& $manager->getTemplate($template_name);
\r
2072 if ( !array_key_exists('NORMALSKINLIST_HEAD', $templates) || empty($templates['NORMALSKINLIST_HEAD']) )
\r
2074 $template = "<ul>\n";
\r
2078 $template = $templates['NORMALSKINLIST_HEAD'];
\r
2083 $current = $vars['current'];
\r
2084 if ( !array_key_exists('NORMALSKINLIST_BODY', $templates) || empty($templates['NORMALSKINLIST_BODY']) )
\r
2086 $template = "<li>"
\r
2087 . "<a href=\"<%editurl%>\" tabindex=\"<%tabindex%>\"><%skintypename%></a>"
\r
2093 $template = $templates['NORMALSKINLIST_BODY'];
\r
2096 $data['tabindex'] = $vars['tabindex']++;
\r
2097 $data['skintype'] = $current['skintype'];
\r
2098 $data['skintypename'] = $current['skintypename'];
\r
2099 $data['editaction'] = $vars['editaction'];
\r
2100 $data['editurl'] = "{$CONF['AdminURL']}?action={$vars['editaction']}&skinid={$vars['skinid']}&type={$current['skintype']}";
\r
2101 /* TODO: removeaction? */
\r
2102 /* TODO: customHelpHtml("skinpart{$skintype}-{$template_name}") */
\r
2103 $data['help'] = '';
\r
2106 if ( !array_key_exists('NORMALSKINLIST_FOOT', $templates) || empty($templates['NORMALSKINLIST_FOOT']) )
\r
2108 $template = "</ul>\n";
\r
2112 $template = $templates['NORMALSKINLIST_FOOT'];
\r
2118 return Template::fill($template, $data);
\r
2122 * listplug_list_specialskinlist()
\r
2124 * @param array $vars array for variables
\r
2125 * @param string $type HEAD/BODY/FOOT
\r
2126 * @param string $template_name name of template
\r
2127 * @return string marked-up string
\r
2129 function listplug_list_specialskinlist($vars, $type, $template_name = '')
\r
2131 global $manager, $CONF;
\r
2133 /* available variables as a default */
\r
2135 'skinid' => (integer) $vars['skinid'],
\r
2136 'skinname' => Entity::hsc($vars['skinname']),
\r
2139 /* retrieve templates */
\r
2140 $templates = array();
\r
2141 if ( $template_name )
\r
2143 $templates =& $manager->getTemplate($template_name);
\r
2149 if ( !array_key_exists('SPECIALSKINLIST_HEAD', $templates) || empty($templates['SPECIALSKINLIST_HEAD']) )
\r
2151 $template = "<ul>\n";
\r
2155 $template = $templates['SPECIALSKINLIST_HEAD'];
\r
2159 $current = $vars['current'];
\r
2160 if ( !array_key_exists('SPECIALSKINLIST_BODY', $templates) || empty($templates['SPECIALSKINLIST_BODY']) )
\r
2162 $template = "<li>"
\r
2163 . "<a href=\"<%editurl%>\" tabindex=\"<%tabindex%>\">"
\r
2167 . "<a href=\"<%removeurl%>\" tabindex=\"<%tabindex%>\" >"
\r
2168 . "<%text(_LISTS_DELETE)%>"
\r
2175 $template = $templates['SPECIALSKINLIST_BODY'];
\r
2178 $data['tabindex'] = (integer) $vars['tabindex']++;
\r
2179 $data['skintype'] = Entity::hsc($current['skintype']);
\r
2180 $data['skintypename'] = Entity::hsc($current['skintypename']);
\r
2181 $data['editaction'] = $vars['editaction'];
\r
2182 $data['editurl'] = "{$CONF['AdminURL']}?action={$vars['editaction']}&skinid={$vars['skinid']}&type={$current['skintype']}";
\r
2183 $data['removeaction'] = $vars['editaction'];
\r
2184 $data['removeurl'] = "{$CONF['AdminURL']}?action={$vars['removeaction']}&skinid={$vars['skinid']}&type={$current['skintype']}";
\r
2188 if ( !array_key_exists('SPECIALSKINLIST_FOOT', $templates) || empty($templates['SPECIALSKINLIST_FOOT']) )
\r
2190 $template = "</ul>\n";
\r
2194 $template = $templates['SPECIALSKINLIST_FOOT'];
\r
2199 return Template::fill($template, $data);
\r
2203 * listplug_input_yesno()
\r
2205 * @param string $name name of input element with radio type attribute
\r
2206 * @param string $checkedval value which should be checked
\r
2207 * @param integer $tabindex tabindex number
\r
2208 * @param string $value1 value of radio 1
\r
2209 * @param string $value2 value of radio 2
\r
2210 * @param string $yesval label for yes
\r
2211 * @param string $noval label for no
\r
2212 * @param boolean $isAdmin super admin or not
\r
2213 * @param string $template_name name of template
\r
2214 * @param boolean $showlist used in showlist or not
\r
2215 * @return string marked-up string
\r
2217 function listplug_input_yesno($name, $checkedval, $tabindex = 0,
\r
2218 $value1 = 1, $value2 = 0, $yesval = _YES, $noval = _NO,
\r
2219 $isAdmin = 0, $template_name = '', $showlist = FALSE)
\r
2223 $templates = array();
\r
2224 if ( $template_name )
\r
2226 $templates =& $manager->getTemplate($template_name);
\r
2229 if ( $name == 'admin' )
\r
2231 if ( !array_key_exists('INPUTYESNO_TEMPLATE_ADMIN', $templates) || empty($templates['INPUTYESNO_TEMPLATE_ADMIN']) )
\r
2233 $template = "<input type=\"radio\" id=\"<%yesid%>\" name=\"<%name%>\" value=\"<%yesval%>\" <%yescheckedval%> onclick=\"selectCanLogin(true);\" />\n"
\r
2234 . "<label for=\"<%yesid%>\"><%yesvaltext%></label>\n"
\r
2235 . "<input type=\"radio\" id=\"<%noid%>\" name=\"<%name%>\" value=\"<%noval%>\" <%nocheckedval%> <%disabled%> onclick=\"selectCanLogin(false);\" />\n"
\r
2236 . "<label for=\"<%noid%>\"><%novaltext%></label>\n";
\r
2240 $template = $templates['INPUTYESNO_TEMPLATE_ADMIN'];
\r
2245 if ( array_key_exists('INPUTYESNO_TEMPLATE_NORMAL', $templates) && !empty($templates['INPUTYESNO_TEMPLATE_NORMAL']) )
\r
2247 $template = $templates['INPUTYESNO_TEMPLATE_NORMAL'];
\r
2249 else if ( $showlist && array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OYESNO', $templates) && !empty($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OYESNO']) )
\r
2251 $template = $templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OYESNO'];
\r
2255 $template = "<input type=\"radio\" id=\"<%yesid%>\" name=\"<%name%>\" value=\"<%yesval%>\" <%yescheckedval%> />\n"
\r
2256 . "<label for=\"<%yesid%>\"><%yesvaltext%></label>\n"
\r
2257 . "<input type=\"radio\" id=\"<%noid%>\" name=\"<%name%>\" value=\"<%noval%>\" <%nocheckedval%> <%disabled%> />\n"
\r
2258 . "<label for=\"<%noid%>\"><%novaltext%></label>\n";
\r
2262 $id = preg_replace('#[|]#', '-', $name);
\r
2263 $id1 = $id . $value1;
\r
2264 $id2 = $id . $value2;
\r
2266 'name' => Entity::hsc($name),
\r
2267 'yesval' => Entity::hsc($value1),
\r
2268 'noval' => Entity::hsc($value2),
\r
2269 'yesid' => Entity::hsc($id1),
\r
2270 'noid' => Entity::hsc($id2),
\r
2271 'yesvaltext' => $yesval,
\r
2272 'novaltext' => $noval,
\r
2273 'yescheckedval' => ($checkedval == $value1) ? 'checked="checked" tabindex="' . $tabindex . '"': '',
\r
2274 'nocheckedval' => ($checkedval != $value1) ? 'checked="checked" tabindex="' . $tabindex . '"': '',
\r
2275 'disabled' => ($isAdmin && $name == 'canlogin') ? ' disabled="disabled"' : '',
\r
2278 return Template::fill($template, $dat);
\r
2282 * listplug_batchlist()
\r
2284 * @param string $attr item/member/team/category/comment
\r
2285 * @param resource $query SQL resorce
\r
2286 * @param string $type type for showlist()
\r
2287 * @param array $vars array for variables
\r
2289 function listplug_batchlist($attr, $query, $type, $vars)
\r
2294 $content = "<form method=\"post\" action=\"index.php\">\n";
\r
2297 $content .= showlist($query, $type, $vars);
\r
2304 'delete' => _BATCH_ITEM_DELETE,
\r
2305 'move' => _BATCH_ITEM_MOVE
\r
2310 'delete' => _BATCH_MEMBER_DELETE,
\r
2311 'setadmin' => _BATCH_MEMBER_SET_ADM,
\r
2312 'unsetadmin' => _BATCH_MEMBER_UNSET_ADM
\r
2317 'delete' => _BATCH_TEAM_DELETE,
\r
2318 'setadmin' => _BATCH_TEAM_SET_ADM,
\r
2319 'unsetadmin' => _BATCH_TEAM_UNSET_ADM,
\r
2324 'delete' => _BATCH_CAT_DELETE,
\r
2325 'move' => _BATCH_CAT_MOVE,
\r
2330 'delete' => _BATCH_COMMENT_DELETE,
\r
2334 $options = array();
\r
2338 $content .= "<p class=\"batchoperations\">\n"
\r
2340 . "<select name=\"batchaction\">\n";
\r
2342 foreach ( $options as $option => $label )
\r
2344 $content .= "<option value=\"{$option}\">{$label}</option>\n";
\r
2346 $content .= "</select>\n";
\r
2348 if ( $attr == 'team' )
\r
2350 $content .= '<input type="hidden" name="blogid" value="' . intRequestVar('blogid') . '" />';
\r
2352 else if ( $attr == 'comment' )
\r
2354 $content .= '<input type="hidden" name="itemid" value="' . intRequestVar('itemid') . '" />';
\r
2357 $content .= '<input type="submit" value="' . _BATCH_EXEC . '" />'
\r
2359 . "<a href=\"\" onclick=\"if( event && event.preventDefault ) event.preventDefault(); return batchSelectAll(1); \">" . _BATCH_SELECTALL . "</a>"
\r
2361 . "<a href=\"\" onclick=\"if( event && event.preventDefault ) event.preventDefault(); return batchSelectAll(0); \">" . _BATCH_DESELECTALL . "</a>"
\r
2363 . "<input type=\"hidden\" name=\"action\" value=\"batch{$attr}\" />\n"
\r
2364 . '<input type="hidden" name="ticket" value="' . Entity::hsc($manager->getNewTicket()) . '" />' . "\n"
\r
2372 * listplug_navlist()
\r
2374 * @param string $attr item/member/team/category/comment
\r
2375 * @param resource $query SQL resorce
\r
2376 * @param string $type type for showlist()
\r
2377 * @param array $vars array for variables
\r
2379 function listplug_navlist($attribute, $query, $type, $vars)
\r
2383 $prev = $vars['start'] - $vars['amount'];
\r
2384 if ( $prev < $vars['minamount'] )
\r
2386 $prev = $vars['minamount'];
\r
2389 $next = $vars['start'] + $vars['amount'];
\r
2392 $navi .= "<table frame=\"box\" rules=\"all\" sumamry=\"navigation actions\" class=\"navigation\">\n"
\r
2395 . "<form method=\"post\" action=\"{$CONF['AdminURL']}\">\n"
\r
2396 . "<input type=\"hidden\" name=\"start\" value=\"{$prev}\" />\n"
\r
2397 . "<button type=\"submit\" name=\"action\" value=\"{$vars['action']}\">< < " . _LISTS_PREV . "</button>\n"
\r
2398 . "<input type=\"hidden\" name=\"blogid\" value=\"{$vars['blogid']}\" />\n"
\r
2399 . "<input type=\"hidden\" name=\"itemid\" value=\"{$vars['itemid']}\" />\n"
\r
2400 . "<input type=\"hidden\" name=\"search\" value=\"{$vars['search']}\" />\n"
\r
2401 . "<input type=\"hidden\" name=\"amount\" value=\"{$vars['amount']}\" />\n"
\r
2405 . "<form method=\"post\" action=\"{$CONF['AdminURL']}\">\n"
\r
2406 . "<input type=\"text\" name=\"amount\" size=\"3\" value=\"{$vars['amount']}\" />\n"
\r
2408 . "<input type=\"hidden\" name=\"start\" value=\"0\" />\n"
\r
2409 . "<button type=\"submit\" name=\"action\" value=\"{$vars['action']}\">> " . _LISTS_CHANGE . "</button>\n"
\r
2410 . "<input type=\"hidden\" name=\"blogid\" value=\"{$vars['blogid']}\" />\n"
\r
2411 . "<input type=\"hidden\" name=\"itemid\" value=\"{$vars['itemid']}\" />\n"
\r
2412 . "<input type=\"hidden\" name=\"search\" value=\"{$vars['search']}\" />\n"
\r
2413 . "<input type=\"hidden\" name=\"amount\" value=\"{$vars['amount']}\" />\n"
\r
2417 . "<form method=\"post\" action=\"{$CONF['AdminURL']}\">\n"
\r
2418 . "<input type=\"text\" name=\"search\" value=\"{$vars['search']}\" size=\"7\" />\n"
\r
2419 . "<input type=\"hidden\" name=\"start\" value=\"0\" />\n"
\r
2420 . "<button type=\"submit\" name=\"action\" value=\"{$vars['action']}\">> " . _LISTS_SEARCH . "</button>\n"
\r
2421 . "<input type=\"hidden\" name=\"blogid\" value=\"{$vars['blogid']}\" />\n"
\r
2422 . "<input type=\"hidden\" name=\"itemid\" value=\"{$vars['itemid']}\" />\n"
\r
2423 . "<input type=\"hidden\" name=\"search\" value=\"{$vars['search']}\" />\n"
\r
2424 . "<input type=\"hidden\" name=\"amount\" value=\"{$vars['amount']}\" />\n"
\r
2428 . "<form method=\"post\" action=\"{$CONF['AdminURL']}\">\n"
\r
2429 . "<input type=\"hidden\" name=\"start\" value=\"{$next}\" />\n"
\r
2430 . "<button type=\"submit\" name=\"action\" value=\"{$vars['action']}\">" . _LISTS_NEXT . "> > </button>\n"
\r
2431 . "<input type=\"hidden\" name=\"blogid\" value=\"{$vars['blogid']}\" />\n"
\r
2432 . "<input type=\"hidden\" name=\"itemid\" value=\"{$vars['itemid']}\" />\n"
\r
2433 . "<input type=\"hidden\" name=\"search\" value=\"{$vars['search']}\" />\n"
\r
2434 . "<input type=\"hidden\" name=\"amount\" value=\"{$vars['amount']}\" />\n"
\r
2437 $navi .= "</tr>\n"
\r
2441 $template = $navi;
\r
2444 $template .= listplug_batchlist($attribute, $query, $type, $vars);
\r
2447 $template .= $navi;
\r