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=\"{$vars['content']}\">\n"
\r
153 $template = $templates['SHOWLIST_LISTPLUG_TABLE_HEAD'];
\r
156 'summary' => $vars['content'],
\r
157 'typehead' => call_user_func("listplug_table_" . $vars['content'] , $vars, 'HEAD', $template_name)
\r
161 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_BODY']) )
\r
163 $template = "<tr onmouseover=\"focusRow(this);\" onmouseout=\"blurRow(this);\">\n"
\r
169 $template = $templates['SHOWLIST_LISTPLUG_TABLE_BODY'];
\r
171 // tabletype specific thingies
\r
173 'typebody' => call_user_func("listplug_table_" . $vars['content'] , $vars, 'BODY', $template_name)
\r
177 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_FOOT']) )
\r
179 $template = "<%typefoot%>\n"
\r
185 $template = $templates['SHOWLIST_LISTPLUG_TABLE_FOOT'];
\r
187 // tabletype specific thingies
\r
189 'typefoot' => call_user_func("listplug_table_" . $vars['content'] , $vars, 'FOOT', $template_name)
\r
194 return Template::fill($template, $data);
\r
197 function listplug_table_memberlist($vars, $type, $template_name = '')
\r
201 $templates = array();
\r
202 if ( !empty($template_name) )
\r
204 $templates =& $manager->getTemplate($template_name);
\r
210 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_MEMBLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_MEMBLIST_HEAD']) )
\r
212 $template = "<th><%colmembername%></th>\n"
\r
213 . "<th><%colmemberrname%></th>\n"
\r
214 . "<th><%colmemberurl%></th>\n"
\r
215 . "<th><%colmemberadmin%><%helplink(superadmin)%></th>\n"
\r
216 . "<th><%colmemberlogin%><%helplink(canlogin)%></th>\n"
\r
217 . "<th colspan=\"2\"><%colactions%></th>\n";
\r
221 $template = $templates['SHOWLIST_LISTPLUG_TABLE_MEMBLIST_HEAD'];
\r
224 'colmembername' => _LIST_MEMBER_NAME,
\r
225 'colmemberrname' => _LIST_MEMBER_RNAME,
\r
226 'colmemberurl' => _LIST_MEMBER_URL,
\r
227 'colmemberadmin' => _LIST_MEMBER_ADMIN,
\r
228 'colmemberlogin' => _LIST_MEMBER_LOGIN,
\r
229 'colactions' => _LISTS_ACTIONS,
\r
233 $current = $vars['current'];
\r
234 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_MEMBLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_MEMBLIST_BODY']) )
\r
236 $template = "<td>\n"
\r
237 . "<input type=\"checkbox\" id=\"batch<%id%>\" name=\"batch[<%id%>]\" value=\"<%memberid%>\" />\n"
\r
238 . "<label for=\"batch<%id%>\">\n"
\r
239 . "<a href=\"mailto:<%mailaddress%>\" tabindex=\"<%tabindex%>\"><%name%></a>\n"
\r
240 . "</label>\n</td>\n"
\r
241 . "<td><%realname%></td>\n"
\r
242 . "<td><a href=\"<%url%>\" tabindex=\"<%tabindex%>\"><%url%></a></td>\n"
\r
243 . "<td><%admin%></td>\n"
\r
244 . "<td><%login%></td>\n"
\r
245 . "<td><a href=\"index.php?action=memberedit&memberid=<%memberid%>\" tabindex=\"<%tabindex%>\"><%editbtn%></a></td>\n"
\r
246 . "<td><a href=\"index.php?action=memberdelete&memberid=<%memberid%>\" tabindex=\"<%tabindex%>\"><%deletebtn%></a></td>\n";
\r
250 $template = $templates['SHOWLIST_LISTPLUG_TABLE_MEMBLIST_BODY'];
\r
253 'id' => listplug_nextBatchId(),
\r
254 'memberid' => $current['mnumber'],
\r
255 'mailaddress' => Entity::hsc($current['memail']),
\r
256 'tabindex' => $vars['tabindex'],
\r
257 'name' => Entity::hsc($current['mname']),
\r
258 'realname' => Entity::hsc($current['mrealname']),
\r
259 'url' => Entity::hsc($current['murl']),
\r
260 'admin' => $current['madmin'] ? _YES : _NO,
\r
261 'login' => $current['mcanlogin'] ? _YES : _NO,
\r
262 'editbtn' => _LISTS_EDIT,
\r
263 'deletebtn' => _LISTS_DELETE,
\r
267 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_MEMBLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_MEMBLIST_FOOT']) )
\r
273 $template = $templates['SHOWLIST_LISTPLUG_TABLE_MEMBLIST_FOOT'];
\r
278 return Template::fill($template, $data);
\r
281 function listplug_table_teamlist($vars, $type, $template_name = '')
\r
285 $templates = array();
\r
286 if ( !empty($template_name) )
\r
288 $templates =& $manager->getTemplate($template_name);
\r
294 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_TEAMLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_TEAMLIST_HEAD']) )
\r
296 $template = "<th><%colmembername%></th>\n"
\r
297 . "<th><%colmemberrname%></th>\n"
\r
298 . "<th><%colteamadmin%><%helplink(teamadmin)%></th>\n"
\r
299 . "<th colspan=\"2\"><%colactions%></th>\n";
\r
303 $template = $templates['SHOWLIST_LISTPLUG_TABLE_TEAMLIST_HEAD'];
\r
306 'colmembername' => _LIST_MEMBER_NAME,
\r
307 'colmemberrname' => _LIST_MEMBER_RNAME,
\r
308 'colteamadmin' => _LIST_TEAM_ADMIN,
\r
309 'colactions' => _LISTS_ACTIONS,
\r
313 $current = $vars['current'];
\r
314 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_TEAMLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_TEAMLIST_BODY']) )
\r
316 $template = "<td>\n"
\r
317 . "<input type=\"checkbox\" id=\"batch<%id%>\" name=\"batch[<%id%>]\" value=\"<%memberid%>\" />\n"
\r
318 . "<label for=\"batch<%id%>\">\n"
\r
319 . "<a href=\"mailto:<%mailaddress%>\" tabindex=\"<%tabindex%>\"><%name%></a>\n"
\r
320 . "</label>\n</td>\n"
\r
321 . "<td><%realname%></td>\n"
\r
322 . "<td><%admin%></td>\n"
\r
323 . "<td><a href=\"index.php?action=teamdelete&memberid=<%memberid%>&blogid=<%blogid%>\" tabindex=\"<%tabindex%>\"><%deletebtn%></a></td>\n"
\r
324 . "<td><a href=\"<%chadminurl%>\" tabindex=\"<%tabindex%>\"><%chadminbtn%></a></td>\n";
\r
328 $template = $templates['SHOWLIST_LISTPLUG_TABLE_TEAMLIST_BODY'];
\r
330 $url = 'index.php?action=teamchangeadmin&memberid=' . intval($current['tmember']) . '&blogid=' . intval($current['tblog']);
\r
331 $url = $manager->addTicketToUrl($url);
\r
333 'id' => listplug_nextBatchId(),
\r
334 'memberid' => $current['tmember'],
\r
335 'mailaddress' => Entity::hsc($current['memail']),
\r
336 'tabindex' => $vars['tabindex'],
\r
337 'name' => Entity::hsc($current['mname']),
\r
338 'realname' => Entity::hsc($current['mrealname']),
\r
339 'admin' => ($current['tadmin'] ? _YES : _NO),
\r
340 'blogid' => $current['tblog'],
\r
341 'deletebtn' => '<%text(_LISTS_DELETE)%>',
\r
342 'chadminurl' => Entity::hsc($url),
\r
343 'chadminbtn' => '<%text(_LIST_TEAM_CHADMIN)%>'
\r
347 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_TEAMLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_TEAMLIST_FOOT']) )
\r
353 $template = $templates['SHOWLIST_LISTPLUG_TABLE_TEAMLIST_FOOT'];
\r
358 return Template::fill($template, $data);
\r
361 function listplug_table_pluginlist($vars, $type, $template_name = '')
\r
363 static $plugins = array();
\r
366 $templates = array();
\r
367 if ( !empty($template_name) )
\r
369 $templates =& $manager->getTemplate($template_name);
\r
375 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HEAD']) )
\r
377 $template = "<th><%colinfo%></th>\n"
\r
378 . "<th><%coldesc%></th>\n"
\r
379 . "<th colspan=\"2\"><%colactions%></th>\n";
\r
383 $template = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HEAD'];
\r
386 'colinfo' => _LISTS_INFO,
\r
387 'coldesc' => _LISTS_DESC,
\r
388 'colactions' => _LISTS_ACTIONS,
\r
392 $current = $vars['current'];
\r
394 $plug =& $manager->getPlugin($current['pfile']);
\r
397 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY']) )
\r
399 $template = "<td>\n"
\r
400 . "<strong><%plugname%></strong><br />\n"
\r
401 . "<%autherlabel%> <%plugauther%><br />\n"
\r
402 . "<%versionlabel%> <%plugversion%><br />\n"
\r
403 . "<%pluggeturl%><br />\n"
\r
406 . "<%desclabel%><br /><%plugdesc%>\n"
\r
407 . "<%eventlist%>\n"
\r
408 . "<%needupdate%>\n"
\r
409 . "<%dependlist%>\n"
\r
410 . "<%depreqlist%>\n"
\r
415 $template = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY'];
\r
418 'plugname' => Entity::hsc($plug->getName()),
\r
419 'autherlabel' => _LIST_PLUGS_AUTHOR,
\r
420 'plugauther' => Entity::hsc($plug->getAuthor()),
\r
421 'versionlabel' => _LIST_PLUGS_VER,
\r
422 'plugversion' => Entity::hsc($plug->getVersion()),
\r
423 'tabindex' => $vars['tabindex'],
\r
424 'desclabel' => _LIST_PLUGS_DESC,
\r
425 'plugdesc' => Entity::hen($plug->getDescription()),
\r
427 if ( $plug->getURL() )
\r
429 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGLIST_GURL', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_GURL']) )
\r
431 $subTpl = "<a href=\"<%plugurl%>\" tabindex=\"<%tabindex%>\"><%plugsite%></a>";
\r
435 $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_GURL'];
\r
438 'plugurl' => Entity::hsc($plug->getURL()),
\r
439 'tabindex' => $vars['tabindex'],
\r
440 'plugsite' => _LIST_PLUGS_SITE,
\r
442 $data['pluggeturl'] = Template::fill($subTpl, $subData);
\r
446 $data['pluggeturl'] = '';
\r
448 if ( count($plug->getEventList()) > 0 )
\r
450 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGEVENTLIST', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGEVENTLIST']) )
\r
452 $subTpl = "<br /><br /><%evntlstlbl%><br /><%eventlist%>";
\r
456 $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGEVENTLIST'];
\r
459 'evntlstlbl' => _LIST_PLUGS_SUBS,
\r
460 'eventlist' => Entity::hsc(implode(', ', $plug->getEventList())),
\r
462 $data['eventlist'] = Template::fill($subTpl, $subData);
\r
466 $data['eventlist'] = '';
\r
468 if ( !$plug->subscribtionListIsUptodate() )
\r
470 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGNEDUPDATE', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGNEDUPDATE']) )
\r
472 $subTpl = "<br /><br /><strong><%updatealert%></strong>";
\r
476 $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGNEDUPDATE'];
\r
479 'updatealert' => _LIST_PLUG_SUBS_NEEDUPDATE,
\r
481 $data['needupdate'] = Template::fill($subTpl, $subData);
\r
485 $data['needupdate'] = '';
\r
487 if ( count($plug->getPluginDep() ) > 0)
\r
489 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPEND', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPEND']) )
\r
491 $subTpl = "<br /><br /><%deplistlbl%><br /><%dependlist%>";
\r
495 $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPEND'];
\r
498 'deplistlbl' => _LIST_PLUGS_DEP,
\r
499 'dependlist' => Entity::hsc(implode(', ', $plug->getPluginDep())),
\r
501 $data['dependlist'] = Template::fill($subTpl, $subData);
\r
505 $data['dependlist'] = '';
\r
507 /* check dependency */
\r
508 if ( empty($plugins) )
\r
510 $plugins = DB::getResult('SELECT pfile FROM ' . sql_table('plugin'));
\r
513 foreach ( $plugins as $plugin )
\r
515 $preq =& $manager->getPlugin($plugin['pfile']);
\r
518 $depList = $preq->getPluginDep();
\r
519 foreach ( $depList as $depName )
\r
521 if ( $current['pfile'] == $depName )
\r
523 $req[] = $plugin['pfile'];
\r
529 if ( count($req) > 0 )
\r
531 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPREQ', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPREQ']) )
\r
533 $subTpl = "<br /><br /><%deprlstlbl%><br /><%depreqlist%>";
\r
537 $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPREQ'];
\r
540 'deprlstlbl' => _LIST_PLUGS_DEPREQ,
\r
541 'depreqlist' => Entity::hsc(implode(', ', $req)),
\r
543 $data['depreqlist'] = Template::fill($subTpl, $subData);
\r
547 $data['depreqlist'] = '';
\r
552 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGLISTFALSE', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLISTFALSE']) )
\r
554 $template = "<td colspan=\"2\"><%noplugalert%></td>\n";
\r
558 $template = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLISTFALSE'];
\r
561 'noplugalert' => sprintf(_PLUGINFILE_COULDNT_BELOADED, Entity::hsc($current['pfile'])),
\r
564 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ACTN', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ACTN']) )
\r
566 $template .= "<td>\n"
\r
567 . "<a href=\"<%actionupurl%>\" tabindex=\"<%tabindex%>\"><%actionuptxt%></a><br />\n"
\r
568 . "<a href=\"<%actiondownurl%>\" tabindex=\"<%tabindex%>\"><%actiondowntxt%></a><br />\n"
\r
569 . "<a href=\"<%actuninsturl%>\" tabindex=\"<%tabindex%>\"><%actuninsttxt%></a><br />"
\r
570 . "<%plugadminurl%>\n"
\r
571 . "<%plughelpurl%>\n"
\r
572 . "<%plugoptsetting%>\n"
\r
577 $template .= $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ACTN'];
\r
580 $baseUrl = 'index.php?plugid=' . $current['pid'] . '&action=';
\r
581 $upUrl = $manager->addTicketToUrl($baseUrl . 'pluginup');
\r
582 $downUrl = $manager->addTicketToUrl($baseUrl . 'plugindown');
\r
584 $data['actionuptxt'] = _LIST_PLUGS_UP;
\r
585 $data['actionupurl'] = Entity::hsc($upUrl);
\r
586 $data['actiondowntxt'] = _LIST_PLUGS_DOWN;
\r
587 $data['actiondownurl'] = Entity::hsc($downUrl);
\r
588 $data['actuninsttxt'] = _LIST_PLUGS_UNINSTALL;
\r
589 $data['actuninsturl'] = 'index.php?action=plugindelete&plugid=' . $current['pid'];
\r
591 if ( $plug && ($plug->hasAdminArea() > 0) )
\r
593 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ADMN', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ADMN']) )
\r
595 $subTpl = "<a href=\"<%actadminurl%>\" tabindex=\"<%tabindex%>\"><%actadmintxt%></a><br />\n";
\r
599 $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ADMN'];
\r
602 'actadminurl' => Entity::hsc($plug->getAdminURL()),
\r
603 'tabindex' => $vars['tabindex'],
\r
604 'actadmintxt' => _LIST_PLUGS_ADMIN,
\r
606 $data['plugadminurl'] = Template::fill($subTpl, $subData);
\r
610 $data['plugadminurl'] = '';
\r
612 if ( $plug && ($plug->supportsFeature('HelpPage') > 0) )
\r
614 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HELP', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HELP']) )
\r
616 $subTpl = "<a href=\"<%acthelpurl%>\" tabindex=\"<%tabindex%>\"><%acthelptxt%></a><br />\n";
\r
620 $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HELP'];
\r
623 'acthelpurl' => 'index.php?action=pluginhelp&plugid=' . $current['pid'],
\r
624 'tabindex' => $vars['tabindex'],
\r
625 'acthelptxt' => _LIST_PLUGS_HELP,
\r
627 $data['plughelpurl'] = Template::fill($subTpl, $subData);
\r
631 $data['plughelpurl'] = '';
\r
633 $optQuery = 'SELECT '
\r
634 . ' COUNT(*) AS result '
\r
636 . sql_table('plugin_option_desc') . ' '
\r
638 . ' ocontext = "global" '
\r
640 $pOptions = DB::getValue(sprintf($optQuery, $current['pid']));
\r
641 if ( $pOptions > 0 )
\r
643 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGOPTSETURL', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGOPTSETURL']) )
\r
645 $subTpl = "<a href=\"<%actoptionurl%>\" tabindex=\"<%tabindex%>\"><%actoptiontxt%></a>\n";
\r
649 $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGOPTSETURL'];
\r
652 'actoptionurl' => 'index.php?action=pluginoptions&plugid=' . $current['pid'],
\r
653 'tabindex' => $vars['tabindex'],
\r
654 'actoptiontxt' => _LIST_PLUGS_OPTIONS,
\r
656 $data['plugoptsetting'] = Template::fill($subTpl, $subData);
\r
660 $data['plugoptsetting'] = '';
\r
664 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_FOOT']) )
\r
670 $template = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_FOOT'];
\r
675 return Template::fill($template, $data);
\r
678 function listplug_table_plugoptionlist($vars, $type, $template_name = '')
\r
682 $templates = array();
\r
683 if ( !empty($template_name) )
\r
685 $templates =& $manager->getTemplate($template_name);
\r
691 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_POPTLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_POPTLIST_HEAD']) )
\r
693 $template = "<th><%colinfo%></th>\n"
\r
694 . "<th><%colvalue%></th>\n";
\r
698 $template = $templates['SHOWLIST_LISTPLUG_TABLE_POPTLIST_HEAD'];
\r
701 'colinfo' => _LISTS_INFO,
\r
702 'colvalue' => _LISTS_VALUE,
\r
706 $current = $vars['current'];
\r
707 $template = listplug_plugOptionRow($current, $template_name);
\r
711 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_POPTLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_POPTLIST_FOOT']) )
\r
713 $template = "<tr>\n"
\r
714 . "<th colspan=\"2\"><%savetext%></th>\n"
\r
717 . "<td><%savetext%></td>\n"
\r
718 . "<td><input type=\"submit\" value=\"<%savetext%>\" /></td>\n"
\r
723 $template = $templates['SHOWLIST_LISTPLUG_TABLE_POPTLIST_FOOT'];
\r
726 'savetext' => _PLUGS_SAVE,
\r
731 return Template::fill($template, $data);
\r
734 function listplug_plugOptionRow($current, $template_name = '')
\r
738 $templates = array();
\r
739 if ( !empty($template_name) )
\r
741 $templates =& $manager->getTemplate($template_name);
\r
744 $varname = "plugoption[{$current['oid']}][{$current['contextid']}]";
\r
746 // retreive the optionmeta
\r
747 $meta = NucleusPlugin::getOptionMeta($current['typeinfo']);
\r
749 // only if it is not a hidden option write the controls to the page
\r
750 if ( in_array('access', $meta) && $meta['access'] == 'hidden' )
\r
756 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_POPTLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_POPTLIST_BODY']) )
\r
758 $template = "<td><%description%></td>\n"
\r
763 $template = $templates['SHOWLIST_LISTPLUG_TABLE_POPTLIST_BODY'];
\r
768 switch($current['type'])
\r
771 $template .= listplug_input_yesno($varname, $current['value'], 0, 'yes', 'no', _YES, _NO, 0, $template_name, 1);
\r
774 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OPWORD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OPWORD']) )
\r
776 $template .= "<input type=\"password\" size=\"40\" maxlength=\"128\" name=\"<%varname%>\" value=\"<%value%>\" />\n";
\r
780 $template .= $templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OPWORD'];
\r
783 'varname' => Entity::hsc($varname),
\r
784 'value' => Entity::hsc($current['value']),
\r
788 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEP', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEP']) )
\r
790 $template .= "<select name=\"<%varname%>\">\n";
\r
794 $template .= $templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEP'];
\r
796 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEO', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEO']) )
\r
798 $subTpl = "<option value=\"<%value%>\"<%selected%>><%optname%></option>\n";
\r
802 $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEO'];
\r
804 $options = NucleusPlugin::getOptionSelectValues($current['typeinfo']);
\r
805 $options = preg_split('#\|#', $options);
\r
807 for ( $i=0; $i<(count($options)-1); $i+=2 )
\r
809 $name = $options[$i];
\r
810 $value = $options[$i+1];
\r
811 if ( defined($name) )
\r
813 $name = constant($name);
\r
817 'optname' => Entity::hsc($name),
\r
818 'value' => Entity::hsc($value)
\r
820 if ($value != $current['value'])
\r
822 $subData['selected'] = '';
\r
826 $subData['selected'] = ' selected="selected"';
\r
828 $template .= Template::fill($subTpl, $subData);
\r
830 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEC', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEC']) )
\r
832 $template .= "</select>\n";
\r
836 $template .= $templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEC'];
\r
838 $data['varname'] = Entity::hsc($varname);
\r
841 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OTAREA', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OTAREA']) )
\r
843 $template .= "<textarea class=\"pluginoption\" cols=\"30\" rows=\"5\" name=\"<%varname%>\"<%readonly%>><%value%></textarea>\n";
\r
847 $template .= $templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OTAREA'];
\r
850 'varname' => Entity::hsc($varname),
\r
851 'value' => Entity::hsc($current['value'])
\r
853 if ( !array_key_exists('access', $current) || $current['access'] != 'readonly')
\r
855 $data['readonly'] = '';
\r
859 $data['readonly'] = ' readonly="readonly"';
\r
864 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OITEXT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OITEXT']) )
\r
866 $template .= "<input type=\"text\" size=\"40\" maxlength=\"128\" name=\"<%varname%>\" value=\"<%value%>\"<%datatype%><%readonly%> />\n";
\r
870 $template .= $templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OITEXT'];
\r
873 'varname' => Entity::hsc($varname),
\r
874 'value' => Entity::hsc($current['value'])
\r
876 if ( !array_key_exists('datatype', $current) || $current['datatype'] != 'numerical')
\r
878 $data['datatype'] = '';
\r
882 $data['datatype'] = ' onkeyup="checkNumeric(this)" onblur="checkNumeric(this)"';
\r
884 if ( !array_key_exists('access', $current) || $current['access'] != 'readonly')
\r
886 $data['readonly'] = '';
\r
890 $data['readonly'] = ' readonly="readonly"';
\r
894 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGOPTN_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGOPTN_FOOT']) )
\r
896 $template .= "<%extra%></td>\n";
\r
900 $template .= $templates['SHOWLIST_LISTPLUG_TABLE_PLUGOPTN_FOOT'];
\r
903 if ( !array_key_exists('extra', $current) )
\r
905 $data['extra'] = '';
\r
909 $data['extra'] = Entity::hsc($current['extra']);
\r
912 if ( !array_key_exists('description', $current) )
\r
914 $data['description'] = Entity::hsc($current['name']);
\r
916 else if ( !defined($current['description']) )
\r
918 $data['description'] = Entity::hsc($current['description']);
\r
922 $data['description'] = Entity::hsc(constant($current['description']));
\r
925 return Template::fill($template, $data, 1);
\r
929 * listplug_templateEditRow()
\r
931 * @param array $content content of target template
\r
932 * @param string $desc description of target template
\r
933 * @param string $name name of target template
\r
934 * @param string $help help text
\r
935 * @param integer $tabindex a number for tab index
\r
936 * @param boolean $big large or small textarea
\r
937 * @param array $template_name name of template for filling
\r
940 function listplug_templateEditRow($content, $desc, $name, $help = '', $tabindex = 0, $big = 0, $template_name = '')
\r
949 $templates = array();
\r
950 if ( $template_name )
\r
952 $templates =& $manager->getTemplate($template_name);
\r
956 'description' => $desc,
\r
957 'help' => empty($help) ? '' : helpHtml('template' . $help),
\r
958 'count' => $count++,
\r
960 'tabindex' => $tabindex,
\r
961 'rows' => $big ? 10 : 5,
\r
967 if ( !array_key_exists('TEMPLATE_EDIT_ROW_HEAD', $templates) || empty($tmplt['TEMPLATE_EDIT_ROW_HEAD']) )
\r
969 $template = "</tr>"
\r
971 . "<td><%description%><%help%></td>\n"
\r
972 . "<td id=\"td<%count%>\">\n"
\r
973 . "<textarea class=\"templateedit\" name=\"<%name%>\" tabindex=\"<%tabindex%>\" cols=\"50\" rows=\"<%rows%>\" id=\"textarea<%count%>\">";
\r
977 $template = $tmplt['TEMPLATE_EDIT_ROW_HEAD'];
\r
979 $message .= TEMPLATE::fill($template, $data);
\r
982 $message .= ENTITY::hsc($content);
\r
985 if ( !array_key_exists('TEMPLATE_EDIT_ROW_TAIL', $templates) || empty($tmplt['TEMPLATE_EDIT_ROW_TAIL']) )
\r
987 $template = "</textarea>\n"
\r
992 $template = $tmplt['TEMPLATE_EDIT_ROW_TAIL'];
\r
994 $message .= TEMPLATE::fill($template, $data);
\r
999 function listplug_table_itemlist($vars, $type, $template_name = '')
\r
1005 $templates = array();
\r
1006 if ( !empty($template_name) )
\r
1008 $templates =& $manager->getTemplate($template_name);
\r
1014 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_ITEMLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_ITEMLIST_HEAD']) )
\r
1016 $template = "<th><%colinfo%></th>\n"
\r
1017 . "<th><%colcontent%></th>\n"
\r
1018 . "<th style=\"white-space:nowrap\"><%colaction%></th>\n";
\r
1022 $template = $templates['SHOWLIST_LISTPLUG_TABLE_ITEMLIST_HEAD'];
\r
1025 'colinfo' => _LIST_ITEM_INFO,
\r
1026 'colcontent' => _LIST_ITEM_CONTENT,
\r
1027 'colaction' => _LISTS_ACTIONS
\r
1031 $current = $vars['current'];
\r
1032 // string -> unix timestamp
\r
1033 $current['itime'] = strtotime($current['itime']);
\r
1034 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_ITEMLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_ITEMLIST_BODY']) )
\r
1036 $template = "<td<%cssclass%>>\n"
\r
1037 . "<%bshortlabel%> <%bshortnameval%><br />\n"
\r
1038 . "<%categorylabel%> <%categorynameval%><br />\n"
\r
1039 . "<%authorlabel%> <%authornameval%><br />\n"
\r
1040 . "<%itemdatelabel%> <%itemdateval%><br />\n"
\r
1041 . "<%itemtimelabel%> <%itemtimeval%>\n"
\r
1043 . "<td<%cssclass%>>\n"
\r
1044 . "<input type=\"checkbox\" id=\"batch<%batchid%>\" name=\"batch[<%batchid%>]\" value=\"<%itemid%>\" />\n"
\r
1045 . "<label for=\"batch<%batchid%>\"><b><%itemtitle%></b></label><br />\n"
\r
1046 . "<%itembody%>\n"
\r
1048 . "<td<%cssclass%>>\n"
\r
1049 . "<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
1057 $template = $templates['SHOWLIST_LISTPLUG_TABLE_ITEMLIST_BODY'];
\r
1061 if ( $current['idraft'] == 1 )
\r
1063 $cssclass = ' class="draft"';
\r
1066 // (can't use offset time since offsets might vary between blogs)
\r
1067 if ( $current['itime'] > $vars['now'] )
\r
1069 $cssclass = ' class="future"';
\r
1071 $body = strip_tags($current['ibody']);
\r
1073 'cssclass' => $cssclass,
\r
1074 'bshortlabel' => _LIST_ITEM_BLOG,
\r
1075 'bshortnameval' => Entity::hsc($current['bshortname']),
\r
1076 'categorylabel' => _LIST_ITEM_CAT,
\r
1077 'categorynameval' => Entity::hsc($current['cname']),
\r
1078 'authorlabel' => _LIST_ITEM_AUTHOR,
\r
1079 'authornameval' => Entity::hsc($current['mname']),
\r
1080 'itemdatelabel' => _LIST_ITEM_DATE,
\r
1081 'itemdateval' => date("Y-m-d",$current['itime']),
\r
1082 'itemdatelabel' => _LIST_ITEM_TIME,
\r
1083 'itemdateval' => date("H:i",$current['itime']),
\r
1084 'batchid' => listplug_nextBatchId(),
\r
1085 'itemid' => $current['inumber'],
\r
1086 'itemtitle' => Entity::hsc(strip_tags($current['ititle'])),
\r
1087 'itembody' => Entity::hsc(Entity::shorten($body, 300, '...')),
\r
1088 'editbtn' => _LISTS_EDIT,
\r
1089 'movebtn' => _LISTS_MOVE,
\r
1090 'delbtn' => _LISTS_DELETE,
\r
1092 // evaluate amount of comments for the item
\r
1093 $comment = new Comments($current['inumber']);
\r
1094 $camount = $comment->amountComments();
\r
1095 if ( $camount > 0 )
\r
1097 $data['camount'] = "<a href=\"index.php?action=itemcommentlist&itemid={$current['inumber']}\">(" . sprintf(_LIST_ITEM_COMMENTS, $comment->amountComments()) . ")</a><br />\n";
\r
1101 $data['camount'] = _LIST_ITEM_NOCONTENT . "<br />\n";
\r
1105 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_ITEMLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_ITEMLIST_FOOT']) )
\r
1111 $template = $templates['SHOWLIST_LISTPLUG_TABLE_ITEMLIST_FOOT'];
\r
1116 return Template::fill($template, $data);
\r
1119 // for batch operations: generates the index numbers for checkboxes
\r
1120 function listplug_nextBatchId()
\r
1126 function listplug_table_commentlist($vars, $type, $template_name = '')
\r
1130 $templates = array();
\r
1131 if ( !empty($template_name) )
\r
1133 $templates =& $manager->getTemplate($template_name);
\r
1139 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_CMNTLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_HEAD']) )
\r
1141 $template = "<th><%colinfo%></th>\n"
\r
1142 . "<th><%colcontent%></th>\n"
\r
1143 . "<th colspan=\"3\"><%colaction%></th>\n";
\r
1147 $template = $templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_HEAD'];
\r
1150 'colinfo' => _LISTS_INFO,
\r
1151 'colcontent' => _LIST_COMMENT,
\r
1152 'colaction' => _LISTS_ACTIONS
\r
1156 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_CMNTLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_BODY']) )
\r
1158 $template = "<td><%commentdate%><br /><%commentator%><br /><%commentsite%><br /><%commentmail%><br /></td>\n"
\r
1160 . "<input type=\"checkbox\" id=\"batch<%batchid%>\" name=\"batch[<%batchid%>]\" value=\"<%commentid%>\" />"
\r
1161 . "<label for=\"batch<%batchid%>\"><%commentbody%></label>\n"
\r
1163 . "<td style=\"white-space:nowrap\">\n"
\r
1164 . "<a href=\"index.php?action=commentedit&commentid=<%commentid%>\"><%editbtn%></a>\n"
\r
1166 . "<td style=\"white-space:nowrap\">\n"
\r
1167 . "<a href=\"index.php?action=commentdelete&commentid=<%commentid%>\"><%delbtn%></a>\n"
\r
1169 . "<%addbanlist%>";
\r
1173 $template = $templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_BODY'];
\r
1175 $current = $vars['current'];
\r
1176 $body = strip_tags($current['cbody']);
\r
1178 'commentdate' => date("Y-m-d@H:i", strtotime($current['ctime'])),
\r
1179 'batchid' => listplug_nextBatchId(),
\r
1180 'commentid' => $current['cnumber'],
\r
1181 'commentbody' => Entity::hsc(Entity::shorten($current['cbody'], 300, '...')),
\r
1182 'editbtn' => _LISTS_EDIT,
\r
1183 'delbtn' => _LISTS_DELETE,
\r
1185 if ( isset($current['mname']) )
\r
1187 $data['commentator'] = Entity::hsc($current['mname']) . ' ' . _LIST_COMMENTS_MEMBER;
\r
1191 $data['commentator'] = Entity::hsc($current['cuser']);
\r
1193 if ( isset($current['cmail']) && $current['cmail'] )
\r
1195 $data['commentsite'] = Entity::hsc($current['cmail']);
\r
1199 $data['commentsite'] = '';
\r
1201 if ( isset($current['cemail']) && $current['cemail'] )
\r
1203 $data['commentmail'] = Entity::hsc($current['cemail']);
\r
1207 $data['commentmail'] = '';
\r
1209 if ( $vars['canAddBan'] )
\r
1211 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_CMNTLIST_ABAN', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_ABAN']) )
\r
1213 $subTpl = "<td style=\"white-space:nowrap\">"
\r
1214 . "<a href=\"index.php?action=banlistnewfromitem&itemid=<%itemid%>&ip=<%banip%>\" title=\"<%banhost%>\"><%banbtn%></a>"
\r
1219 $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_ABAN'];
\r
1222 'itemid' => $current['citem'],
\r
1223 'banip' => Entity::hsc($current['cip']),
\r
1224 'banbtn' => _LIST_COMMENT_BANIP,
\r
1226 $data['addbanlist'] = Template::fill($subTpl, $subData);
\r
1230 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_CMNTLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_FOOT']) )
\r
1236 $template = $templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_FOOT'];
\r
1241 return Template::fill($template, $data);
\r
1244 function listplug_table_bloglist($vars, $type, $template_name = '')
\r
1248 $templates = array();
\r
1249 if ( !empty($template_name) )
\r
1251 $templates =& $manager->getTemplate($template_name);
\r
1257 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_BLOGLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_BLOGLIST_HEAD']) )
\r
1259 $template = "<th><%blognames%></th>\n"
\r
1260 . "<th colspan=\"7\"><%actionshead%></th>\n";
\r
1264 $template = $templates['SHOWLIST_LISTPLUG_TABLE_BLOGLIST_HEAD'];
\r
1267 'blognames' => _NAME,
\r
1268 'actionshead' => _LISTS_ACTIONS,
\r
1272 $current = $vars['current'];
\r
1273 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_BLOGLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_BLOGLIST_BODY']) )
\r
1275 $template = "<td title=\"blogid:<%blogid%> shortname:<%shortname%>\">\n"
\r
1276 . "<a href=\"<%blogurl%>\"><img src=\"images/globe.gif\" width=\"13\" height=\"13\" alt=\"<%iconalt%>\" /></a><%blogname%></td>\n"
\r
1277 . "<td><a href=\"index.php?action=createitem&blogid=<%blogid%>\" title=\"<%ttaddtext%>\"><%addtext%></a></td>\n"
\r
1278 . "<td><a href=\"index.php?action=itemlist&blogid=<%blogid%>\" title=\"<%ttedittext%>\"><%edittext%></a></td>\n"
\r
1279 . "<td><a href=\"index.php?action=blogcommentlist&blogid=<%blogid%>\" title=\"<%ttcommenttext%>\"><%commenttext%></a></td>\n"
\r
1280 . "<td><a href=\"index.php?action=bookmarklet&blogid=<%blogid%>\" title=\"<%ttbmlettext%>\"><%bmlettext%></a></td>\n";
\r
1284 $template = $templates['SHOWLIST_LISTPLUG_TABLE_BLOGLIST_BODY'];
\r
1287 'blogid' => $current['bnumber'],
\r
1288 'shortname' => Entity::hsc($current['bshortname']),
\r
1289 'blogurl' => $current['burl'],
\r
1290 'blogname' => Entity::hsc($current['bname']),
\r
1291 'ttaddtext' => _BLOGLIST_TT_ADD,
\r
1292 'addtext' => _BLOGLIST_ADD,
\r
1293 'ttedittext' => _BLOGLIST_TT_EDIT,
\r
1294 'edittext' => _BLOGLIST_EDIT,
\r
1295 'ttcommenttext' => _BLOGLIST_TT_COMMENTS,
\r
1296 'commenttext' => _BLOGLIST_COMMENTS,
\r
1297 'ttbmlettext' => _BLOGLIST_TT_BMLET,
\r
1298 'bmlettext' => _BLOGLIST_BMLET,
\r
1300 if ( $current['tadmin'] == 1 )
\r
1302 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_BLIST_BD_TADM', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_BLIST_BD_TADM']) )
\r
1304 $template .= "<td><a href=\"index.php?action=blogsettings&blogid=<%blogid%>\" title=\"<%ttsettingtext%>\"><%settingtext%></a></td>\n"
\r
1305 . "<td><a href=\"index.php?action=banlist&blogid=<%blogid%>\" title=\"<%ttbanstext%>\"><%banstext%></a></td>\n";
\r
1309 $template .= $templates['SHOWLIST_LISTPLUG_TABLE_BLIST_BD_TADM'];
\r
1311 $data['ttsettingtext'] = _BLOGLIST_TT_SETTINGS;
\r
1312 $data['settingtext'] = _BLOGLIST_SETTINGS;
\r
1313 $data['ttbanstext'] = _BLOGLIST_TT_BANS;
\r
1314 $data['banstext'] = _BLOGLIST_BANS;
\r
1317 if ( $vars['superadmin'] )
\r
1319 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_BLIST_BD_SADM', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_BLIST_BD_TADM']) )
\r
1321 $template .= "<td><a href=\"index.php?action=deleteblog&blogid=<%blogid%>\" title=\"<%ttdeletetext%>\"><%deletetext%></a></td>\n";
\r
1325 $template .= $templates['SHOWLIST_LISTPLUG_TABLE_BLIST_BD_SADM'];
\r
1327 $data['ttdeletetext'] = _BLOGLIST_TT_DELETE;
\r
1328 $data['deletetext'] = _BLOGLIST_DELETE;
\r
1332 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_BLOGLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_BLOGLIST_FOOT']) )
\r
1338 $template = $templates['SHOWLIST_LISTPLUG_TABLE_BLOGLIST_FOOT'];
\r
1343 return Template::fill($template, $data);
\r
1346 function listplug_table_shortblognames($vars, $type, $template_name = '')
\r
1350 $templates = array();
\r
1351 if ( !empty($template_name) )
\r
1353 $templates =& $manager->getTemplate($template_name);
\r
1359 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_HEAD']) )
\r
1361 $template = "<th><%colshortname%></th>\n"
\r
1362 . "<th><%colblogname%></th>\n";
\r
1366 $template = $templates['SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_HEAD'];
\r
1369 'colshortname' => _EBLOG_SHORTNAME,
\r
1370 'colblogname' => _EBLOG_NAME,
\r
1374 $current = $vars['current'];
\r
1375 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_BODY']) )
\r
1377 $template = "<td><%bshortname%></td>\n"
\r
1378 . "<td><%blogname%></td>\n";
\r
1382 $template = $templates['SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_BODY'];
\r
1385 'bshortname' => Entity::hsc($current['bshortname']),
\r
1386 'blogname' => Entity::hsc($current['bname']),
\r
1390 $current = $vars['current'];
\r
1391 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_FOOT']) )
\r
1397 $template = $templates['SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_FOOT'];
\r
1402 return Template::fill($template, $data);
\r
1405 function listplug_table_shortnames($vars, $type, $template_name = '')
\r
1409 $templates = array();
\r
1410 if ( !empty($template_name) )
\r
1412 $templates =& $manager->getTemplate($template_name);
\r
1418 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_SHORTNAM_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_SHORTNAM_HEAD']) )
\r
1420 $template = "<th><%colname%></th>\n"
\r
1421 . "<th><%coldesc%></th>\n";
\r
1425 $template = $templates['SHOWLIST_LISTPLUG_TABLE_SHORTNAM_HEAD'];
\r
1428 'colname' => _NAME,
\r
1429 'coldesc' => _LISTS_DESC,
\r
1433 $current = $vars['current'];
\r
1434 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_SHORTNAM_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_SHORTNAM_BODY']) )
\r
1436 $template = "<td><%name%></td>\n"
\r
1437 . "<td><%desc%></td>\n";
\r
1441 $template = $templates['SHOWLIST_LISTPLUG_TABLE_SHORTNAM_BODY'];
\r
1444 'name' => Entity::hsc($current['name']),
\r
1445 'desc' => Entity::hsc($current['description']),
\r
1449 $current = $vars['current'];
\r
1450 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_SHORTNAM_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_SHORTNAM_FOOT']) )
\r
1456 $template = $templates['SHOWLIST_LISTPLUG_TABLE_SHORTNAM_FOOT'];
\r
1461 return Template::fill($template, $data);
\r
1464 function listplug_table_categorylist($vars, $type, $template_name = '')
\r
1468 $templates = array();
\r
1469 if ( !empty($template_name) )
\r
1471 $templates =& $manager->getTemplate($template_name);
\r
1477 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_CATELIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_CATELIST_HEAD']) )
\r
1479 $template = "<th><%colname%></th>\n"
\r
1480 . "<th><%coldesc%></th>\n"
\r
1481 . "<th colspan=\"2\"><%colact%></th>\n";
\r
1485 $template = $templates['SHOWLIST_LISTPLUG_TABLE_CATELIST_HEAD'];
\r
1488 'colname' => _LISTS_NAME,
\r
1489 'coldesc' => _LISTS_DESC,
\r
1490 'colact' => _LISTS_ACTIONS,
\r
1494 $current = $vars['current'];
\r
1495 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_CATELIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_CATELIST_BODY']) )
\r
1497 $template = "<td>\n"
\r
1498 . "<input type=\"checkbox\" id=\"batch<%batchid%>\" name=\"batch[<%batchid%>]\" value=\"<%catid%>\" />\n"
\r
1499 . "<label for=\"batch<%batchid%>\"><%catname%></label>\n"
\r
1501 . "<td><%catdesc%></td>\n"
\r
1502 . "<td><a href=\"index.php?action=categoryedit&blogid=<%blogid%>&catid=<%catid%>\" tabindex=\"<%tabindex%>\"><%editbtn%></a></td>\n"
\r
1503 . "<td><a href=\"index.php?action=categorydelete&blogid=<%blogid%>&catid=<%catid%>\" tabindex=\"<%tabindex%>\"><%delbtn%></a></td>\n";
\r
1507 $template = $templates['SHOWLIST_LISTPLUG_TABLE_CATELIST_BODY'];
\r
1511 'batchid' => listplug_nextBatchId(),
\r
1512 'catid' => intval($current['catid']),
\r
1513 'catname' => Entity::hsc($current['cname']),
\r
1514 'catdesc' => Entity::hsc($current['cdesc']),
\r
1515 'blogid' => intval($current['cblog']),
\r
1516 'tabindex' => intval($vars['tabindex']),
\r
1517 'editbtn' => _LISTS_EDIT,
\r
1518 'delbtn' => _LISTS_DELETE,
\r
1522 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_CATELIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_CATELIST_FOOT']) )
\r
1528 $template = $templates['SHOWLIST_LISTPLUG_TABLE_CATELIST_FOOT'];
\r
1533 return Template::fill($template, $data);
\r
1536 function listplug_table_templatelist($vars, $type, $template_name = '')
\r
1538 global $manager, $CONF;
\r
1540 $templates = array();
\r
1541 if ( !empty($template_name) )
\r
1543 $templates =& $manager->getTemplate($template_name);
\r
1549 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_TPLTLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_HEAD']) )
\r
1551 $template = "<th><%colname%></th>\n"
\r
1552 . "<th><%coldesc%></th>\n"
\r
1553 . "<th colspan=\"3\"><%colact%></th>\n";
\r
1557 $template = $templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_HEAD'];
\r
1560 'colname' => _LISTS_NAME,
\r
1561 'coldesc' => _LISTS_DESC,
\r
1562 'colact' => _LISTS_ACTIONS,
\r
1566 $current = $vars['current'];
\r
1567 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_TPLTLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_BODY']) )
\r
1569 $template = "<td><%templatename%></td>\n"
\r
1570 . "<td><%templatedesc%></td>\n"
\r
1571 . "<td style=\"white-space:nowrap\">"
\r
1572 . "<a href=\"<%editurl%>\" tabindex=\"<%tabindex%>\"><%editbtn%></a>\n"
\r
1574 . "<td style=\"white-space:nowrap\">\n"
\r
1575 . "<a href=\"<%cloneurl%>\" tabindex=\"<%tabindex%>\"><%clonebtn%></a>\n"
\r
1577 . "<td style=\"white-space:nowrap\">\n"
\r
1578 . "<a href=\"<%deleteurl%>\" tabindex=\"<%tabindex%>\"><%delbtn%></a>\n"
\r
1583 $template = $templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_BODY'];
\r
1587 'templatename' => Entity::hsc($current['tdname']),
\r
1588 'templatedesc' => Entity::hsc($current['tddesc']),
\r
1589 'templateid' => (integer) $current['tdnumber'],
\r
1590 'tabindex' => (integer) $vars['tabindex'],
\r
1592 'clonebtn' => _LISTS_CLONE,
\r
1593 'cloneaction' => $vars['cloneaction'],
\r
1594 'cloneurl' => "{$CONF['AdminURL']}index.php?action={$vars['cloneaction']}&templateid={$current['tdnumber']}",
\r
1596 'delbtn' => _LISTS_DELETE,
\r
1597 'deleteaction' => $vars['deleteaction'],
\r
1598 'deleteurl' => "{$CONF['AdminURL']}index.php?action={$vars['deleteaction']}&templateid={$current['tdnumber']}",
\r
1600 'editbtn' => _LISTS_EDIT,
\r
1601 'editaction' => $vars['editaction'],
\r
1602 'editurl' => "{$CONF['AdminURL']}index.php?action={$vars['editaction']}&templateid={$current['tdnumber']}"
\r
1606 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_TPLTLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_FOOT']) )
\r
1612 $template = $templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_FOOT'];
\r
1617 return Template::fill($template, $data);
\r
1620 function listplug_table_skinlist($vars, $type, $template_name = '')
\r
1622 global $CONF, $DIR_SKINS, $manager;
\r
1624 $templates = array();
\r
1625 if ( !empty($template_name) )
\r
1627 $templates =& $manager->getTemplate($template_name);
\r
1633 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_SKINLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_HEAD']) )
\r
1635 $template = "<th><%colname%></th>\n"
\r
1636 . "<th><%coldesc%></th>\n"
\r
1637 . "<th colspan=\"3\"><%colact%></th>\n";
\r
1641 $template = $templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_HEAD'];
\r
1644 'colname' => _LISTS_NAME,
\r
1645 'coldesc' => _LISTS_DESC,
\r
1646 'colact' => _LISTS_ACTIONS,
\r
1650 $current = $vars['current'];
\r
1651 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_SKINLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_BODY']) )
\r
1653 $template = "<td><%skinname%><br /><br />\n"
\r
1654 . "<%skintypelabel%> <%skintype%><br />\n"
\r
1655 . "<%incmodelabel%> <%incmode%><br />\n"
\r
1656 . "<%incpreflabel%> <%incpref%><br />\n"
\r
1658 . "<%readme%></td>\n"
\r
1659 . "<td class=\"availableSkinTypes\"><%skindesc%><%skinparts%></td>\n"
\r
1660 . "<td style=\"white-space:nowrap\">"
\r
1661 . "<a href=\"index.php?action=skinedit&skinid=<%skinid%>\" tabindex=\"<%tabindex%>\"><%editbtn%></a>"
\r
1663 . "<td style=\"white-space:nowrap\">"
\r
1664 . "<a href=\"<%cloneurl%>\" tabindex=\"<%tabindex%>\"><%clonebtn%></a>"
\r
1666 . "<td style=\"white-space:nowrap\">"
\r
1667 . "<a href=\"index.php?action=skindelete&skinid=<%skinid%>\" tabindex=\"<%tabindex%>\"><%delbtn%></a>"
\r
1672 $template = $templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_BODY'];
\r
1676 'tabindex' => $vars['tabindex']++,
\r
1678 'skinid' => (integer) $current['sdnumber'],
\r
1679 'skindesc' => Entity::hsc($current['sddesc']),
\r
1681 'skintypelabel' => _LISTS_TYPE,
\r
1682 'skintype' => Entity::hsc($current['sdtype']),
\r
1684 'incmodelabel' => _LIST_SKINS_INCMODE,
\r
1685 'incmode' => ($current['sdincmode'] == 'skindir') ? _PARSER_INCMODE_SKINDIR : _PARSER_INCMODE_NORMAL,
\r
1687 'incpreflabel' => ($current['sdincpref']) ? _SKIN_INCLUDE_PREFIX : '',
\r
1688 'incpref' => ($current['sdincpref']) ? Entity::hsc($current['sdincpref']) : '',
\r
1690 'editbtn' => _LISTS_EDIT,
\r
1691 'editaction' => $vars['editaction'],
\r
1692 'editurl' => "{$CONF['AdminURL']}index.php?action={$vars['editaction']}&skinid={$current['sdnumber']}",
\r
1694 'clonebtn' => _LISTS_CLONE,
\r
1695 'cloneaction' => $vars['cloneaction'],
\r
1696 'cloneurl' => "{$CONF['AdminURL']}index.php?action={$vars['cloneaction']}&skinid={$current['sdnumber']}",
\r
1698 'delbtn' => _LISTS_DELETE,
\r
1699 'deleteaction' => $vars['deleteaction'],
\r
1700 'deleteurl' => "{$CONF['AdminURL']}index.php?action={$vars['deleteaction']}&skinid={$current['sdnumber']}"
\r
1703 if ( $current['sdnumber'] != $vars['default'] )
\r
1705 $data['skinname'] = Entity::hsc($current['sdname']);
\r
1709 $data['skinname'] = '<strong>' . Entity::hsc($current['sdname']) . '</strong>';
\r
1712 // add preview image when present
\r
1713 if ( $current['sdincpref'] && @file_exists("{$DIR_SKINS}{$current['sdincpref']}preview.png") )
\r
1715 $data['skinthumb'] = "<p>\n";
\r
1717 $alternatve_text = sprintf(_LIST_SKIN_PREVIEW, $current['sdname']);
\r
1718 $has_enlargement = @file_exists($DIR_SKINS . $current['sdincpref'] . 'preview-large.png');
\r
1719 if ( $has_enlargement )
\r
1721 $data['skinthumb'] .= '<a href="' . $CONF['SkinsURL'] . Entity::hsc($current['sdincpref']) . 'preview-large.png" title="' . _LIST_SKIN_PREVIEW_VIEWLARGER . "\">\n";
\r
1723 $data['skinthumb'] .= '<img class="skinpreview" src="' . $CONF['SkinsURL'] . Entity::hsc($current['sdincpref']) . 'preview.png" width="100" height="75" alt="' . $alternatve_text . "\" />\n";
\r
1724 if ( $has_enlargement )
\r
1726 $data['skinthumb'] .= "</a><br />\n";
\r
1729 if ( @file_exists("{$DIR_SKINS}{$current['sdincpref']}readme.html") )
\r
1731 $url = $CONF['SkinsURL'] . Entity::hsc($current['sdincpref']) . 'readme.html';
\r
1732 $title = sprintf(_LIST_SKIN_README, $current['sdname']);
\r
1733 $data['readme'] = "<a href=\"{$url}\" title=\"{$title}\">" . _LIST_SKIN_README_TXT . "</a>\n";
\r
1737 $data['readme'] ="";
\r
1740 $data['skinthumb'] .= "</p>\n";
\r
1743 $skin =& $manager->getSkin($current['sdnumber'], $vars['handler']);
\r
1744 $available_types = $skin->getAvailableTypes();
\r
1746 $data['skinparts'] = _LIST_SKINS_DEFINED
\r
1748 foreach ( $available_types as $type => $label )
\r
1750 if ( $label === FALSE )
\r
1752 $label = ucfirst($type);
\r
1753 $article = 'skinpartspecial';
\r
1757 $article = "skinpart{$type}";
\r
1759 $data['skinparts'] .= "<li>\n"
\r
1760 . helpHtml($article) . "\n"
\r
1761 . "<a href=\"{$CONF['AdminURL']}index.php?action={$vars['edittypeaction']}&skinid={$current['sdnumber']}&type={$type}\" tabindex=\"{$vars['tabindex']}\">"
\r
1762 . Entity::hsc($label)
\r
1766 $data['skinparts'] .= "</ul>\n";
\r
1769 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_SKINLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_FOOT']) )
\r
1775 $template = $templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_FOOT'];
\r
1780 return Template::fill($template, $data);
\r
1783 function listplug_table_draftlist($vars, $type, $template_name = '')
\r
1787 $templates = array();
\r
1788 if ( !empty($template_name) )
\r
1790 $templates =& $manager->getTemplate($template_name);
\r
1795 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_DRFTLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_DRFTLIST_HEAD']) )
\r
1797 $template = "<th><%colblog%></th>\n"
\r
1798 . "<th><%coldesc%></th>\n"
\r
1799 . "<th colspan=\"2\"><%colact%></th>\n";
\r
1803 $template = $templates['SHOWLIST_LISTPLUG_TABLE_DRFTLIST_HEAD'];
\r
1806 'colblog' => _LISTS_BLOG,
\r
1807 'coldesc' => _LISTS_TITLE,
\r
1808 'colact' => _LISTS_ACTIONS,
\r
1812 $current = $vars['current'];
\r
1813 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_DRFTLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_DRFTLIST_BODY']) )
\r
1815 $template = "<td><%bshortname%></td>\n"
\r
1816 . "<td><%ititle%></td>\n"
\r
1817 . "<td><a href=\"index.php?action=itemedit&itemid=<%itemid%>\"><%editbtn%></a></td>\n"
\r
1818 . "<td><a href=\"index.php?action=itemdelete&itemid=<%itemid%>\"><%delbtn%></a></td>\n";
\r
1822 $template = $templates['SHOWLIST_LISTPLUG_TABLE_DRFTLIST_BODY'];
\r
1825 'bshortname' => Entity::hsc($current['bshortname']),
\r
1826 'ititle' => Entity::hsc(strip_tags($current['ititle'])),
\r
1827 'itemid' => intval($current['inumber']),
\r
1828 'editbtn' => _LISTS_EDIT,
\r
1829 'delbtn' => _LISTS_DELETE,
\r
1833 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_DRFTLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_DRFTLIST_FOOT']) )
\r
1839 $template = $templates['SHOWLIST_LISTPLUG_TABLE_DRFTLIST_FOOT'];
\r
1844 return Template::fill($template, $data);
\r
1847 function listplug_table_otherdraftlist($vars, $type, $template_name = '')
\r
1851 $templates = array();
\r
1852 if ( !empty($template_name) )
\r
1854 $templates =& $manager->getTemplate($template_name);
\r
1860 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_HEAD']) )
\r
1862 $template = "<th><%colblog%></th>\n"
\r
1863 . "<th><%coldesc%></th>\n"
\r
1864 . "<th><%colautr%></th>\n"
\r
1865 . "<th colspan=\"2\"><%colact%></th>\n";
\r
1869 $template = $templates['SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_HEAD'];
\r
1872 'colblog' => _LISTS_BLOG,
\r
1873 'coldesc' => _LISTS_TITLE,
\r
1874 'colautr' => _LISTS_AUTHOR,
\r
1875 'colact' => _LISTS_ACTIONS,
\r
1879 $current = $vars['current'];
\r
1880 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_BODY']) )
\r
1882 $template = "<td><%bshortname%></td>\n"
\r
1883 . "<td><%ititle%></td>\n"
\r
1884 . "<td><%iauthor%></td>\n"
\r
1885 . "<td><a href=\"index.php?action=itemedit&itemid=<%itemid%>\"><%editbtn%></a></td>\n"
\r
1886 . "<td><a href=\"index.php?action=itemdelete&itemid=<%itemid%>\"><%delbtn%></a></td>\n";
\r
1890 $template = $templates['SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_BODY'];
\r
1893 'bshortname' => Entity::hsc($current['bshortname']),
\r
1894 'ititle' => Entity::hsc(strip_tags($current['ititle'])),
\r
1895 'iauthor' => Entity::hsc(strip_tags($current['mname'])),
\r
1896 'itemid' => intval($current['inumber']),
\r
1897 'editbtn' => _LISTS_EDIT,
\r
1898 'delbtn' => _LISTS_DELETE,
\r
1902 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_FOOT']) )
\r
1908 $template = $templates['SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_FOOT'];
\r
1913 return Template::fill($template, $data);
\r
1916 function listplug_table_actionlist($vars, $type, $template_name = '')
\r
1920 $templates = array();
\r
1921 if ( !empty($template_name) )
\r
1923 $templates =& $manager->getTemplate($template_name);
\r
1929 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_ACTNLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_ACTNLIST_HEAD']) )
\r
1931 $template = "<th><%coltime%></th>\n"
\r
1932 . "<th><%colmesg%></th>\n";
\r
1936 $template = $templates['SHOWLIST_LISTPLUG_TABLE_ACTNLIST_HEAD'];
\r
1939 'coltime' => _LISTS_TIME,
\r
1940 'colmesg' => _LIST_ACTION_MSG,
\r
1944 $current = $vars['current'];
\r
1945 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_ACTNLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_ACTNLIST_BODY']) )
\r
1947 $template = "<td><%timestamp%></td>\n"
\r
1948 . "<td><%message%></td>\n";
\r
1952 $template = $templates['SHOWLIST_LISTPLUG_TABLE_ACTNLIST_BODY'];
\r
1955 'timestamp' => Entity::hsc($current['timestamp']),
\r
1956 'message' => Entity::hsc($current['message']),
\r
1960 $current = $vars['current'];
\r
1961 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_ACTNLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_ACTNLIST_FOOT']) )
\r
1967 $template = $templates['SHOWLIST_LISTPLUG_TABLE_ACTNLIST_FOOT'];
\r
1972 return Template::fill($template, $data);
\r
1975 function listplug_table_banlist($vars, $type, $template_name = '')
\r
1979 $templates = array();
\r
1980 if ( !empty($template_name) )
\r
1982 $templates =& $manager->getTemplate($template_name);
\r
1988 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_IBANLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_IBANLIST_HEAD']) )
\r
1990 $template = "<th><%iprange%></th>\n"
\r
1991 . "<th><%reason%></th>\n"
\r
1992 . "<th><%colact%></th>\n";
\r
1996 $template = $templates['SHOWLIST_LISTPLUG_TABLE_IBANLIST_HEAD'];
\r
1999 'iprange' => _LIST_BAN_IPRANGE,
\r
2000 'reason' => _LIST_BAN_REASON,
\r
2001 'colact' => _LISTS_ACTIONS,
\r
2005 $current = $vars['current'];
\r
2006 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_IBANLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_IBANLIST_BODY']) )
\r
2008 $template = "<td><%iprange%></td>\n"
\r
2009 . "<td><%reason%></td>\n"
\r
2010 . "<td><a href=\"index.php?action=banlistdelete&blogid=<%blogid%>&iprange=<%iprange%>\"><%delbtn%></a></td>\n";
\r
2014 $template = $templates['SHOWLIST_LISTPLUG_TABLE_IBANLIST_BODY'];
\r
2017 'iprange' => Entity::hsc($current['iprange']),
\r
2018 'reason' => Entity::hsc($current['reason']),
\r
2019 'blogid' => intval($current['blogid']),
\r
2020 'delbtn' => _LISTS_DELETE,
\r
2024 $current = $vars['current'];
\r
2025 if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_IBANLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_IBANLIST_FOOT']) )
\r
2031 $template = $templates['SHOWLIST_LISTPLUG_TABLE_IBANLIST_FOOT'];
\r
2036 return Template::fill($template, $data);
\r
2040 * listplug_list_normalskinlist()
\r
2042 * @param array $vars array for variables
\r
2043 * @param string $type HEAD/BODY/FOOT
\r
2044 * @param string $template_name name of template
\r
2045 * @return string marked-up string
\r
2047 function listplug_list_normalskinlist($vars, $type, $template_name = '')
\r
2049 global $manager, $CONF;
\r
2051 /* available variables as a default */
\r
2053 'skinid' => (integer) $vars['skinid'],
\r
2054 'skinname' => Entity::hsc($vars['skinname']),
\r
2057 $templates = array();
\r
2058 if ( $template_name )
\r
2060 $templates =& $manager->getTemplate($template_name);
\r
2066 if ( !array_key_exists('NORMALSKINLIST_HEAD', $templates) || empty($templates['NORMALSKINLIST_HEAD']) )
\r
2068 $template = "<ul>\n";
\r
2072 $template = $templates['NORMALSKINLIST_HEAD'];
\r
2077 $current = $vars['current'];
\r
2078 if ( !array_key_exists('NORMALSKINLIST_BODY', $templates) || empty($templates['NORMALSKINLIST_BODY']) )
\r
2080 $template = "<li>"
\r
2081 . "<a href=\"<%editurl%>\" tabindex=\"<%tabindex%>\"><%skintypename%></a>"
\r
2087 $template = $templates['NORMALSKINLIST_BODY'];
\r
2090 $data['tabindex'] = $vars['tabindex']++;
\r
2091 $data['skintype'] = $current['skintype'];
\r
2092 $data['skintypename'] = $current['skintypename'];
\r
2093 $data['editaction'] = $vars['editaction'];
\r
2094 $data['editurl'] = "{$CONF['AdminURL']}?action={$vars['editaction']}&skinid={$vars['skinid']}&type={$current['skintype']}";
\r
2095 /* TODO: removeaction? */
\r
2096 /* TODO: customHelpHtml("skinpart{$skintype}-{$template_name}") */
\r
2097 $data['help'] = '';
\r
2100 if ( !array_key_exists('NORMALSKINLIST_FOOT', $templates) || empty($templates['NORMALSKINLIST_FOOT']) )
\r
2102 $template = "</ul>\n";
\r
2106 $template = $templates['NORMALSKINLIST_FOOT'];
\r
2112 return Template::fill($template, $data);
\r
2116 * listplug_list_specialskinlist()
\r
2118 * @param array $vars array for variables
\r
2119 * @param string $type HEAD/BODY/FOOT
\r
2120 * @param string $template_name name of template
\r
2121 * @return string marked-up string
\r
2123 function listplug_list_specialskinlist($vars, $type, $template_name = '')
\r
2125 global $manager, $CONF;
\r
2127 /* available variables as a default */
\r
2129 'skinid' => (integer) $vars['skinid'],
\r
2130 'skinname' => Entity::hsc($vars['skinname']),
\r
2133 /* retrieve templates */
\r
2134 $templates = array();
\r
2135 if ( $template_name )
\r
2137 $templates =& $manager->getTemplate($template_name);
\r
2143 if ( !array_key_exists('SPECIALSKINLIST_HEAD', $templates) || empty($templates['SPECIALSKINLIST_HEAD']) )
\r
2145 $template = "<ul>\n";
\r
2149 $template = $templates['SPECIALSKINLIST_HEAD'];
\r
2153 $current = $vars['current'];
\r
2154 if ( !array_key_exists('SPECIALSKINLIST_BODY', $templates) || empty($templates['SPECIALSKINLIST_BODY']) )
\r
2156 $template = "<li>"
\r
2157 . "<a href=\"<%editurl%>\" tabindex=\"<%tabindex%>\">"
\r
2161 . "<a href=\"<%removeurl%>\" tabindex=\"<%tabindex%>\" >"
\r
2162 . "<%text(_LISTS_DELETE)%>"
\r
2169 $template = $templates['SPECIALSKINLIST_BODY'];
\r
2172 $data['tabindex'] = (integer) $vars['tabindex']++;
\r
2173 $data['skintype'] = Entity::hsc($current['skintype']);
\r
2174 $data['skintypename'] = Entity::hsc($current['skintypename']);
\r
2175 $data['editaction'] = $vars['editaction'];
\r
2176 $data['editurl'] = "{$CONF['AdminURL']}?action={$vars['editaction']}&skinid={$vars['skinid']}&type={$current['skintype']}";
\r
2177 $data['removeaction'] = $vars['editaction'];
\r
2178 $data['removeurl'] = "{$CONF['AdminURL']}?action={$vars['removeaction']}&skinid={$vars['skinid']}&type={$current['skintype']}";
\r
2182 if ( !array_key_exists('SPECIALSKINLIST_FOOT', $templates) || empty($templates['SPECIALSKINLIST_FOOT']) )
\r
2184 $template = "</ul>\n";
\r
2188 $template = $templates['SPECIALSKINLIST_FOOT'];
\r
2193 return Template::fill($template, $data);
\r
2197 * listplug_input_yesno()
\r
2199 * @param string $name name of input element with radio type attribute
\r
2200 * @param string $checkedval value which should be checked
\r
2201 * @param integer $tabindex tabindex number
\r
2202 * @param string $value1 value of radio 1
\r
2203 * @param string $value2 value of radio 2
\r
2204 * @param string $yesval label for yes
\r
2205 * @param string $noval label for no
\r
2206 * @param boolean $isAdmin super admin or not
\r
2207 * @param string $template_name name of template
\r
2208 * @param boolean $showlist used in showlist or not
\r
2209 * @return string marked-up string
\r
2211 function listplug_input_yesno($name, $checkedval, $tabindex = 0,
\r
2212 $value1 = 1, $value2 = 0, $yesval = _YES, $noval = _NO,
\r
2213 $isAdmin = 0, $template_name = '', $showlist = FALSE)
\r
2217 $templates = array();
\r
2218 if ( $template_name )
\r
2220 $templates =& $manager->getTemplate($template_name);
\r
2223 if ( $name == 'admin' )
\r
2225 if ( !array_key_exists('INPUTYESNO_TEMPLATE_ADMIN', $templates) || empty($templates['INPUTYESNO_TEMPLATE_ADMIN']) )
\r
2227 $template = "<input type=\"radio\" id=\"<%yesid%>\" name=\"<%name%>\" value=\"<%yesval%>\" <%yescheckedval%> onclick=\"selectCanLogin(true);\" />\n"
\r
2228 . "<label for=\"<%yesid%>\"><%yesvaltext%></label>\n"
\r
2229 . "<input type=\"radio\" id=\"<%noid%>\" name=\"<%name%>\" value=\"<%noval%>\" <%nocheckedval%> <%disabled%> onclick=\"selectCanLogin(false);\" />\n"
\r
2230 . "<label for=\"<%noid%>\"><%novaltext%></label>\n";
\r
2234 $template = $templates['INPUTYESNO_TEMPLATE_ADMIN'];
\r
2239 if ( array_key_exists('INPUTYESNO_TEMPLATE_NORMAL', $templates) && !empty($templates['INPUTYESNO_TEMPLATE_NORMAL']) )
\r
2241 $template = $templates['INPUTYESNO_TEMPLATE_NORMAL'];
\r
2243 else if ( $showlist && array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OYESNO', $templates) && !empty($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OYESNO']) )
\r
2245 $template = $templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OYESNO'];
\r
2249 $template = "<input type=\"radio\" id=\"<%yesid%>\" name=\"<%name%>\" value=\"<%yesval%>\" <%yescheckedval%> />\n"
\r
2250 . "<label for=\"<%yesid%>\"><%yesvaltext%></label>\n"
\r
2251 . "<input type=\"radio\" id=\"<%noid%>\" name=\"<%name%>\" value=\"<%noval%>\" <%nocheckedval%> <%disabled%> />\n"
\r
2252 . "<label for=\"<%noid%>\"><%novaltext%></label>\n";
\r
2256 $id = preg_replace('#[|]#', '-', $name);
\r
2257 $id1 = $id . $value1;
\r
2258 $id2 = $id . $value2;
\r
2260 'name' => Entity::hsc($name),
\r
2261 'yesval' => Entity::hsc($value1),
\r
2262 'noval' => Entity::hsc($value2),
\r
2263 'yesid' => Entity::hsc($id1),
\r
2264 'noid' => Entity::hsc($id2),
\r
2265 'yesvaltext' => $yesval,
\r
2266 'novaltext' => $noval,
\r
2267 'yescheckedval' => ($checkedval == $value1) ? 'checked="checked" tabindex="' . $tabindex . '"': '',
\r
2268 'nocheckedval' => ($checkedval != $value1) ? 'checked="checked" tabindex="' . $tabindex . '"': '',
\r
2269 'disabled' => ($isAdmin && $name == 'canlogin') ? ' disabled="disabled"' : '',
\r
2272 return Template::fill($template, $dat);
\r
2276 * listplug_batchlist()
\r
2278 * @param string $attr item/member/team/category/comment
\r
2279 * @param resource $query SQL resorce
\r
2280 * @param string $type type for showlist()
\r
2281 * @param array $vars array for variables
\r
2283 function listplug_batchlist($attr, $query, $type, $vars, $template_name)
\r
2288 $content = "<form method=\"post\" action=\"index.php\">\n";
\r
2291 $content .= showlist($query, $type, $vars, $template_name);
\r
2298 'delete' => _BATCH_ITEM_DELETE,
\r
2299 'move' => _BATCH_ITEM_MOVE
\r
2304 'delete' => _BATCH_MEMBER_DELETE,
\r
2305 'setadmin' => _BATCH_MEMBER_SET_ADM,
\r
2306 'unsetadmin' => _BATCH_MEMBER_UNSET_ADM
\r
2311 'delete' => _BATCH_TEAM_DELETE,
\r
2312 'setadmin' => _BATCH_TEAM_SET_ADM,
\r
2313 'unsetadmin' => _BATCH_TEAM_UNSET_ADM,
\r
2318 'delete' => _BATCH_CAT_DELETE,
\r
2319 'move' => _BATCH_CAT_MOVE,
\r
2324 'delete' => _BATCH_COMMENT_DELETE,
\r
2328 $options = array();
\r
2332 $content .= "<p class=\"batchoperations\">\n"
\r
2334 . "<select name=\"batchaction\">\n";
\r
2336 foreach ( $options as $option => $label )
\r
2338 $content .= "<option value=\"{$option}\">{$label}</option>\n";
\r
2340 $content .= "</select>\n";
\r
2342 if ( $attr == 'team' )
\r
2344 $content .= '<input type="hidden" name="blogid" value="' . intRequestVar('blogid') . '" />';
\r
2346 else if ( $attr == 'comment' )
\r
2348 $content .= '<input type="hidden" name="itemid" value="' . intRequestVar('itemid') . '" />';
\r
2351 $content .= '<input type="submit" value="' . _BATCH_EXEC . '" />'
\r
2353 . "<a href=\"\" onclick=\"if( event && event.preventDefault ) event.preventDefault(); return batchSelectAll(1); \">" . _BATCH_SELECTALL . "</a>"
\r
2355 . "<a href=\"\" onclick=\"if( event && event.preventDefault ) event.preventDefault(); return batchSelectAll(0); \">" . _BATCH_DESELECTALL . "</a>"
\r
2357 . "<input type=\"hidden\" name=\"action\" value=\"batch{$attr}\" />\n"
\r
2358 . '<input type="hidden" name="ticket" value="' . Entity::hsc($manager->getNewTicket()) . '" />' . "\n"
\r
2366 * listplug_navlist()
\r
2368 * @param string $attr item/member/team/category/comment
\r
2369 * @param resource $query SQL resorce
\r
2370 * @param string $type type for showlist()
\r
2371 * @param array $vars array for variables
\r
2372 * @param string $template_name name of template
\r
2373 * @return string contents
\r
2375 function listplug_navlist($attribute, $query, $type, $vars, $template_name)
\r
2379 $prev = $vars['start'] - $vars['amount'];
\r
2380 if ( $prev < $vars['minamount'] )
\r
2382 $prev = $vars['minamount'];
\r
2385 $next = $vars['start'] + $vars['amount'];
\r
2388 $navi .= "<table frame=\"box\" rules=\"all\" sumamry=\"navigation actions\" class=\"navigation\">\n"
\r
2391 . "<form method=\"post\" action=\"{$CONF['AdminURL']}\">\n"
\r
2392 . "<input type=\"hidden\" name=\"start\" value=\"{$prev}\" />\n"
\r
2393 . "<button type=\"submit\" name=\"action\" value=\"{$vars['action']}\">< < " . _LISTS_PREV . "</button>\n"
\r
2394 . "<input type=\"hidden\" name=\"blogid\" value=\"{$vars['blogid']}\" />\n"
\r
2395 . "<input type=\"hidden\" name=\"itemid\" value=\"{$vars['itemid']}\" />\n"
\r
2396 . "<input type=\"hidden\" name=\"search\" value=\"{$vars['search']}\" />\n"
\r
2397 . "<input type=\"hidden\" name=\"amount\" value=\"{$vars['amount']}\" />\n"
\r
2401 . "<form method=\"post\" action=\"{$CONF['AdminURL']}\">\n"
\r
2402 . "<input type=\"text\" name=\"amount\" size=\"3\" value=\"{$vars['amount']}\" />\n"
\r
2404 . "<input type=\"hidden\" name=\"start\" value=\"0\" />\n"
\r
2405 . "<button type=\"submit\" name=\"action\" value=\"{$vars['action']}\">> " . _LISTS_CHANGE . "</button>\n"
\r
2406 . "<input type=\"hidden\" name=\"blogid\" value=\"{$vars['blogid']}\" />\n"
\r
2407 . "<input type=\"hidden\" name=\"itemid\" value=\"{$vars['itemid']}\" />\n"
\r
2408 . "<input type=\"hidden\" name=\"search\" value=\"{$vars['search']}\" />\n"
\r
2409 . "<input type=\"hidden\" name=\"amount\" value=\"{$vars['amount']}\" />\n"
\r
2413 . "<form method=\"post\" action=\"{$CONF['AdminURL']}\">\n"
\r
2414 . "<input type=\"text\" name=\"search\" value=\"{$vars['search']}\" size=\"7\" />\n"
\r
2415 . "<input type=\"hidden\" name=\"start\" value=\"0\" />\n"
\r
2416 . "<button type=\"submit\" name=\"action\" value=\"{$vars['action']}\">> " . _LISTS_SEARCH . "</button>\n"
\r
2417 . "<input type=\"hidden\" name=\"blogid\" value=\"{$vars['blogid']}\" />\n"
\r
2418 . "<input type=\"hidden\" name=\"itemid\" value=\"{$vars['itemid']}\" />\n"
\r
2419 . "<input type=\"hidden\" name=\"search\" value=\"{$vars['search']}\" />\n"
\r
2420 . "<input type=\"hidden\" name=\"amount\" value=\"{$vars['amount']}\" />\n"
\r
2424 . "<form method=\"post\" action=\"{$CONF['AdminURL']}\">\n"
\r
2425 . "<input type=\"hidden\" name=\"start\" value=\"{$next}\" />\n"
\r
2426 . "<button type=\"submit\" name=\"action\" value=\"{$vars['action']}\">" . _LISTS_NEXT . "> > </button>\n"
\r
2427 . "<input type=\"hidden\" name=\"blogid\" value=\"{$vars['blogid']}\" />\n"
\r
2428 . "<input type=\"hidden\" name=\"itemid\" value=\"{$vars['itemid']}\" />\n"
\r
2429 . "<input type=\"hidden\" name=\"search\" value=\"{$vars['search']}\" />\n"
\r
2430 . "<input type=\"hidden\" name=\"amount\" value=\"{$vars['amount']}\" />\n"
\r
2433 $navi .= "</tr>\n"
\r
2437 $template = $navi;
\r
2440 $template .= listplug_batchlist($attribute, $query, $type, $vars, $template_name);
\r
2443 $template .= $navi;
\r