3 * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
\r
4 * Copyright (C) 2002-2012 The Nucleus Group
\r
6 * This program is free software; you can redistribute it and/or
\r
7 * modify it under the terms of the GNU General Public License
\r
8 * as published by the Free Software Foundation; either version 2
\r
9 * of the License, or (at your option) any later version.
\r
10 * (see nucleus/documentation/index.html#license for more info)
\r
13 * Functions to create lists of things inside the admin are
\r
15 * @license http://nucleuscms.org/license.txt GNU General Public License
\r
16 * @copyright Copyright (C) 2002-2012 The Nucleus Group
\r
17 * @version $Id: showlist.php 1662 2012-02-12 12:18:37Z sakamocchi $
\r
21 // can take either an array of objects, or an SQL query
\r
22 function showlist($query, $type, $template, $templateName = '')
\r
24 if ( is_array($query) )
\r
26 if ( sizeof($query) == 0 )
\r
31 call_user_func("listplug_{$type}", $template, 'HEAD', $templateName);
\r
33 foreach ( $query as $currentObj )
\r
35 $template['current'] = $currentObj;
\r
36 call_user_func("listplug_{$type}", $template, 'BODY', $templateName);
\r
39 call_user_func("listplug_{$type}", $template, 'FOOT', $templateName);
\r
41 return sizeof($query);
\r
45 $res = sql_query($query);
\r
47 // don't do anything if there are no results
\r
48 $numrows = sql_num_rows($res);
\r
49 if ( $numrows == 0 )
\r
53 call_user_func("listplug_{$type}", $template, 'HEAD', $templateName);
\r
55 while( $template['current'] = sql_fetch_object($res) )
\r
57 call_user_func("listplug_{$type}", $template, 'BODY', $templateName);
\r
60 call_user_func("listplug_{$type}", $template, 'FOOT', $templateName);
\r
62 sql_free_result($res);
\r
64 // return amount of results
\r
69 function listplug_select($vars, $type, $templateName = '')
\r
71 $templates = array();
\r
72 if ( !empty($templateName) )
\r
74 $templates = Template::read($templateName);
\r
79 if ( isset($templates['SHOWLIST_LISTPLUG_SELECT_HEAD']) || !empty($templates['SHOWLIST_LISTPLUG_SELECT_HEAD']) )
\r
81 $template = $templates['SHOWLIST_LISTPLUG_SELECT_HEAD'];
\r
85 $template = "<select<%name%><%tabindex%><%javascript%>>\n<%extraoption%>\n";
\r
88 'name' => isset($vars['name']) ? ' name="' . $vars['name'] . '"' : '',
\r
89 'tabindex' => isset($vars['tabindex']) ? ' tabindex="' . $vars['tabindex'] . '"' : '',
\r
90 'javascript' => isset($vars['javascript']) ? ' ' . $vars['javascript'] : '',
\r
92 $data ['extraoption'] = isset($vars['extra']) ?
\r
93 '<option value="' . $vars['extra'] . '">' . $vars['extra'] . "</option>" :
\r
97 $current = $vars['current'];
\r
98 if ( isset($templates['SHOWLIST_LISTPLUG_SELECT_BODY']) || !empty($templates['SHOWLIST_LISTPLUG_SELECT_BODY']) )
\r
100 $template = $templates['SHOWLIST_LISTPLUG_SELECT_BODY'];
\r
104 $template = '<option value="<%value%>"<%selected%><%title%>><%option%></option>' . "\n";
\r
107 'value' => Entity::hsc($current->value),
\r
108 'selected' => ($vars['selected'] == $current->value) ? ' selected="selected"' : '',
\r
110 if ( isset($vars['shorten']) && $vars['shorten'] > 0 )
\r
112 $data['title'] = ' title="' . Entity::hsc($current->text) . '"';
\r
113 $current->text = Entity::hsc(Entity::shorten($current->text, $vars['shorten'], $vars['shortenel']));
\r
117 $data['title'] = '';
\r
119 $data['option'] = Entity::hsc($current->text);
\r
122 if ( isset($templates['SHOWLIST_LISTPLUG_SELECT_FOOT']) || !empty($templates['SHOWLIST_LISTPLUG_SELECT_FOOT']) )
\r
124 $template = $templates['SHOWLIST_LISTPLUG_SELECT_FOOT'];
\r
128 $template = "</select>\n";
\r
133 $template = Template::fill($template, $data);
\r
134 $handler = new Actions('template', $template, $data);
\r
135 $parser = new PARSER(Actions::getDefinedActions(), $handler);
\r
136 $parser->parse($template);
\r
140 function listplug_table($vars, $type, $templateName = '')
\r
142 $templates = array();
\r
143 if ( !empty($templateName) )
\r
145 $templates = Template::read($templateName);
\r
150 if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_HEAD']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_HEAD']) )
\r
152 $template = $templates['SHOWLIST_LISTPLUG_TABLE_HEAD'];
\r
156 $template = "<table><thead><tr>\n<%typehead%>\n</tr></thead><tbody>\n";
\r
159 'typehead' => call_user_func("listplug_table_" . $vars['content'] , $vars, 'HEAD', $templateName)
\r
163 if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_BODY']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_BODY']) )
\r
165 $template = $templates['SHOWLIST_LISTPLUG_TABLE_BODY'];
\r
169 $template = "<tr onmouseover=\"focusRow(this);\" onmouseout=\"blurRow(this);\"><%typebody%>\n</tr>\n";
\r
171 // tabletype specific thingies
\r
173 'typebody' => call_user_func("listplug_table_" . $vars['content'] , $vars, 'BODY', $templateName)
\r
177 if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_FOOT']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_FOOT']) )
\r
179 $template = $templates['SHOWLIST_LISTPLUG_TABLE_FOOT'];
\r
183 $template = "<%typefoot%>\n</tbody></table>\n";
\r
185 // tabletype specific thingies
\r
187 'typefoot' => call_user_func("listplug_table_" . $vars['content'] , $vars, 'FOOT', $templateName)
\r
191 $template = Template::fill($template, $data);
\r
192 $handler = new Actions('template', $template, $data);
\r
193 $parser = new PARSER(Actions::getDefinedActions(), $handler);
\r
194 $parser->parse($template);
\r
198 function listplug_table_memberlist($vars, $type, $templateName = '')
\r
200 $templates = array();
\r
201 if ( !empty($templateName) )
\r
203 $templates = Template::read($templateName);
\r
208 if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_MEMBLIST_HEAD']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_MEMBLIST_HEAD']) )
\r
210 $template = $templates['SHOWLIST_LISTPLUG_TABLE_MEMBLIST_HEAD'];
\r
214 $template = "<th><%colmembername%></th>\n"
\r
215 . "<th><%colmemberrname%></th>\n"
\r
216 . "<th><%colmemberurl%></th>\n"
\r
217 . "<th><%colmemberadmin%><%helplink(superadmin)%></th>\n"
\r
218 . "<th><%colmemberlogin%><%helplink(canlogin)%></th>\n"
\r
219 . "<th colspan=\"2\"><%colactions%></th>\n";
\r
222 'colmembername' => _LIST_MEMBER_NAME,
\r
223 'colmemberrname' => _LIST_MEMBER_RNAME,
\r
224 'colmemberurl' => _LIST_MEMBER_URL,
\r
225 'colmemberadmin' => _LIST_MEMBER_ADMIN,
\r
226 'colmemberlogin' => _LIST_MEMBER_LOGIN,
\r
227 'colactions' => _LISTS_ACTIONS,
\r
231 $current = $vars['current'];
\r
232 if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_MEMBLIST_BODY']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_MEMBLIST_BODY']) )
\r
234 $template = $templates['SHOWLIST_LISTPLUG_TABLE_MEMBLIST_BODY'];
\r
238 $template = "<td>\n"
\r
239 . "<input type=\"checkbox\" id=\"batch<%id%>\" name=\"batch[<%id%>]\" value=\"<%memberid%>\" />\n"
\r
240 . "<label for=\"batch<%id%>\">\n"
\r
241 . "<a href=\"mailto:<%mailaddress%>\" tabindex=\"<%tabindex%>\"><%name%></a>\n"
\r
242 . "</label>\n</td>\n"
\r
243 . "<td><%realname%></td>\n"
\r
244 . "<td><a href=\"<%url%>\" tabindex=\"<%tabindex%>\"><%url%></a></td>\n"
\r
245 . "<td><%admin%></td>\n"
\r
246 . "<td><%login%></td>\n"
\r
247 . "<td><a href=\"index.php?action=memberedit&memberid=<%memberid%>\" tabindex=\"<%tabindex%>\"><%editbtn%></a></td>\n"
\r
248 . "<td><a href=\"index.php?action=memberdelete&memberid=<%memberid%>\" tabindex=\"<%tabindex%>\"><%deletebtn%></a></td>\n";
\r
251 'id' => listplug_nextBatchId(),
\r
252 'memberid' => $current->mnumber,
\r
253 'mailaddress' => Entity::hsc($current->memail),
\r
254 'tabindex' => $vars['tabindex'],
\r
255 'name' => Entity::hsc($current->mname),
\r
256 'realname' => Entity::hsc($current->mrealname),
\r
257 'url' => Entity::hsc($current->murl),
\r
258 'admin' => ($current->madmin ? _YES : _NO),
\r
259 'login' => ($current->mcanlogin ? _YES : _NO),
\r
260 'editbtn' => _LISTS_EDIT,
\r
261 'deletebtn' => _LISTS_DELETE,
\r
265 if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_MEMBLIST_FOOT']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_MEMBLIST_FOOT']) )
\r
267 $template = $templates['SHOWLIST_LISTPLUG_TABLE_MEMBLIST_FOOT'];
\r
276 return Template::fill($template, $data);
\r
279 function listplug_table_teamlist($vars, $type, $templateName = '')
\r
282 $templates = array();
\r
283 if ( !empty($templateName) )
\r
285 $templates = Template::read($templateName);
\r
290 if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_TEAMLIST_HEAD']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_TEAMLIST_HEAD']) )
\r
292 $template = $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
302 'colmembername' => _LIST_MEMBER_NAME,
\r
303 'colmemberrname' => _LIST_MEMBER_RNAME,
\r
304 'colteamadmin' => _LIST_TEAM_ADMIN,
\r
305 'colactions' => _LISTS_ACTIONS,
\r
309 $current = $vars['current'];
\r
310 if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_TEAMLIST_BODY']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_TEAMLIST_BODY']) )
\r
312 $template = $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
326 $url = 'index.php?action=teamchangeadmin&memberid=' . intval($current->tmember) . '&blogid=' . intval($current->tblog);
\r
327 $url = $manager->addTicketToUrl($url);
\r
329 'id' => listplug_nextBatchId(),
\r
330 'memberid' => $current->tmember,
\r
331 'mailaddress' => Entity::hsc($current->memail),
\r
332 'tabindex' => $vars['tabindex'],
\r
333 'name' => Entity::hsc($current->mname),
\r
334 'realname' => Entity::hsc($current->mrealname),
\r
335 'admin' => ($current->tadmin ? _YES : _NO),
\r
336 'blogid' => $current->tblog,
\r
337 'deletebtn' => _LISTS_DELETE,
\r
338 'chadminurl' => Entity::hsc($url),
\r
342 if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_TEAMLIST_FOOT']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_TEAMLIST_FOOT']) )
\r
344 $template = $templates['SHOWLIST_LISTPLUG_TABLE_TEAMLIST_FOOT'];
\r
352 return Template::fill($template, $data);
\r
355 function listplug_table_pluginlist($vars, $type, $templateName = '')
\r
358 $templates = array();
\r
359 if ( !empty($templateName) )
\r
361 $templates = Template::read($templateName);
\r
366 if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HEAD']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HEAD']) )
\r
368 $template = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HEAD'];
\r
372 $template = "<th><%colinfo%></th>\n"
\r
373 . "<th><%coldesc%></th>\n"
\r
374 . "<th colspan=\"2\"><%colactions%></th>\n";
\r
377 'colinfo' => _LISTS_INFO,
\r
378 'coldesc' => _LISTS_DESC,
\r
379 'colactions' => _LISTS_ACTIONS,
\r
383 $current = $vars['current'];
\r
385 $plug =& $manager->getPlugin($current->pfile);
\r
388 if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY']) )
\r
390 $template = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY'];
\r
394 $template = "<td>\n"
\r
395 . "<strong><%plugname%></strong><br />\n"
\r
396 . "<%autherlabel%> <%plugauther%><br />\n"
\r
397 . "<%versionlabel%> <%plugversion%><br />\n"
\r
398 . "<%pluggeturl%><br />\n"
\r
401 . "<%desclabel%><br /><%plugdesc%>\n"
\r
402 . "<%eventlist%>\n"
\r
403 . "<%needupdate%>\n"
\r
404 . "<%dependlist%>\n"
\r
405 . "<%depreqlist%>\n"
\r
409 'plugname' => Entity::hsc($plug->getName()),
\r
410 'autherlabel' => _LIST_PLUGS_AUTHOR,
\r
411 'plugauther' => Entity::hsc($plug->getAuthor()),
\r
412 'versionlabel' => _LIST_PLUGS_VER,
\r
413 'plugversion' => Entity::hsc($plug->getVersion()),
\r
414 'tabindex' => $vars['tabindex'],
\r
415 'desclabel' => _LIST_PLUGS_DESC,
\r
416 'plugdesc' => Entity::hen($plug->getDescription()),
\r
418 if ( $plug->getURL() )
\r
420 if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_GURL']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_GURL']) )
\r
422 $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_GURL'];
\r
426 $subTpl = "<a href=\"<%plugurl%>\" tabindex=\"<%tabindex%>\"><%plugsite%></a>";
\r
429 'plugurl' => Entity::hsc($plug->getURL()),
\r
430 'tabindex' => $vars['tabindex'],
\r
431 'plugsite' => _LIST_PLUGS_SITE,
\r
433 $data['pluggeturl'] = Template::fill($subTpl, $subData);
\r
437 $data['pluggeturl'] = '';
\r
439 if ( count($plug->getEventList()) > 0 )
\r
441 if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_PLUGEVENTLIST']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGEVENTLIST']) )
\r
443 $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGEVENTLIST'];
\r
447 $subTpl = "<br /><br /><%evntlstlbl%><br /><%eventlist%>";
\r
450 'evntlstlbl' => _LIST_PLUGS_SUBS,
\r
451 'eventlist' => Entity::hsc(implode(', ', $plug->getEventList())),
\r
453 $data['eventlist'] = Template::fill($subTpl, $subData);
\r
457 $data['eventlist'] = '';
\r
459 if ( !$plug->subscribtionListIsUptodate() )
\r
461 if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_PLUGNEDUPDATE']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGNEDUPDATE']) )
\r
463 $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGNEDUPDATE'];
\r
467 $subTpl = "<br /><br /><strong><%updatealert%></strong>";
\r
470 'updatealert' => _LIST_PLUG_SUBS_NEEDUPDATE,
\r
472 $data['needupdate'] = Template::fill($subTpl, $subData);
\r
476 $data['needupdate'] = '';
\r
478 if ( count($plug->getPluginDep() ) > 0)
\r
480 if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPEND']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPEND']) )
\r
482 $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPEND'];
\r
486 $subTpl = "<br /><br /><%deplistlbl%><br /><%dependlist%>";
\r
489 'deplistlbl' => _LIST_PLUGS_DEP,
\r
490 'dependlist' => Entity::hsc(implode(', ', $plug->getPluginDep())),
\r
492 $data['dependlist'] = Template::fill($subTpl, $subData);
\r
496 $data['dependlist'] = '';
\r
498 /* check dependency */
\r
500 $res = sql_query('SELECT pfile FROM ' . sql_table('plugin'));
\r
501 while( $o = sql_fetch_object($res) )
\r
503 $preq =& $manager->getPlugin($o->pfile);
\r
506 $depList = $preq->getPluginDep();
\r
507 foreach ( $depList as $depName )
\r
509 if ( $current->pfile == $depName )
\r
511 $req[] = $o->pfile;
\r
517 if ( count($req) > 0 )
\r
519 if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPREQ']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPREQ']) )
\r
521 $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPREQ'];
\r
525 $subTpl = "<br /><br /><%deprlstlbl%><br /><%depreqlist%>";
\r
528 'deprlstlbl' => _LIST_PLUGS_DEPREQ,
\r
529 'depreqlist' => Entity::hsc(implode(', ', $req)),
\r
531 $data['depreqlist'] = Template::fill($subTpl, $subData);
\r
535 $data['depreqlist'] = '';
\r
540 if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLISTFALSE']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLISTFALSE']) )
\r
542 $template = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLISTFALSE'];
\r
546 $template = "<td colspan=\"2\"><%noplugalert%></td>\n";
\r
549 'noplugalert' => sprintf(_PLUGINFILE_COULDNT_BELOADED, Entity::hsc($current->pfile)),
\r
552 if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ACTN']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ACTN']) )
\r
554 $template .= $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ACTN'];
\r
558 $template .= "<td>\n"
\r
559 . "<a href=\"<%actionupurl%>\" tabindex=\"<%tabindex%>\"><%actionuptxt%></a><br />\n"
\r
560 . "<a href=\"<%actiondownurl%>\" tabindex=\"<%tabindex%>\"><%actiondowntxt%></a><br />\n"
\r
561 . "<a href=\"<%actuninsturl%>\" tabindex=\"<%tabindex%>\"><%actuninsttxt%></a><br />"
\r
562 . "<%plugadminurl%>\n"
\r
563 . "<%plughelpurl%>\n"
\r
564 . "<%plugoptsetting%>\n"
\r
567 $baseUrl = 'index.php?plugid=' . $pid . '&action=';
\r
568 $upUrl = $manager->addTicketToUrl($baseUrl . 'pluginup');
\r
569 $downUrl = $manager->addTicketToUrl($baseUrl . 'plugindown');
\r
570 $data['actionuptxt'] = _LIST_PLUGS_UP;
\r
571 $data['actionupurl'] = Entity::hsc($upUrl);
\r
572 $data['actiondowntxt'] = _LIST_PLUGS_DOWN;
\r
573 $data['actiondownurl'] = Entity::hsc($downUrl);
\r
574 $data['actuninsttxt'] = _LIST_PLUGS_UNINSTALL;
\r
575 $data['actuninsturl'] = 'index.php?action=plugindelete&plugid=' . $pid;
\r
576 if ( $plug && ($plug->hasAdminArea() > 0) )
\r
578 if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ADMN']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ADMN']) )
\r
580 $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ADMN'];
\r
584 $subTpl = "<a href=\"<%actadminurl%>\" tabindex=\"<%tabindex%>\"><%actadmintxt%></a><br />\n";
\r
587 'actadminurl' => Entity::hsc($plug->getAdminURL()),
\r
588 'tabindex' => $vars['tabindex'],
\r
589 'actadmintxt' => _LIST_PLUGS_ADMIN,
\r
591 $data['plugadminurl'] = Template::fill($subTpl, $subData);
\r
595 $data['plugadminurl'] = '';
\r
597 if ( $plug && ($plug->supportsFeature('HelpPage') > 0) )
\r
599 if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HELP']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HELP']) )
\r
601 $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HELP'];
\r
605 $subTpl = "<a href=\"<%acthelpurl%>\" tabindex=\"<%tabindex%>\"><%acthelptxt%></a><br />\n";
\r
608 'acthelpurl' => 'index.php?action=pluginhelp&plugid=' . $pid,
\r
609 'tabindex' => $vars['tabindex'],
\r
610 'acthelptxt' => _LIST_PLUGS_HELP,
\r
612 $data['plughelpurl'] = Template::fill($subTpl, $subData);
\r
616 $data['plughelpurl'] = '';
\r
618 $optQuery = 'SELECT '
\r
619 . ' COUNT(*) AS result '
\r
621 . sql_table('plugin_option_desc') . ' '
\r
623 . ' ocontext = "global" '
\r
625 $pOptions = quickQuery(sprintf($optQuery, $pid));
\r
626 if ( $pOptions > 0 )
\r
628 if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_PLUGOPTSETURL']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGOPTSETURL']) )
\r
630 $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGOPTSETURL'];
\r
634 $subTpl = "<a href=\"<%actoptionurl%>\" tabindex=\"<%tabindex%>\"><%actoptiontxt%></a>\n";
\r
637 'actoptionurl' => 'index.php?action=pluginoptions&plugid=' . $pid,
\r
638 'tabindex' => $vars['tabindex'],
\r
639 'actoptiontxt' => _LIST_PLUGS_OPTIONS,
\r
641 $data['plugoptsetting'] = Template::fill($subTpl, $subData);
\r
645 $data['plugoptsetting'] = '';
\r
649 if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_FOOT']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_FOOT']) )
\r
651 $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_FOOT'];
\r
660 return Template::fill($template, $data);
\r
663 function listplug_table_plugoptionlist($vars, $type, $templateName = '')
\r
666 $templates = array();
\r
667 if ( !empty($templateName) )
\r
669 $templates = Template::read($templateName);
\r
674 if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_POPTLIST_HEAD']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_POPTLIST_HEAD']) )
\r
676 $template = $templates['SHOWLIST_LISTPLUG_TABLE_POPTLIST_HEAD'];
\r
680 $template = "<th><%colinfo%></th><th><%colvalue%></th>\n";
\r
683 'colinfo' => _LISTS_INFO,
\r
684 'colvalue' => _LISTS_VALUE,
\r
688 $current = $vars['current'];
\r
689 $template = listplug_plugOptionRow($current, $templateName);
\r
693 if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_POPTLIST_FOOT']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_POPTLIST_FOOT']) )
\r
695 $template = $templates['SHOWLIST_LISTPLUG_TABLE_POPTLIST_FOOT'];
\r
699 $template = "<tr>\n"
\r
700 . "<th colspan=\"2\"><%savetext%></th>"
\r
701 . "<th colspan=\"2\"><%savetext%></th>"
\r
702 . "<td><input type=\"submit\" value=\"<%savetext%>\" /></td>"
\r
706 'savetext' => _PLUGS_SAVE,
\r
710 return Template::fill($template, $data);
\r
713 function listplug_plugOptionRow($current, $templateName = '')
\r
715 $templates = array();
\r
716 if ( !empty($templateName) )
\r
718 $templates = Template::read($templateName);
\r
720 $varname = "plugoption[{$current['oid']}][{$current['contextid']}]";
\r
722 // retreive the optionmeta
\r
723 $meta = NucleusPlugin::getOptionMeta($current['typeinfo']);
\r
725 // only if it is not a hidden option write the controls to the page
\r
726 if ( in_array('access', $meta) && $meta['access'] == 'hidden' )
\r
732 if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_POPTLIST_BODY']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_POPTLIST_BODY']) )
\r
734 $template = $templates['SHOWLIST_LISTPLUG_TABLE_POPTLIST_BODY'];
\r
738 $template = "<td><%description%></td>\n<td>\n";
\r
741 switch($current['type'])
\r
744 $template .= AdminActions::input_yesno($varname, $current['value'], 0, 'yes', 'no', _YES, _NO, 0, $templateName, 1);
\r
747 if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OPWORD']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OPWORD']) )
\r
749 $template .= $templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OPWORD'];
\r
753 $template .= "<input type=\"password\" size=\"40\" maxlength=\"128\" name=\"<%varname%>\" value=\"<%value%>\" />\n";
\r
756 'varname' => Entity::hsc($varname),
\r
757 'value' => Entity::hsc($current['value']),
\r
761 if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEP']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEP']) )
\r
763 $template .= $templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEP'];
\r
767 $template .= "<select name=\"<%varname%>\">\n";
\r
769 if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEO']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEO']) )
\r
771 $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEO'];
\r
775 $subTpl = "<option value=\"<%value%>\"<%selected%>><%optname%></option>\n";
\r
777 $options = NucleusPlugin::getOptionSelectValues($current['typeinfo']);
\r
778 $options = i18n::explode('|', $options);
\r
780 for ( $i=0; $i<(count($options)-1); $i+=2 )
\r
783 'optname' => Entity::hsc($options[$i]),
\r
784 'value' => Entity::hsc($options[$i+1])
\r
786 if ($options[$i+1] == $current['value'])
\r
788 $subData['selected'] = ' selected="selected"';
\r
792 $subData['selected'] = '';
\r
794 $template .= Template::fill($subTpl, $subData);
\r
796 if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEC']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEC']) )
\r
798 $template .= $templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEC'];
\r
802 $template .= "</select>\n";
\r
804 $data['varname'] = Entity::hsc($varname);
\r
807 if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OTAREA']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OTAREA']) )
\r
809 $template .= $templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OTAREA'];
\r
813 $template .= "<textarea class=\"pluginoption\" cols=\"30\" rows=\"5\" name=\"<%varname%>\"<%readonly%>><%value%></textarea>";
\r
816 'varname' => Entity::hsc($varname),
\r
817 'value' => Entity::hsc($current['value'])
\r
819 if ( array_key_exists('access', $current) && $current['access'] == 'readonly')
\r
821 $data['readonly'] = ' readonly="readonly"';
\r
825 $data['readonly'] = '';
\r
830 if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OITEXT']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OITEXT']) )
\r
832 $template .= $templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OITEXT'];
\r
836 $template .= "<input type=\"text\" size=\"40\" maxlength=\"128\" name=\"<%varname%>\" value=\"<%value%>\"<%datatype%><%readonly%> />\n";
\r
839 'varname' => Entity::hsc($varname),
\r
840 'value' => Entity::hsc($current['value'])
\r
842 if ( array_key_exists('datatype', $current) && $current['datatype'] == 'numerical')
\r
844 $data['datatype'] = ' onkeyup="checkNumeric(this)" onblur="checkNumeric(this)"';
\r
848 $data['datatype'] = '';
\r
850 if ( array_key_exists('access', $current) && $current['access'] == 'readonly')
\r
852 $data['readonly'] = ' readonly="readonly"';
\r
856 $data['readonly'] = '';
\r
859 if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_PLUGOPTN_FOOT']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGOPTN_FOOT']) )
\r
861 $template .= $templates['SHOWLIST_LISTPLUG_TABLE_PLUGOPTN_FOOT'];
\r
865 $template .= "<%extra%></td>\n";
\r
867 $data['extra'] = isset($current['extra']) ? $current['extra'] : '';
\r
868 $data['description'] = $current['description'] ? Entity::hsc($current['description']) : Entity::hsc($current['name']);
\r
870 return Template::fill($template, $data, 1);
\r
873 function listplug_table_itemlist($vars, $type, $templateName = '')
\r
876 $templates = array();
\r
877 if ( !empty($templateName) )
\r
879 $templates = Template::read($templateName);
\r
885 if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_ITEMLIST_HEAD']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_ITEMLIST_HEAD']) )
\r
887 $template = $templates['SHOWLIST_LISTPLUG_TABLE_ITEMLIST_HEAD'];
\r
891 $template = "<th><%colinfo%></th><th><%colcontent%></th><th style=\"white-space:nowrap\"><%colaction%></th>\n";
\r
894 'colinfo' => _LIST_ITEM_INFO,
\r
895 'colcontent' => _LIST_ITEM_CONTENT,
\r
896 'colaction' => _LISTS_ACTIONS
\r
900 $current = $vars['current'];
\r
901 // string -> unix timestamp
\r
902 $current->itime = strtotime($current->itime);
\r
903 if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_ITEMLIST_BODY']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_ITEMLIST_BODY']) )
\r
905 $template = $templates['SHOWLIST_LISTPLUG_TABLE_ITEMLIST_BODY'];
\r
909 $template = "<td<%cssclass%>>\n"
\r
910 . "<%bshortlabel%> <%bshortnameval%><br />\n"
\r
911 . "<%categorylabel%> <%categorynameval%><br />\n"
\r
912 . "<%authorlabel%> <%authornameval%><br />\n"
\r
913 . "<%itemdatelabel%> <%itemdateval%><br />\n"
\r
914 . "<%itemtimelabel%> <%itemtimeval%>\n"
\r
916 . "<input type=\"checkbox\" id=\"batch<%batchid%>\" name=\"batch<%batchid%>\" value=\"<%itemid%>\" />\n"
\r
917 . "<label for=\"batch<%batchid%>\"><b><%itemtitle%></b></label><br />\n"
\r
918 . "<a href=\"index.php?action=itemedit&itemid=<%itemid%>\"><%editbtn%></a><br />\n"
\r
920 . "<a href=\"index.php?action=itemmove&itemid=<%itemid%>\"><%movebtn%></a><br />\n"
\r
921 . "<a href=\"index.php?action=itemdelete&itemid=<%itemid%>\"><%delbtn%></a><br />\n"
\r
926 if ( $current->idraft == 1 )
\r
928 $cssclass = ' class="draft"';
\r
931 // (can't use offset time since offsets might vary between blogs)
\r
932 if ( $current->itime > $vars['now'] )
\r
934 $cssclass = ' class="future"';
\r
936 $body = strip_tags($current->ibody);
\r
938 'cssclass' => $cssclass,
\r
939 'bshortlabel' => _LIST_ITEM_BLOG,
\r
940 'bshortnameval' => Entity::hsc($current->bshortname),
\r
941 'categorylabel' => _LIST_ITEM_CAT,
\r
942 'categorynameval' => Entity::hsc($current->cname),
\r
943 'authorlabel' => _LIST_ITEM_AUTHOR,
\r
944 'authornameval' => Entity::hsc($current->mname),
\r
945 'itemdatelabel' => _LIST_ITEM_DATE,
\r
946 'itemdateval' => date("Y-m-d",$current->itime),
\r
947 'itemdatelabel' => _LIST_ITEM_TIME,
\r
948 'itemdateval' => date("H:i",$current->itime),
\r
949 'batchid' => listplug_nextBatchId(),
\r
950 'itemid' => $current->inumber,
\r
951 'itemtitle' => Entity::hsc(strip_tags($current->ititle)),
\r
952 'itembody' => Entity::hsc(Entity::shorten($body, 300, '...')),
\r
953 'editbtn' => _LISTS_EDIT,
\r
954 'movebtn' => _LISTS_MOVE,
\r
955 'delbtn' => _LISTS_DELETE,
\r
957 // evaluate amount of comments for the item
\r
958 $comment = new Comments($current->inumber);
\r
959 $camount = $comment->amountComments();
\r
960 if ( $camount > 0 )
\r
962 $data['camount'] = "<a href=\"index.php?action=itemcommentlist&itemid=\"{$current->inumber}\">(" . sprintf(_LIST_ITEM_COMMENTS, $comment->amountComments()) . ")</a><br />\n";
\r
966 echo "<li>" . _LIST_ITEM_NOCONTENT . "</li>\n";
\r
970 if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_ITEMLIST_FOOT']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_ITEMLIST_FOOT']) )
\r
972 $template = $templates['SHOWLIST_LISTPLUG_TABLE_ITEMLIST_FOOT'];
\r
981 return Template::fill($template, $data);
\r
984 // for batch operations: generates the index numbers for checkboxes
\r
985 function listplug_nextBatchId()
\r
991 function listplug_table_commentlist($vars, $type, $templateName = '')
\r
993 $templates = array();
\r
994 if ( !empty($templateName) )
\r
996 $templates = Template::read($templateName);
\r
1001 if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_HEAD']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_HEAD']) )
\r
1003 $template = $templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_HEAD'];
\r
1007 $template = "<th><%colinfo%></th>\n<th><%colcontent%></th>\n<th colspan=\"3\"><%colaction%></th>\n";
\r
1010 'colinfo' => _LISTS_INFO,
\r
1011 'colcontent' => _LIST_COMMENT,
\r
1012 'colaction' => _LISTS_ACTIONS
\r
1016 if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_BODY']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_BODY']) )
\r
1018 $template = $templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_BODY'];
\r
1022 $template = "<td><%commentdate%><br /><%commentator%><br /><%commentsite%><br /><%commentmail%><br /></td>\n"
\r
1023 . "<td><input type=\"checkbox\" id=\"batch<%batchid%>\" name=\"batch[<%batchid%>]\" value=\"<%commentid%>\" />"
\r
1024 . "<label for=\"batch<%batchid%>\"><%commentbody%></label></td>\n"
\r
1025 . "<td style=\"white-space:nowrap\">"
\r
1026 . "<a href=\"index.php?action=commentedit&commentid=<%commentid%>\"><%editbtn%></a></td>\n"
\r
1027 . "<td style=\"white-space:nowrap\">"
\r
1028 . "<a href=\"index.php?action=commentdelete&commentid=<%commentid%>\"><%delbtn%></a></td>\n"
\r
1029 . "<%addbanlist%>";
\r
1031 $current = $vars['current'];
\r
1032 $body = strip_tags($current->cbody);
\r
1034 'commentdate' => date("Y-m-d@H:i", strtotime($current->ctime)),
\r
1035 'batchid' => listplug_nextBatchId(),
\r
1036 'commentid' => $current->cnumber,
\r
1037 'commentbody' => Entity::hsc(Entity::shorten($current->cbody, 300, '...')),
\r
1038 'editbtn' => _LISTS_EDIT,
\r
1039 'delbtn' => _LISTS_DELETE,
\r
1041 if ( isset($current->mname) )
\r
1043 $data['commentator'] = Entity::hsc($current->mname) . ' ' . _LIST_COMMENTS_MEMBER;
\r
1047 $data['commentator'] = Entity::hsc($current->cuser);
\r
1049 if ( isset($current->cmail) && $current->cmail )
\r
1051 $data['commentsite'] = Entity::hsc($current->cmail);
\r
1055 $data['commentsite'] = '';
\r
1057 if ( isset($current->cemail) && $current->cemail )
\r
1059 $data['commentmail'] = Entity::hsc($current->cemail);
\r
1063 $data['commentmail'] = '';
\r
1065 if ( $vars['canAddBan'] )
\r
1067 if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_ABAN']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_ABAN']) )
\r
1069 $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_ABAN'];
\r
1073 $subTpl = "<td style=\"white-space:nowrap\"><a href=\"index.php?action=banlistnewfromitem&itemid=<%itemid%>&ip=<%banip%>\" title=\"<%banhost%>\"><%banbtn%></a></td>\n";
\r
1076 'itemid' => $current->citem,
\r
1077 'banip' => Entity::hsc($current->cip),
\r
1078 'banbtn' => _LIST_COMMENT_BANIP,
\r
1080 $data['addbanlist'] = Template::fill($subTpl, $subData);
\r
1084 if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_FOOT']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_FOOT']) )
\r
1086 $template = $templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_FOOT'];
\r
1092 $subData = array();
\r
1095 return Template::fill($template, $data);
\r
1098 function listplug_table_bloglist($vars, $type, $templateName = '')
\r
1100 $templates = array();
\r
1101 if ( !empty($templateName) )
\r
1103 $templates = Template::read($templateName);
\r
1108 if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_BLOGLIST_HEAD']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_BLOGLIST_HEAD']) )
\r
1110 $template = $templates['SHOWLIST_LISTPLUG_TABLE_BLOGLIST_HEAD'];
\r
1114 $template = "<th><%blognames%></th>\n<th colspan=\"7\"><%actionshead%></th>\n";
\r
1117 'blognames' => _NAME,
\r
1118 'actionshead' => _LISTS_ACTIONS,
\r
1122 $current = $vars['current'];
\r
1123 if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_BLOGLIST_BODY']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_BLOGLIST_BODY']) )
\r
1125 $template = $templates['SHOWLIST_LISTPLUG_TABLE_BLOGLIST_BODY'];
\r
1129 $template = "<td title=\"blogid:<%blogid%> shortname:<%shortname%>\">\n"
\r
1130 . "<a href=\"<%blogurl%>\"><img src=\"images/globe.gif\" width=\"13\" height=\"13\" alt=\"<%iconalt%>\" /></a><%blogname%></td>\n"
\r
1131 . "<td><a href=\"index.php?action=createitem&blogid=<%blogid%>\" title=\"<%ttaddtext%>\"><%addtext%></a></td>\n"
\r
1132 . "<td><a href=\"index.php?action=itemlist&blogid=<%blogid%>\" title=\"<%ttedittext%>\"><%edittext%></a></td>\n"
\r
1133 . "<td><a href=\"index.php?action=blogcommentlist&blogid=<%blogid%>\" title=\"<%ttcommenttext%>\"><%commenttext%></a></td>\n"
\r
1134 . "<td><a href=\"index.php?action=bookmarklet&blogid=<%blogid%>\" title=\"<%ttbmlettext%>\"><%bmlettext%></a></td>\n";
\r
1137 'blogid' => $current->bnumber,
\r
1138 'shortname' => Entity::hsc($current->bshortname),
\r
1139 'blogurl' => $current->burl,
\r
1140 'blogname' => Entity::hsc($current->bname),
\r
1141 'ttaddtext' => _BLOGLIST_TT_ADD,
\r
1142 'addtext' => _BLOGLIST_ADD,
\r
1143 'ttedittext' => _BLOGLIST_TT_EDIT,
\r
1144 'edittext' => _BLOGLIST_EDIT,
\r
1145 'ttcommenttext' => _BLOGLIST_TT_COMMENTS,
\r
1146 'commenttext' => _BLOGLIST_COMMENTS,
\r
1147 'ttbmlettext' => _BLOGLIST_TT_BMLET,
\r
1148 'bmlettext' => _BLOGLIST_BMLET,
\r
1150 if ( $current->tadmin == 1 )
\r
1152 if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_BLIST_BD_TADM']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_BLIST_BD_TADM']) )
\r
1154 $template .= $templates['SHOWLIST_LISTPLUG_TABLE_BLIST_BD_TADM'];
\r
1158 $template .= "<td><a href=\"index.php?action=blogsettings&blogid=<%blogid%>\" title=\"<%ttsettingtext%>\"><%settingtext%></a></td>\n"
\r
1159 . "<td><a href=\"index.php?action=banlist&blogid=<%blogid%>\" title=\"<%ttbanstext%>\"><%banstext%></a></td>\n";
\r
1161 $data['ttsettingtext'] = _BLOGLIST_TT_SETTINGS;
\r
1162 $data['settingtext'] = _BLOGLIST_SETTINGS;
\r
1163 $data['ttbanstext'] = _BLOGLIST_TT_BANS;
\r
1164 $data['banstext'] = _BLOGLIST_BANS;
\r
1167 if ( $vars['superadmin'] )
\r
1169 if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_BLIST_BD_TADM']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_BLIST_BD_TADM']) )
\r
1171 $template .= $templates['SHOWLIST_LISTPLUG_TABLE_BLIST_BD_TADM'];
\r
1175 $template .= "<td><a href=\"index.php?action=deleteblog&blogid=<%blogid%>\" title=\"<%ttdeletetext%>\"></a><%deletetext%></td>\n";
\r
1177 $data['ttdeletetext'] = _BLOGLIST_TT_DELETE;
\r
1178 $data['deletetext'] = _BLOGLIST_DELETE;
\r
1182 $current = $vars['current'];
\r
1183 if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_BLOGLIST_FOOT']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_BLOGLIST_FOOT']) )
\r
1185 $template = $templates['SHOWLIST_LISTPLUG_TABLE_BLOGLIST_FOOT'];
\r
1194 return Template::fill($template, $data);
\r
1197 function listplug_table_shortblognames($vars, $type, $templateName = '')
\r
1199 $templates = array();
\r
1200 if ( !empty($templateName) )
\r
1202 $templates = Template::read($templateName);
\r
1207 if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_HEAD']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_HEAD']) )
\r
1209 $template = $templates['SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_HEAD'];
\r
1213 $template = "<th><%colshortname%></th>\n<th><%colblogname%></th>\n";
\r
1216 'colshortname' => _EBLOG_SHORTNAME,
\r
1217 'colblogname' => _EBLOG_NAME,
\r
1221 $current = $vars['current'];
\r
1222 if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_BODY']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_BODY']) )
\r
1224 $template = $templates['SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_BODY'];
\r
1228 $template = "<td><%bshortname%></td>\n<td><%blogname%></td>\n";
\r
1231 'bshortname' => Entity::hsc($current->bshortname),
\r
1232 'blogname' => Entity::hsc($current->bname),
\r
1236 $current = $vars['current'];
\r
1237 if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_FOOT']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_FOOT']) )
\r
1239 $template = $templates['SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_FOOT'];
\r
1248 return Template::fill($template, $data);
\r
1251 function listplug_table_shortnames($vars, $type, $templateName = '')
\r
1253 $templates = array();
\r
1254 if ( !empty($templateName) )
\r
1256 $templates = Template::read($templateName);
\r
1261 if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_SHORTNAM_HEAD']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_SHORTNAM_HEAD']) )
\r
1263 $template = $templates['SHOWLIST_LISTPLUG_TABLE_SHORTNAM_HEAD'];
\r
1267 $template = "<th><%colname%></th><th><%coldesc%></th>\n";
\r
1270 'colname' => _NAME,
\r
1271 'coldesc' => _LISTS_DESC,
\r
1275 $current = $vars['current'];
\r
1276 if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_SHORTNAM_BODY']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_SHORTNAM_BODY']) )
\r
1278 $template = $templates['SHOWLIST_LISTPLUG_TABLE_SHORTNAM_BODY'];
\r
1282 $template = "<td><%name%></td><td><%desc%></td>\n";
\r
1285 'name' => Entity::hsc($current->name),
\r
1286 'desc' => Entity::hsc($current->description),
\r
1290 $current = $vars['current'];
\r
1291 if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_SHORTNAM_FOOT']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_SHORTNAM_FOOT']) )
\r
1293 $template = $templates['SHOWLIST_LISTPLUG_TABLE_SHORTNAM_FOOT'];
\r
1302 return Template::fill($template, $data);
\r
1305 function listplug_table_categorylist($vars, $type, $templateName = '')
\r
1307 $templates = array();
\r
1308 if ( !empty($templateName) )
\r
1310 $templates = Template::read($templateName);
\r
1315 if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_CATELIST_HEAD']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_CATELIST_HEAD']) )
\r
1317 $template = $templates['SHOWLIST_LISTPLUG_TABLE_CATELIST_HEAD'];
\r
1321 $template = "<th><%colname%></th><th><%coldesc%></th><th colspan=\"2\"><%colact%></th>\n";
\r
1324 'colname' => _LISTS_NAME,
\r
1325 'coldesc' => _LISTS_DESC,
\r
1326 'colact' => _LISTS_ACTIONS,
\r
1330 $current = $vars['current'];
\r
1331 if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_CATELIST_BODY']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_CATELIST_BODY']) )
\r
1333 $template = $templates['SHOWLIST_LISTPLUG_TABLE_CATELIST_BODY'];
\r
1337 $template = "<td>\n"
\r
1338 . "<input type=\"checkbox\" id=\"batch<%batchid%>\" name=\"batch[<%batchid%>]\" value=\"<%catid%>\" />\n"
\r
1339 . "<label for=\"batch<%batchid%>\"><%catname%></label>\n"
\r
1341 . "<td><%catdesc%></td>\n"
\r
1342 . "<td><a href=\"index.php?action=categoryedit&blogid=<%blogid%>&catid=<%catid%>\" tabindex=\"<%tabindex%>\"><%editbtn%></a></td>\n"
\r
1343 . "<td><a href=\"index.php?action=categorydelete&blogid=<%blogid%>&catid=<%catid%>\" tabindex=\"<%tabindex%>\"><%delbtn%></a></td>\n";
\r
1346 'batchid' => listplug_nextBatchId(),
\r
1347 'catid' => intval($current->catid),
\r
1348 'catname' => Entity::hsc($current->cname),
\r
1349 'catdesc' => Entity::hsc($current->cdesc),
\r
1350 'blogid' => intval($current->catcblogid),
\r
1351 'tabindex' => intval($vars['tabindex']),
\r
1352 'editbtn' => _LISTS_EDIT,
\r
1353 'delbtn' => _LISTS_DELETE,
\r
1357 if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_CATELIST_FOOT']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_CATELIST_FOOT']) )
\r
1359 $template = $templates['SHOWLIST_LISTPLUG_TABLE_CATELIST_FOOT'];
\r
1368 return Template::fill($template, $data);
\r
1371 function listplug_table_templatelist($vars, $type, $templateName = '')
\r
1373 $templates = array();
\r
1374 if ( !empty($templateName) )
\r
1376 $templates = Template::read($templateName);
\r
1382 if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_HEAD']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_HEAD']) )
\r
1384 $template = $templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_HEAD'];
\r
1388 $template = "<th><%colname%></th><th><%coldesc%></th><th colspan=\"3\"><%colact%></th>\n";
\r
1391 'colname' => _LISTS_NAME,
\r
1392 'coldesc' => _LISTS_DESC,
\r
1393 'colact' => _LISTS_ACTIONS,
\r
1397 $current = $vars['current'];
\r
1398 if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_BODY']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_BODY']) )
\r
1400 $template = $templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_BODY'];
\r
1404 $template = "<td><%templatename%></td>\n"
\r
1405 . "<td><%templatedesc%></td>\n"
\r
1406 . "<td style=\"white-space:nowrap\">"
\r
1407 . "<a href=\"index.php?action=templateedit&templateid=<%templateid%>\" tabindex=\"<%tabindex%>\"><%editbtn%></a>\n"
\r
1409 . "<td style=\"white-space:nowrap\">\n"
\r
1410 . "<a href=\"<%cloneurl%>\" tabindex=\"<%tabindex%>\"><%clonebtn%></a>\n"
\r
1412 . "<td style=\"white-space:nowrap\">\n"
\r
1413 . "<a href=\"index.php?action=templatedelete&templateid=<%templateid%>\" tabindex=\"<%tabindex%>\"><%delbtn%></a>\n"
\r
1416 $url = "index.php?action=templateclone&templateid={$current->tdnumber}";
\r
1418 'templatename' => Entity::hsc($current->tdname),
\r
1419 'templatedesc' => Entity::hsc($current->tddesc),
\r
1420 'templateid' => (integer) $current->tdnumber,
\r
1421 'tabindex' => (integer) $vars['tabindex'],
\r
1422 'cloneurl' => Entity::hsc($manager->addTicketToUrl($url)),
\r
1423 'editbtn' => _LISTS_EDIT,
\r
1424 'clonebtn' => _LISTS_CLONE,
\r
1425 'delbtn' => _LISTS_DELETE,
\r
1429 if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_FOOT']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_FOOT']) )
\r
1431 $template = $templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_FOOT'];
\r
1440 return Template::fill($template, $data);
\r
1443 function listplug_table_skinlist($vars, $type, $templateName = '')
\r
1445 $templates = array();
\r
1446 if ( !empty($templateName) )
\r
1448 $templates = Template::read($templateName);
\r
1450 global $CONF, $DIR_SKINS, $manager;
\r
1454 if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_HEAD']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_HEAD']) )
\r
1456 $template = $templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_HEAD'];
\r
1460 $template = "<th><%colname%></th><th><%coldesc%></th><th colspan=\"3\"><%colact%></th>\n";
\r
1463 'colname' => _LISTS_NAME,
\r
1464 'coldesc' => _LISTS_DESC,
\r
1465 'colact' => _LISTS_ACTIONS,
\r
1469 $current = $vars['current'];
\r
1470 if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_BODY']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_BODY']) )
\r
1472 $template = $templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_BODY'];
\r
1476 $template = "<td><%skinname%><br /><br />\n"
\r
1477 . "<%skintypelabel%> <%skintype%><br />\n"
\r
1478 . "<%incmodelabel%> <%incmode%><br />\n"
\r
1479 . "<%incpreflabel%> <%incpref%><br />\n"
\r
1481 . "<%readme%></td>\n"
\r
1482 . "<td class=\"availableSkinTypes\"><%skindesc%><%skinparts%></td>\n"
\r
1483 . "<td style=\"white-space:nowrap\">"
\r
1484 . "<a href=\"index.php?action=skinedit&skinid=<%skinid%>\" tabindex=\"<%tabindex%>\"><%editbtn%>"
\r
1486 . "<td style=\"white-space:nowrap\">"
\r
1487 . "<a href=\"<%cloneurl%>\" tabindex=\"<%tabindex%>\"><%clonebtn%>"
\r
1489 . "<td style=\"white-space:nowrap\">"
\r
1490 . "<a href=\"index.php?action=skindelete&skinid=<%skinid%>\" tabindex=\"<%tabindex%>\"><%delbtn%>"
\r
1493 $url = $manager->addTicketToUrl('index.php?action=skinclone&skinid=' . intval($current->sdnumber));
\r
1495 'skintypelabel' => _LISTS_TYPE,
\r
1496 'skintype' => Entity::hsc($current->sdtype),
\r
1497 'incmodelabel' => _LIST_SKINS_INCMODE,
\r
1498 'incmode' => ($current->sdincmode == 'skindir') ? _PARSER_INCMODE_SKINDIR : _PARSER_INCMODE_NORMAL,
\r
1499 'incpreflabel' => ($current->sdincpref) ? _LIST_SKINS_INCMODE : '',
\r
1500 'incpref' => ($current->sdincpref) ? Entity::hsc($current->sdincpref) : '',
\r
1501 'skindesc' => Entity::hsc($current->sddesc),
\r
1502 'skinid' => (integer) $current->sdnumber,
\r
1503 'tabindex' => $vars['tabindex'],
\r
1504 'cloneurl' => Entity::hsc($url),
\r
1505 'editbtn' => _LISTS_EDIT,
\r
1506 'clonebtn' => _LISTS_CLONE,
\r
1507 'delbtn' => _LISTS_DELETE,
\r
1509 // use a special style for the default skin
\r
1510 if ( $current->sdnumber == $CONF['BaseSkin'] )
\r
1512 $data['skinname'] = '<strong>' . Entity::hsc($current->sdname) . '</strong>';
\r
1516 $data['skinname'] = Entity::hsc($current->sdname);
\r
1519 // add preview image when present
\r
1520 if ( $current->sdincpref && @file_exists("{$DIR_SKINS}{$current->sdincpref}preview.png") )
\r
1522 $data['skinthumb'] = "<p>\n";
\r
1524 $alternatve_text = sprintf(_LIST_SKIN_PREVIEW, $current->sdname);
\r
1525 $has_enlargement = @file_exists($DIR_SKINS . $current->sdincpref . 'preview-large.png');
\r
1526 if ( $has_enlargement )
\r
1528 $data['skinthumb'] .= '<a href="' . $CONF['SkinsURL'] . Entity::hsc($current->sdincpref) . 'preview-large.png" title="' . _LIST_SKIN_PREVIEW_VIEWLARGER . "\">\n";
\r
1530 $data['skinthumb'] .= '<img class="skinpreview" src="' . $CONF['SkinsURL'] . Entity::hsc($current->sdincpref) . 'preview.png" width="100" height="75" alt="' . $alternatve_text . "\" />\n";
\r
1531 if ( $has_enlargement )
\r
1533 $data['skinthumb'] .= "</a><br />\n";
\r
1536 if ( @file_exists("{$DIR_SKINS}{$current->sdincpref}readme.html") )
\r
1538 $url = $CONF['SkinsURL'] . Entity::hsc($current->sdincpref) . 'readme.html';
\r
1539 $title = sprintf(_LIST_SKIN_README, $current->sdname);
\r
1540 $data['readme'] = "<a href=\"{$url}\" title=\"{$title}\">" . _LIST_SKIN_README_TXT . "</a>\n";
\r
1544 $data['readme'] ="";
\r
1547 $data['skinthumb'] .= "</p>\n";
\r
1549 /* show list of defined parts */
\r
1550 $query = "SELECT stype FROM %s WHERE sdesc=%d ORDER BY stype";
\r
1551 $query = sprintf($query, sql_table('skin'), $current->sdnumber);
\r
1552 $r = sql_query($query);
\r
1555 while ( $o = sql_fetch_object($r) )
\r
1557 array_push($types, $o->stype);
\r
1559 if ( sizeof($types) > 0 )
\r
1561 for ( $i = 0; $i < sizeof($types); $i++ )
\r
1563 $type = $types[$i];
\r
1564 if ( !array_key_exists($type, $template['friendly_names']) || $type == strtolower($template['friendly_names'][$type]) )
\r
1566 $article = 'skinpartspecial';
\r
1570 $article = "skinpart{$type}";
\r
1572 $types[$i] = "<li>\n"
\r
1573 . helpHtml($article) . "\n"
\r
1574 . "<a href=\"index.php?action=skinedittype&skinid={$current->sdnumber}&type={$type}\" tabindex=\"{$template['tabindex']}\">"
\r
1575 . Entity::hsc($template['friendly_names'][$type])
\r
1579 $data['skinparts'] = '<br /><br />' . _LIST_SKINS_DEFINED . "<ul>\n" . implode($types, '') . "</ul>\n";
\r
1583 $data['skinparts'] = '';
\r
1587 if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_FOOT']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_FOOT']) )
\r
1589 $template = $templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_FOOT'];
\r
1598 return Template::fill($template, $data);
\r
1601 function listplug_table_draftlist($vars, $type, $templateName = '')
\r
1603 $templates = array();
\r
1604 if ( !empty($templateName) )
\r
1606 $templates = Template::read($templateName);
\r
1611 if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_DRFTLIST_HEAD']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_DRFTLIST_HEAD']) )
\r
1613 $template = $templates['SHOWLIST_LISTPLUG_TABLE_DRFTLIST_HEAD'];
\r
1617 $template = "<th><%colblog%></th><th><%coldesc%></th><th colspan=\"2\"><%colact%></th>\n";
\r
1620 'colblog' => _LISTS_BLOG,
\r
1621 'coldesc' => _LISTS_TITLE,
\r
1622 'colact' => _LISTS_ACTIONS,
\r
1626 $current = $vars['current'];
\r
1627 if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_DRFTLIST_BODY']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_DRFTLIST_BODY']) )
\r
1629 $template = $templates['SHOWLIST_LISTPLUG_TABLE_DRFTLIST_BODY'];
\r
1633 $template = "<td><%bshortname%></td>\n"
\r
1634 . "<td><%ititle%></td>\n"
\r
1635 . "<td><a href=\"index.php?action=itemedit&itemid=<%itemid%>\"><%editbtn%></a></td>\n"
\r
1636 . "<td><a href=\"index.php?action=itemdelete&itemid=<%itemid%>\"><%delbtn%></a></td>\n";
\r
1639 'bshortname' => Entity::hsc($current->bshortname),
\r
1640 'ititle' => Entity::hsc(strip_tags($current->ititle)),
\r
1641 'itemid' => intval($current->inumber),
\r
1642 'editbtn' => _LISTS_EDIT,
\r
1643 'delbtn' => _LISTS_DELETE,
\r
1647 if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_DRFTLIST_FOOT']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_DRFTLIST_FOOT']) )
\r
1649 $template = $templates['SHOWLIST_LISTPLUG_TABLE_DRFTLIST_FOOT'];
\r
1658 return Template::fill($template, $data);
\r
1661 function listplug_table_otherdraftlist($vars, $type, $templateName = '')
\r
1663 $templates = array();
\r
1664 if ( !empty($templateName) )
\r
1666 $templates = Template::read($templateName);
\r
1671 if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_HEAD']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_HEAD']) )
\r
1673 $template = $templates['SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_HEAD'];
\r
1677 $template = "<th><%colblog%></th><th><%coldesc%></th><th><%colautr%></th><th colspan=\"2\"><%colact%></th>\n";
\r
1680 'colblog' => _LISTS_BLOG,
\r
1681 'coldesc' => _LISTS_TITLE,
\r
1682 'colautr' => _LISTS_AUTHOR,
\r
1683 'colact' => _LISTS_ACTIONS,
\r
1687 $current = $vars['current'];
\r
1688 if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_BODY']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_BODY']) )
\r
1690 $template = $templates['SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_BODY'];
\r
1694 $template = "<td><%bshortname%></td>\n"
\r
1695 . "<td><%ititle%></td>\n"
\r
1696 . "<td><%iauthor%></td>\n"
\r
1697 . "<td><a href=\"index.php?action=itemedit&itemid=<%itemid%>\"><%editbtn%></a></td>\n"
\r
1698 . "<td><a href=\"index.php?action=itemdelete&itemid=<%itemid%>\"><%delbtn%></a></td>\n";
\r
1701 'bshortname' => Entity::hsc($current->bshortname),
\r
1702 'ititle' => Entity::hsc(strip_tags($current->ititle)),
\r
1703 'iauthor' => Entity::hsc(strip_tags($current->mname)),
\r
1704 'itemid' => intval($current->inumber),
\r
1705 'editbtn' => _LISTS_EDIT,
\r
1706 'delbtn' => _LISTS_DELETE,
\r
1710 if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_FOOT']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_FOOT']) )
\r
1712 $template = $templates['SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_FOOT'];
\r
1721 return Template::fill($template, $data);
\r
1724 function listplug_table_actionlist($vars, $type, $templateName = '')
\r
1726 $templates = array();
\r
1727 if ( !empty($templateName) )
\r
1729 $templates = Template::read($templateName);
\r
1734 if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_ACTNLIST_HEAD']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_ACTNLIST_HEAD']) )
\r
1736 $template = $templates['SHOWLIST_LISTPLUG_TABLE_ACTNLIST_HEAD'];
\r
1740 $template = "<th><%coltime%></th><th><%colmesg%></th>\n";
\r
1743 'coltime' => _LISTS_TIME,
\r
1744 'colmesg' => _LIST_ACTION_MSG,
\r
1748 $current = $vars['current'];
\r
1749 if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_ACTNLIST_BODY']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_ACTNLIST_BODY']) )
\r
1751 $template = $templates['SHOWLIST_LISTPLUG_TABLE_ACTNLIST_BODY'];
\r
1755 $template = "<td><%timestamp%></td><td><%message%></td>\n";
\r
1758 'timestamp' => Entity::hsc($current->timestamp),
\r
1759 'message' => Entity::hsc($current->message),
\r
1763 $current = $vars['current'];
\r
1764 if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_ACTNLIST_FOOT']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_ACTNLIST_FOOT']) )
\r
1766 $template = $templates['SHOWLIST_LISTPLUG_TABLE_ACTNLIST_FOOT'];
\r
1775 return Template::fill($template, $data);
\r
1778 function listplug_table_banlist($vars, $type, $templateName = '')
\r
1780 $templates = array();
\r
1781 if ( !empty($templateName) )
\r
1783 $templates = Template::read($templateName);
\r
1788 if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_IBANLIST_HEAD']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_IBANLIST_HEAD']) )
\r
1790 $template = $templates['SHOWLIST_LISTPLUG_TABLE_IBANLIST_HEAD'];
\r
1794 $template = "<th><%iprange%></th><th><%reason%></th><th><%colact%></th>\n";
\r
1797 'iprange' => _LIST_BAN_IPRANGE,
\r
1798 'reason' => _LIST_BAN_REASON,
\r
1799 'colact' => _LISTS_ACTIONS,
\r
1803 $current = $vars['current'];
\r
1804 if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_IBANLIST_BODY']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_IBANLIST_BODY']) )
\r
1806 $template = $templates['SHOWLIST_LISTPLUG_TABLE_IBANLIST_BODY'];
\r
1810 $template = "<td><%iprange%></td>\n"
\r
1811 . "<td><%reason%></td>\n"
\r
1812 . "<td><a href=\"index.php?action=banlistdelete&blogid=<%blogid%>&iprange=<%iprange%>\"><%delbtn%></a></td>\n";
\r
1815 'iprange' => Entity::hsc($current->iprange),
\r
1816 'reason' => Entity::hsc($current->reason),
\r
1817 'blogid' => intval($current->blogid),
\r
1818 'delbtn' => _LISTS_DELETE,
\r
1822 $current = $vars['current'];
\r
1823 if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_IBANLIST_FOOT']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_IBANLIST_FOOT']) )
\r
1825 $template = $templates['SHOWLIST_LISTPLUG_TABLE_IBANLIST_FOOT'];
\r
1834 return Template::fill($template, $data);
\r
1837 function listplug_table_adminskinlist($vars, $type, $templateName = '')
\r
1839 global $CONF, $DIR_SKINS, $DIR_NUCLEUS, $manager;
\r
1840 $adminSkinURL = $CONF['AdminURL'] . 'adminskins/';
\r
1841 $adminSkinDir = $DIR_NUCLEUS . 'adminskins/';
\r
1842 $templates = array();
\r
1843 if ( !empty($templateName) )
\r
1845 $templates = Template::read($templateName);
\r
1850 if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_HEAD']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_HEAD']) )
\r
1852 $template = $templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_HEAD'];
\r
1856 $template = "<th><%colname%></th><th><%coldesc%></th><th colspan=\"3\"><%colact%></th>\n";
\r
1859 'colname' => _LISTS_NAME,
\r
1860 'coldesc' => _LISTS_DESC,
\r
1861 'colact' => _LISTS_ACTIONS,
\r
1865 $current = $vars['current'];
\r
1866 if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_BODY']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_BODY']) )
\r
1868 $template = $templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_BODY'];
\r
1872 $template = "<td><%skinname%><br /><br />\n"
\r
1873 . "<%skintypelabel%> <%skintype%><br />\n"
\r
1874 . "<%incmodelabel%> <%incmode%><br />\n"
\r
1875 . "<%incpreflabel%> <%incpref%><br />\n"
\r
1877 . "<%readme%></td>\n"
\r
1878 . "<td class=\"availableSkinTypes\"><%skindesc%><%skinparts%></td>\n"
\r
1879 . "<td style=\"white-space:nowrap\">"
\r
1880 . "<a href=\"index.php?action=skinedit&skinid=<%skinid%>\" tabindex=\"<%tabindex%>\"><%editbtn%>"
\r
1882 . "<td style=\"white-space:nowrap\">"
\r
1883 . "<a href=\"<%cloneurl%>\" tabindex=\"<%tabindex%>\"><%clonebtn%>"
\r
1885 . "<td style=\"white-space:nowrap\">"
\r
1886 . "<a href=\"index.php?action=skindelete&skinid=<%skinid%>\" tabindex=\"<%tabindex%>\"><%delbtn%>"
\r
1889 $url = $manager->addTicketToUrl('index.php?action=adminskinclone&skinid=' . intval($current->sdnumber));
\r
1891 'skintypelabel' => _LISTS_TYPE,
\r
1892 'skintype' => Entity::hsc($current->sdtype),
\r
1893 'incmodelabel' => _LIST_SKINS_INCMODE,
\r
1894 'incmode' => ($current->sdincmode == 'skindir') ? _PARSER_INCMODE_SKINDIR : _PARSER_INCMODE_NORMAL,
\r
1895 'incpreflabel' => ($current->sdincpref) ? _LIST_SKINS_INCMODE : '',
\r
1896 'incpref' => ($current->sdincpref) ? Entity::hsc($current->sdincpref) : '',
\r
1897 'skindesc' => Entity::hsc($current->sddesc),
\r
1898 'skinid' => (integer) $current->sdnumber,
\r
1899 'tabindex' => $vars['tabindex'],
\r
1900 'cloneurl' => Entity::hsc($url),
\r
1901 'editbtn' => _LISTS_EDIT,
\r
1902 'clonebtn' => _LISTS_CLONE,
\r
1903 'delbtn' => _LISTS_DELETE,
\r
1905 // use a special style for the default skin
\r
1906 if ( $current->sdnumber == $CONF['DefaultAdminSkin'] )
\r
1908 $data['skinname'] = '<strong>' . Entity::hsc($current->sdname) . '</strong>';
\r
1912 $data['skinname'] = Entity::hsc($current->sdname);
\r
1915 // add preview image when present
\r
1916 if ( $current->sdincpref && @file_exists("{$adminSkinDir}{$current->sdincpref}preview.png") )
\r
1918 $data['skinthumb'] = "<p>\n";
\r
1920 $alternatve_text = sprintf(_LIST_SKIN_PREVIEW, $current->sdname);
\r
1921 $has_enlargement = @file_exists($adminSkinDir . $current->sdincpref . 'preview-large.png');
\r
1922 if ( $has_enlargement )
\r
1924 $data['skinthumb'] .= '<a href="' . $adminSkinURL . Entity::hsc($current->sdincpref) . 'preview-large.png" title="' . _LIST_SKIN_PREVIEW_VIEWLARGER . "\">\n";
\r
1926 $data['skinthumb'] .= '<img class="skinpreview" src="' . $adminSkinURL . Entity::hsc($current->sdincpref) . 'preview.png" width="100" height="75" alt="' . $alternatve_text . "\" />\n";
\r
1927 if ( $has_enlargement )
\r
1929 $data['skinthumb'] .= "</a><br />\n";
\r
1932 if ( @file_exists("{$DIR_SKINS}{$current->sdincpref}readme.html") )
\r
1934 $url = $adminSkinURL . Entity::hsc($current->sdincpref) . 'readme.html';
\r
1935 $title = sprintf(_LIST_SKIN_README, $current->sdname);
\r
1936 $data['readme'] = "<a href=\"{$url}\" title=\"{$title}\">" . _LIST_SKIN_README_TXT . "</a>\n";
\r
1940 $data['readme'] ="";
\r
1943 $data['skinthumb'] .= "</p>\n";
\r
1945 /* show list of defined parts */
\r
1946 $query = "SELECT stype FROM %s WHERE sdesc=%d ORDER BY stype";
\r
1947 $query = sprintf($query, sql_table('skin'), $current->sdnumber);
\r
1948 $r = sql_query($query);
\r
1951 while ( $o = sql_fetch_object($r) )
\r
1953 array_push($types, $o->stype);
\r
1955 if ( sizeof($types) > 0 )
\r
1957 for ( $i = 0; $i < sizeof($types); $i++ )
\r
1959 $type = $types[$i];
\r
1960 if ( !in_array($type, $adminDefaultTypes) )
\r
1962 $article = 'skinpartspecial';
\r
1966 $article = "skinpart{$type}";
\r
1968 $types[$i] = "<li>\n"
\r
1969 . helpHtml($article) . "\n"
\r
1970 . "<a href=\"index.php?action=adminskinedittype&skinid={$current->sdnumber}&type={$type}\" tabindex=\"{$vars['tabindex']}\">"
\r
1971 . Entity::hsc($template['friendly_names'][$type])
\r
1975 $data['skinparts'] = '<br /><br />' . _LIST_SKINS_DEFINED . "<ul>\n" . implode($types, '') . "</ul>\n";
\r
1979 $data['skinparts'] = '';
\r
1983 if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_FOOT']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_FOOT']) )
\r
1985 $template = $templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_FOOT'];
\r
1994 return Template::fill($template, $data);
\r
1997 function listplug_table_admintemplatelist($vars, $type, $templateName = '')
\r
1999 $templates = array();
\r
2000 if ( !empty($templateName) )
\r
2002 $templates = Template::read($templateName);
\r
2008 if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_HEAD']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_HEAD']) )
\r
2010 $template = $templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_HEAD'];
\r
2014 $template = "<th><%colname%></th><th><%coldesc%></th><th colspan=\"3\"><%colact%></th>\n";
\r
2017 'colname' => _LISTS_NAME,
\r
2018 'coldesc' => _LISTS_DESC,
\r
2019 'colact' => _LISTS_ACTIONS,
\r
2023 $current = $vars['current'];
\r
2024 if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_BODY']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_BODY']) )
\r
2026 $template = $templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_BODY'];
\r
2030 $template = "<td><%templatename%></td>\n"
\r
2031 . "<td><%templatedesc%></td>\n"
\r
2032 . "<td style=\"white-space:nowrap\">"
\r
2033 . "<a href=\"index.php?action=admintemplateedit&templateid=<%templateid%>\" tabindex=\"<%tabindex%>\"><%editbtn%></a>\n"
\r
2035 . "<td style=\"white-space:nowrap\">\n"
\r
2036 . "<a href=\"<%cloneurl%>\" tabindex=\"<%tabindex%>\"><%clonebtn%></a>\n"
\r
2038 . "<td style=\"white-space:nowrap\">\n"
\r
2039 . "<a href=\"index.php?action=admintemplatedelete&templateid=<%templateid%>\" tabindex=\"<%tabindex%>\"><%delbtn%></a>\n"
\r
2042 $url = "index.php?action=admintemplateclone&templateid={$current->tdnumber}";
\r
2044 'templatename' => Entity::hsc($current->tdname),
\r
2045 'templatedesc' => Entity::hsc($current->tddesc),
\r
2046 'templateid' => (integer) $current->tdnumber,
\r
2047 'tabindex' => (integer) $vars['tabindex'],
\r
2048 'cloneurl' => Entity::hsc($manager->addTicketToUrl($url)),
\r
2049 'editbtn' => _LISTS_EDIT,
\r
2050 'clonebtn' => _LISTS_CLONE,
\r
2051 'delbtn' => _LISTS_DELETE,
\r
2055 if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_FOOT']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_FOOT']) )
\r
2057 $template = $templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_FOOT'];
\r
2066 return Template::fill($template, $data);
\r