\r
\r
// can take either an array of objects, or an SQL query\r
-function showlist($query, $type, $template, $templateName = '')\r
+function showlist($query, $type, $vars, $template_name = '')\r
{\r
- if ( is_array($query) )\r
+ $contents = '';\r
+ \r
+ /* count */\r
+ if ( is_string($query) )\r
{\r
- if ( sizeof($query) == 0 )\r
- {\r
- return 0;\r
- }\r
- \r
- call_user_func("listplug_{$type}", $template, 'HEAD', $templateName);\r
- \r
- foreach ( $query as $currentObj )\r
- {\r
- $template['current'] = $currentObj;\r
- call_user_func("listplug_{$type}", $template, 'BODY', $templateName);\r
- }\r
- \r
- call_user_func("listplug_{$type}", $template, 'FOOT', $templateName);\r
- \r
- return sizeof($query);\r
+ $resource = DB::getResult($query);\r
}\r
else\r
{\r
- $res = sql_query($query);\r
- \r
- // don't do anything if there are no results\r
- $numrows = sql_num_rows($res);\r
- if ( $numrows == 0 )\r
- {\r
- return 0;\r
- }\r
- call_user_func("listplug_{$type}", $template, 'HEAD', $templateName);\r
- \r
- while( $template['current'] = sql_fetch_object($res) )\r
- {\r
- call_user_func("listplug_{$type}", $template, 'BODY', $templateName);\r
- }\r
- \r
- call_user_func("listplug_{$type}", $template, 'FOOT', $templateName);\r
- \r
- sql_free_result($res);\r
- \r
- // return amount of results\r
- return $numrows;\r
+ $resource = $query;\r
+ }\r
+ \r
+ /* HEAD */\r
+ $contents .= call_user_func("listplug_{$type}", $vars, 'HEAD', $template_name);\r
+ \r
+ /* BODY */\r
+ foreach ( $resource as $row )\r
+ {\r
+ $vars['current'] = $row;\r
+ $contents .= call_user_func("listplug_{$type}", $vars, 'BODY', $template_name);\r
+ }\r
+ \r
+ /* FOOT */\r
+ $contents .= call_user_func("listplug_{$type}", $vars, 'FOOT', $template_name);\r
+ \r
+ /* close SQL resource */\r
+ if ( is_string($query) )\r
+ {\r
+ $resource->closeCursor();\r
}\r
+ \r
+ return $contents;\r
}\r
\r
-function listplug_select($vars, $type, $templateName = '')\r
+function listplug_select($vars, $type, $template_name = '')\r
{\r
+ global $manager;\r
+ \r
$templates = array();\r
- if ( !empty($templateName) )\r
+ if ( !empty($template_name) )\r
{\r
- $templates = Template::read($templateName);\r
+ $templates =& $manager->getTemplate($template_name);\r
}\r
+ \r
switch( $type )\r
{\r
case 'HEAD':\r
- if ( isset($templates['SHOWLIST_LISTPLUG_SELECT_HEAD']) || !empty($templates['SHOWLIST_LISTPLUG_SELECT_HEAD']) )\r
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_SELECT_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_SELECT_HEAD']) )\r
{\r
- $template = $templates['SHOWLIST_LISTPLUG_SELECT_HEAD'];\r
+ $template = "<select name=\"<%name%>\" tabindex=\"<%tabindex%>\" <%javascript%>>\n"\r
+ . "<%extraoption%>\n";\r
}\r
else\r
{\r
- $template = "<select<%name%><%tabindex%><%javascript%>>\n<%extraoption%>\n";\r
+ $template = $templates['SHOWLIST_LISTPLUG_SELECT_HEAD'];\r
}\r
$data = array(\r
- 'name' => isset($vars['name']) ? ' name="' . $vars['name'] . '"' : '',\r
- 'tabindex' => isset($vars['tabindex']) ? ' tabindex="' . $vars['tabindex'] . '"' : '',\r
- 'javascript' => isset($vars['javascript']) ? ' ' . $vars['javascript'] : '',\r
- );\r
- $data ['extraoption'] = isset($vars['extra']) ?\r
- '<option value="' . $vars['extra'] . '">' . $vars['extra'] . "</option>" :\r
- '';\r
+ 'name' => $vars['name'],\r
+ 'tabindex' => $vars['tabindex'],\r
+ 'javascript' => !array_key_exists('javascript', $vars) ? '' : $vars['javascript'],\r
+ 'extraoption' => !array_key_exists('extra', $vars) ? '' : "<option value=\"\">{$vars['extra']}</option>"\r
+ );\r
break;\r
case 'BODY':\r
$current = $vars['current'];\r
- if ( isset($templates['SHOWLIST_LISTPLUG_SELECT_BODY']) || !empty($templates['SHOWLIST_LISTPLUG_SELECT_BODY']) )\r
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_SELECT_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_SELECT_BODY']) )\r
{\r
- $template = $templates['SHOWLIST_LISTPLUG_SELECT_BODY'];\r
+ $template = "<option value=\"<%value%>\" <%selected%> title=\"<%title%>\"><%option%></option>\n";\r
}\r
else\r
{\r
- $template = '<option value="<%value%>"<%selected%><%title%>><%option%></option>' . "\n";\r
+ $template = $templates['SHOWLIST_LISTPLUG_SELECT_BODY'];\r
}\r
$data = array(\r
- 'value' => Entity::hsc($current->value),\r
- 'selected' => ($vars['selected'] == $current->value) ? ' selected="selected"' : '',\r
- );\r
- if ( isset($vars['shorten']) && $vars['shorten'] > 0 )\r
+ 'value' => Entity::hsc($current['value']),\r
+ 'selected' => ($vars['selected'] == $current['value']) ? 'selected="selected"' : '',\r
+ );\r
+ if ( array_key_exists('shorten', $vars) && $vars['shorten'] > 0 )\r
{\r
- $data['title'] = ' title="' . Entity::hsc($current->text) . '"';\r
- $current->text = Entity::hsc(Entity::shorten($current->text, $vars['shorten'], $vars['shortenel']));\r
+ $data['title'] = Entity::hsc($current['text']);\r
+ $data['option'] = Entity::hsc(Entity::shorten($current['text'], $vars['shorten'], $vars['shortenel']));\r
}\r
else\r
{\r
$data['title'] = '';\r
}\r
- $data['option'] = Entity::hsc($current->text);\r
+ $data['option'] = Entity::hsc($current['text']);\r
break;\r
case 'FOOT':\r
- if ( isset($templates['SHOWLIST_LISTPLUG_SELECT_FOOT']) || !empty($templates['SHOWLIST_LISTPLUG_SELECT_FOOT']) )\r
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_SELECT_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_SELECT_FOOT']) )\r
{\r
- $template = $templates['SHOWLIST_LISTPLUG_SELECT_FOOT'];\r
+ $template = "</select>\n";\r
}\r
else\r
{\r
- $template = "</select>\n";\r
+ $template = $templates['SHOWLIST_LISTPLUG_SELECT_FOOT'];\r
}\r
$data = array();\r
break;\r
}\r
- $template = Template::fill($template, $data);\r
- $handler = new Actions('template', $template, $data);\r
- $parser = new PARSER(Actions::getDefinedActions(), $handler);\r
- $parser->parse($template);\r
- return;\r
+ \r
+ return Template::fill($template, $data);\r
}\r
\r
-function listplug_table($vars, $type, $templateName = '')\r
+function listplug_table($vars, $type, $template_name = '')\r
{\r
+ global $manager;\r
+ \r
$templates = array();\r
- if ( !empty($templateName) )\r
+ if ( !empty($template_name) )\r
{\r
- $templates = Template::read($templateName);\r
+ $templates =& $manager->getTemplate($template_name);\r
}\r
+ \r
switch( $type )\r
{\r
case 'HEAD':\r
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_HEAD']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_HEAD']) )\r
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_HEAD']) )\r
{\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_HEAD'];\r
+ $template = "<table frame=\"box\" rules=\"all\" summary=\"{$template_name}\">\n"\r
+ . "<thead>\n"\r
+ . "<tr>\n"\r
+ . "<%typehead%>\n"\r
+ . "</tr>\n"\r
+ . "</thead>\n"\r
+ . "<tbody>\n";\r
}\r
else\r
{\r
- $template = "<table><thead><tr>\n<%typehead%>\n</tr></thead><tbody>\n";\r
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_HEAD'];\r
}\r
$data = array(\r
- 'typehead' => call_user_func("listplug_table_" . $vars['content'] , $vars, 'HEAD', $templateName)\r
- );\r
+ 'typehead' => call_user_func("listplug_table_" . $vars['content'] , $vars, 'HEAD', $template_name)\r
+ );\r
break;\r
case 'BODY':\r
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_BODY']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_BODY']) )\r
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_BODY']) )\r
{\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_BODY'];\r
+ $template = "<tr onmouseover=\"focusRow(this);\" onmouseout=\"blurRow(this);\">\n"\r
+ . "<%typebody%>\n"\r
+ . "</tr>\n";\r
}\r
else\r
{\r
- $template = "<tr onmouseover=\"focusRow(this);\" onmouseout=\"blurRow(this);\"><%typebody%>\n</tr>\n";\r
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_BODY'];\r
}\r
// tabletype specific thingies\r
$data = array(\r
- 'typebody' => call_user_func("listplug_table_" . $vars['content'] , $vars, 'BODY', $templateName)\r
+ 'typebody' => call_user_func("listplug_table_" . $vars['content'] , $vars, 'BODY', $template_name)\r
);\r
break;\r
case 'FOOT':\r
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_FOOT']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_FOOT']) )\r
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_FOOT']) )\r
{\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_FOOT'];\r
+ $template = "<%typefoot%>\n"\r
+ . "</tbody>\n"\r
+ . "</table>\n";\r
}\r
else\r
{\r
- $template = "<%typefoot%>\n</tbody></table>\n";\r
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_FOOT'];\r
}\r
// tabletype specific thingies\r
$data = array(\r
- 'typefoot' => call_user_func("listplug_table_" . $vars['content'] , $vars, 'FOOT', $templateName)\r
+ 'typefoot' => call_user_func("listplug_table_" . $vars['content'] , $vars, 'FOOT', $template_name)\r
);\r
break;\r
}\r
- $template = Template::fill($template, $data);\r
- $handler = new Actions('template', $template, $data);\r
- $parser = new PARSER(Actions::getDefinedActions(), $handler);\r
- $parser->parse($template);\r
- return;\r
+ \r
+ return Template::fill($template, $data);\r
}\r
\r
-function listplug_table_memberlist($vars, $type, $templateName = '')\r
+function listplug_table_memberlist($vars, $type, $template_name = '')\r
{\r
+ global $manager;\r
+ \r
$templates = array();\r
- if ( !empty($templateName) )\r
+ if ( !empty($template_name) )\r
{\r
- $templates = Template::read($templateName);\r
+ $templates =& $manager->getTemplate($template_name);\r
}\r
+ \r
switch( $type )\r
{\r
case 'HEAD':\r
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_MEMBLIST_HEAD']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_MEMBLIST_HEAD']) )\r
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_MEMBLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_MEMBLIST_HEAD']) )\r
{\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_MEMBLIST_HEAD'];\r
+ $template = "<th><%colmembername%></th>\n"\r
+ . "<th><%colmemberrname%></th>\n"\r
+ . "<th><%colmemberurl%></th>\n"\r
+ . "<th><%colmemberadmin%><%helplink(superadmin)%></th>\n"\r
+ . "<th><%colmemberlogin%><%helplink(canlogin)%></th>\n"\r
+ . "<th colspan=\"2\"><%colactions%></th>\n";\r
}\r
else\r
{\r
- $template = "<th><%colmembername%></th>\n"\r
- . "<th><%colmemberrname%></th>\n"\r
- . "<th><%colmemberurl%></th>\n"\r
- . "<th><%colmemberadmin%><%helplink(superadmin)%></th>\n"\r
- . "<th><%colmemberlogin%><%helplink(canlogin)%></th>\n"\r
- . "<th colspan=\"2\"><%colactions%></th>\n";\r
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_MEMBLIST_HEAD'];\r
}\r
$data = array(\r
- 'colmembername' => _LIST_MEMBER_NAME,\r
- 'colmemberrname' => _LIST_MEMBER_RNAME,\r
- 'colmemberurl' => _LIST_MEMBER_URL,\r
- 'colmemberadmin' => _LIST_MEMBER_ADMIN,\r
- 'colmemberlogin' => _LIST_MEMBER_LOGIN,\r
- 'colactions' => _LISTS_ACTIONS,\r
- );\r
+ 'colmembername' => _LIST_MEMBER_NAME,\r
+ 'colmemberrname' => _LIST_MEMBER_RNAME,\r
+ 'colmemberurl' => _LIST_MEMBER_URL,\r
+ 'colmemberadmin' => _LIST_MEMBER_ADMIN,\r
+ 'colmemberlogin' => _LIST_MEMBER_LOGIN,\r
+ 'colactions' => _LISTS_ACTIONS,\r
+ );\r
break;\r
case 'BODY':\r
$current = $vars['current'];\r
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_MEMBLIST_BODY']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_MEMBLIST_BODY']) )\r
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_MEMBLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_MEMBLIST_BODY']) )\r
{\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_MEMBLIST_BODY'];\r
+ $template = "<td>\n"\r
+ . "<input type=\"checkbox\" id=\"batch<%id%>\" name=\"batch[<%id%>]\" value=\"<%memberid%>\" />\n"\r
+ . "<label for=\"batch<%id%>\">\n"\r
+ . "<a href=\"mailto:<%mailaddress%>\" tabindex=\"<%tabindex%>\"><%name%></a>\n"\r
+ . "</label>\n</td>\n"\r
+ . "<td><%realname%></td>\n"\r
+ . "<td><a href=\"<%url%>\" tabindex=\"<%tabindex%>\"><%url%></a></td>\n"\r
+ . "<td><%admin%></td>\n"\r
+ . "<td><%login%></td>\n"\r
+ . "<td><a href=\"index.php?action=memberedit&memberid=<%memberid%>\" tabindex=\"<%tabindex%>\"><%editbtn%></a></td>\n"\r
+ . "<td><a href=\"index.php?action=memberdelete&memberid=<%memberid%>\" tabindex=\"<%tabindex%>\"><%deletebtn%></a></td>\n";\r
}\r
else\r
{\r
- $template = "<td>\n"\r
- . "<input type=\"checkbox\" id=\"batch<%id%>\" name=\"batch[<%id%>]\" value=\"<%memberid%>\" />\n"\r
- . "<label for=\"batch<%id%>\">\n"\r
- . "<a href=\"mailto:<%mailaddress%>\" tabindex=\"<%tabindex%>\"><%name%></a>\n"\r
- . "</label>\n</td>\n"\r
- . "<td><%realname%></td>\n"\r
- . "<td><a href=\"<%url%>\" tabindex=\"<%tabindex%>\"><%url%></a></td>\n"\r
- . "<td><%admin%></td>\n"\r
- . "<td><%login%></td>\n"\r
- . "<td><a href=\"index.php?action=memberedit&memberid=<%memberid%>\" tabindex=\"<%tabindex%>\"><%editbtn%></a></td>\n"\r
- . "<td><a href=\"index.php?action=memberdelete&memberid=<%memberid%>\" tabindex=\"<%tabindex%>\"><%deletebtn%></a></td>\n";\r
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_MEMBLIST_BODY'];\r
}\r
$data = array(\r
- 'id' => listplug_nextBatchId(),\r
- 'memberid' => $current->mnumber,\r
- 'mailaddress' => Entity::hsc($current->memail),\r
- 'tabindex' => $vars['tabindex'],\r
- 'name' => Entity::hsc($current->mname),\r
- 'realname' => Entity::hsc($current->mrealname),\r
- 'url' => Entity::hsc($current->murl),\r
- 'admin' => ($current->madmin ? _YES : _NO),\r
- 'login' => ($current->mcanlogin ? _YES : _NO),\r
- 'editbtn' => _LISTS_EDIT,\r
- 'deletebtn' => _LISTS_DELETE,\r
- );\r
+ 'id' => listplug_nextBatchId(),\r
+ 'memberid' => $current['mnumber'],\r
+ 'mailaddress' => Entity::hsc($current['memail']),\r
+ 'tabindex' => $vars['tabindex'],\r
+ 'name' => Entity::hsc($current['mname']),\r
+ 'realname' => Entity::hsc($current['mrealname']),\r
+ 'url' => Entity::hsc($current['murl']),\r
+ 'admin' => $current['madmin'] ? _YES : _NO,\r
+ 'login' => $current['mcanlogin'] ? _YES : _NO,\r
+ 'editbtn' => _LISTS_EDIT,\r
+ 'deletebtn' => _LISTS_DELETE,\r
+ );\r
break;\r
case 'FOOT':\r
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_MEMBLIST_FOOT']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_MEMBLIST_FOOT']) )\r
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_MEMBLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_MEMBLIST_FOOT']) )\r
{\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_MEMBLIST_FOOT'];\r
+ $template = "";\r
}\r
else\r
{\r
- $template = "";\r
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_MEMBLIST_FOOT'];\r
}\r
$data = array();\r
break;\r
return Template::fill($template, $data);\r
}\r
\r
-function listplug_table_teamlist($vars, $type, $templateName = '')\r
+function listplug_table_teamlist($vars, $type, $template_name = '')\r
{\r
global $manager;\r
+ \r
$templates = array();\r
- if ( !empty($templateName) )\r
+ if ( !empty($template_name) )\r
{\r
- $templates = Template::read($templateName);\r
+ $templates =& $manager->getTemplate($template_name);\r
}\r
+ \r
switch( $type )\r
{\r
case 'HEAD':\r
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_TEAMLIST_HEAD']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_TEAMLIST_HEAD']) )\r
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_TEAMLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_TEAMLIST_HEAD']) )\r
{\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_TEAMLIST_HEAD'];\r
+ $template = "<th><%colmembername%></th>\n"\r
+ . "<th><%colmemberrname%></th>\n"\r
+ . "<th><%colteamadmin%><%helplink(teamadmin)%></th>\n"\r
+ . "<th colspan=\"2\"><%colactions%></th>\n";\r
}\r
else\r
{\r
- $template = "<th><%colmembername%></th>\n"\r
- . "<th><%colmemberrname%></th>\n"\r
- . "<th><%colteamadmin%><%helplink(teamadmin)%></th>\n"\r
- . "<th colspan=\"2\"><%colactions%></th>\n";\r
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_TEAMLIST_HEAD'];\r
}\r
$data = array(\r
- 'colmembername' => _LIST_MEMBER_NAME,\r
- 'colmemberrname' => _LIST_MEMBER_RNAME,\r
- 'colteamadmin' => _LIST_TEAM_ADMIN,\r
- 'colactions' => _LISTS_ACTIONS,\r
- );\r
+ 'colmembername' => _LIST_MEMBER_NAME,\r
+ 'colmemberrname' => _LIST_MEMBER_RNAME,\r
+ 'colteamadmin' => _LIST_TEAM_ADMIN,\r
+ 'colactions' => _LISTS_ACTIONS,\r
+ );\r
break;\r
case 'BODY':\r
$current = $vars['current'];\r
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_TEAMLIST_BODY']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_TEAMLIST_BODY']) )\r
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_TEAMLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_TEAMLIST_BODY']) )\r
{\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_TEAMLIST_BODY'];\r
+ $template = "<td>\n"\r
+ . "<input type=\"checkbox\" id=\"batch<%id%>\" name=\"batch[<%id%>]\" value=\"<%memberid%>\" />\n"\r
+ . "<label for=\"batch<%id%>\">\n"\r
+ . "<a href=\"mailto:<%mailaddress%>\" tabindex=\"<%tabindex%>\"><%name%></a>\n"\r
+ . "</label>\n</td>\n"\r
+ . "<td><%realname%></td>\n"\r
+ . "<td><%admin%></td>\n"\r
+ . "<td><a href=\"index.php?action=teamdelete&memberid=<%memberid%>&blogid=<%blogid%>\" tabindex=\"<%tabindex%>\"><%deletebtn%></a></td>\n"\r
+ . "<td><a href=\"<%chadminurl%>\" tabindex=\"<%tabindex%>\"><%chadminbtn%></a></td>\n";\r
}\r
else\r
{\r
- $template = "<td>\n"\r
- . "<input type=\"checkbox\" id=\"batch<%id%>\" name=\"batch[<%id%>]\" value=\"<%memberid%>\" />\n"\r
- . "<label for=\"batch<%id%>\">\n"\r
- . "<a href=\"mailto:<%mailaddress%>\" tabindex=\"<%tabindex%>\"><%name%></a>\n"\r
- . "</label>\n</td>\n"\r
- . "<td><%realname%></td>\n"\r
- . "<td><%admin%></td>\n"\r
- . "<td><a href=\"index.php?action=teamdelete&memberid=<%memberid%>&blogid=<%blogid%>\" tabindex=\"<%tabindex%>\"><%deletebtn%></a></td>\n"\r
- . "<td><a href=\"<%chadminurl%>\" tabindex=\"<%tabindex%>\"><%chadminbtn%></a></td>\n";\r
- }\r
- $url = 'index.php?action=teamchangeadmin&memberid=' . intval($current->tmember) . '&blogid=' . intval($current->tblog);\r
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_TEAMLIST_BODY'];\r
+ }\r
+ $url = 'index.php?action=teamchangeadmin&memberid=' . intval($current['tmember']) . '&blogid=' . intval($current['tblog']);\r
$url = $manager->addTicketToUrl($url);\r
$data = array(\r
- 'id' => listplug_nextBatchId(),\r
- 'memberid' => $current->tmember,\r
- 'mailaddress' => Entity::hsc($current->memail),\r
- 'tabindex' => $vars['tabindex'],\r
- 'name' => Entity::hsc($current->mname),\r
- 'realname' => Entity::hsc($current->mrealname),\r
- 'admin' => ($current->tadmin ? _YES : _NO),\r
- 'blogid' => $current->tblog,\r
- 'deletebtn' => _LISTS_DELETE,\r
- 'chadminurl' => Entity::hsc($url),\r
+ 'id' => listplug_nextBatchId(),\r
+ 'memberid' => $current['tmember'],\r
+ 'mailaddress' => Entity::hsc($current['memail']),\r
+ 'tabindex' => $vars['tabindex'],\r
+ 'name' => Entity::hsc($current['mname']),\r
+ 'realname' => Entity::hsc($current['mrealname']),\r
+ 'admin' => ($current['tadmin'] ? _YES : _NO),\r
+ 'blogid' => $current['tblog'],\r
+ 'deletebtn' => '<%text(_LISTS_DELETE)%>',\r
+ 'chadminurl' => Entity::hsc($url),\r
+ 'chadminbtn' => '<%text(_LIST_TEAM_CHADMIN)%>'\r
);\r
break;\r
case 'FOOT':\r
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_TEAMLIST_FOOT']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_TEAMLIST_FOOT']) )\r
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_TEAMLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_TEAMLIST_FOOT']) )\r
{\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_TEAMLIST_FOOT'];\r
+ $template = "";\r
}\r
else\r
{\r
- $template = "";\r
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_TEAMLIST_FOOT'];\r
}\r
+ $data = array();\r
break;\r
}\r
return Template::fill($template, $data);\r
}\r
\r
-function listplug_table_pluginlist($vars, $type, $templateName = '')\r
+function listplug_table_pluginlist($vars, $type, $template_name = '')\r
{\r
+ static $plugins = array();\r
global $manager;\r
+ \r
$templates = array();\r
- if ( !empty($templateName) )\r
+ if ( !empty($template_name) )\r
{\r
- $templates = Template::read($templateName);\r
+ $templates =& $manager->getTemplate($template_name);\r
}\r
+ \r
switch( $type )\r
{\r
case 'HEAD':\r
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HEAD']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HEAD']) )\r
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HEAD']) )\r
{\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HEAD'];\r
+ $template = "<th><%colinfo%></th>\n"\r
+ . "<th><%coldesc%></th>\n"\r
+ . "<th colspan=\"2\"><%colactions%></th>\n";\r
}\r
else\r
{\r
- $template = "<th><%colinfo%></th>\n"\r
- . "<th><%coldesc%></th>\n"\r
- . "<th colspan=\"2\"><%colactions%></th>\n";\r
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HEAD'];\r
}\r
$data = array(\r
- 'colinfo' => _LISTS_INFO,\r
- 'coldesc' => _LISTS_DESC,\r
- 'colactions' => _LISTS_ACTIONS,\r
- );\r
+ 'colinfo' => _LISTS_INFO,\r
+ 'coldesc' => _LISTS_DESC,\r
+ 'colactions' => _LISTS_ACTIONS,\r
+ );\r
break;\r
case 'BODY':\r
$current = $vars['current'];\r
\r
- $plug =& $manager->getPlugin($current->pfile);\r
+ $plug =& $manager->getPlugin($current['pfile']);\r
if ( $plug )\r
{\r
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY']) )\r
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY']) )\r
{\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY'];\r
+ $template = "<td>\n"\r
+ . "<strong><%plugname%></strong><br />\n"\r
+ . "<%autherlabel%> <%plugauther%><br />\n"\r
+ . "<%versionlabel%> <%plugversion%><br />\n"\r
+ . "<%pluggeturl%><br />\n"\r
+ . "</td>\n"\r
+ . "<td>\n"\r
+ . "<%desclabel%><br /><%plugdesc%>\n"\r
+ . "<%eventlist%>\n"\r
+ . "<%needupdate%>\n"\r
+ . "<%dependlist%>\n"\r
+ . "<%depreqlist%>\n"\r
+ . "</td>\n";\r
}\r
else\r
{\r
- $template = "<td>\n"\r
- . "<strong><%plugname%></strong><br />\n"\r
- . "<%autherlabel%> <%plugauther%><br />\n"\r
- . "<%versionlabel%> <%plugversion%><br />\n"\r
- . "<%pluggeturl%><br />\n"\r
- . "</td>\n"\r
- . "<td>\n"\r
- . "<%desclabel%><br /><%plugdesc%>\n"\r
- . "<%eventlist%>\n"\r
- . "<%needupdate%>\n"\r
- . "<%dependlist%>\n"\r
- . "<%depreqlist%>\n"\r
- . "</td>\n";\r
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY'];\r
}\r
$data = array(\r
- 'plugname' => Entity::hsc($plug->getName()),\r
- 'autherlabel' => _LIST_PLUGS_AUTHOR,\r
- 'plugauther' => Entity::hsc($plug->getAuthor()),\r
- 'versionlabel' => _LIST_PLUGS_VER,\r
- 'plugversion' => Entity::hsc($plug->getVersion()),\r
- 'tabindex' => $vars['tabindex'],\r
- 'desclabel' => _LIST_PLUGS_DESC,\r
- 'plugdesc' => Entity::hen($plug->getDescription()),\r
- );\r
+ 'plugname' => Entity::hsc($plug->getName()),\r
+ 'autherlabel' => _LIST_PLUGS_AUTHOR,\r
+ 'plugauther' => Entity::hsc($plug->getAuthor()),\r
+ 'versionlabel' => _LIST_PLUGS_VER,\r
+ 'plugversion' => Entity::hsc($plug->getVersion()),\r
+ 'tabindex' => $vars['tabindex'],\r
+ 'desclabel' => _LIST_PLUGS_DESC,\r
+ 'plugdesc' => Entity::hen($plug->getDescription()),\r
+ );\r
if ( $plug->getURL() )\r
{\r
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_GURL']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_GURL']) )\r
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGLIST_GURL', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_GURL']) )\r
{\r
- $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_GURL'];\r
+ $subTpl = "<a href=\"<%plugurl%>\" tabindex=\"<%tabindex%>\"><%plugsite%></a>";\r
}\r
else\r
{\r
- $subTpl = "<a href=\"<%plugurl%>\" tabindex=\"<%tabindex%>\"><%plugsite%></a>";\r
+ $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_GURL'];\r
}\r
$subData = array(\r
- 'plugurl' => Entity::hsc($plug->getURL()),\r
- 'tabindex' => $vars['tabindex'],\r
- 'plugsite' => _LIST_PLUGS_SITE,\r
- );\r
+ 'plugurl' => Entity::hsc($plug->getURL()),\r
+ 'tabindex' => $vars['tabindex'],\r
+ 'plugsite' => _LIST_PLUGS_SITE,\r
+ );\r
$data['pluggeturl'] = Template::fill($subTpl, $subData);\r
}\r
else\r
}\r
if ( count($plug->getEventList()) > 0 )\r
{\r
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_PLUGEVENTLIST']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGEVENTLIST']) )\r
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGEVENTLIST', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGEVENTLIST']) )\r
{\r
- $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGEVENTLIST'];\r
+ $subTpl = "<br /><br /><%evntlstlbl%><br /><%eventlist%>";\r
}\r
else\r
{\r
- $subTpl = "<br /><br /><%evntlstlbl%><br /><%eventlist%>";\r
+ $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGEVENTLIST'];\r
}\r
$subData = array(\r
- 'evntlstlbl' => _LIST_PLUGS_SUBS,\r
- 'eventlist' => Entity::hsc(implode(', ', $plug->getEventList())),\r
+ 'evntlstlbl' => _LIST_PLUGS_SUBS,\r
+ 'eventlist' => Entity::hsc(implode(', ', $plug->getEventList())),\r
);\r
$data['eventlist'] = Template::fill($subTpl, $subData);\r
}\r
}\r
if ( !$plug->subscribtionListIsUptodate() )\r
{\r
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_PLUGNEDUPDATE']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGNEDUPDATE']) )\r
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGNEDUPDATE', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGNEDUPDATE']) )\r
{\r
- $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGNEDUPDATE'];\r
+ $subTpl = "<br /><br /><strong><%updatealert%></strong>";\r
}\r
else\r
{\r
- $subTpl = "<br /><br /><strong><%updatealert%></strong>";\r
+ $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGNEDUPDATE'];\r
}\r
$subData = array(\r
- 'updatealert' => _LIST_PLUG_SUBS_NEEDUPDATE,\r
+ 'updatealert' => _LIST_PLUG_SUBS_NEEDUPDATE,\r
);\r
$data['needupdate'] = Template::fill($subTpl, $subData);\r
}\r
}\r
if ( count($plug->getPluginDep() ) > 0)\r
{\r
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPEND']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPEND']) )\r
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPEND', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPEND']) )\r
{\r
- $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPEND'];\r
+ $subTpl = "<br /><br /><%deplistlbl%><br /><%dependlist%>";\r
}\r
else\r
{\r
- $subTpl = "<br /><br /><%deplistlbl%><br /><%dependlist%>";\r
+ $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPEND'];\r
}\r
$subData = array(\r
- 'deplistlbl' => _LIST_PLUGS_DEP,\r
- 'dependlist' => Entity::hsc(implode(', ', $plug->getPluginDep())),\r
+ 'deplistlbl' => _LIST_PLUGS_DEP,\r
+ 'dependlist' => Entity::hsc(implode(', ', $plug->getPluginDep())),\r
);\r
$data['dependlist'] = Template::fill($subTpl, $subData);\r
}\r
$data['dependlist'] = '';\r
}\r
/* check dependency */\r
+ if ( empty($plugins) )\r
+ {\r
+ $plugins = DB::getResult('SELECT pfile FROM ' . sql_table('plugin'));\r
+ }\r
$req = array();\r
- $res = sql_query('SELECT pfile FROM ' . sql_table('plugin'));\r
- while( $o = sql_fetch_object($res) )\r
+ foreach ( $plugins as $plugin )\r
{\r
- $preq =& $manager->getPlugin($o->pfile);\r
+ $preq =& $manager->getPlugin($plugin['pfile']);\r
if ( $preq )\r
{\r
$depList = $preq->getPluginDep();\r
foreach ( $depList as $depName )\r
{\r
- if ( $current->pfile == $depName )\r
+ if ( $current['pfile'] == $depName )\r
{\r
- $req[] = $o->pfile;\r
+ $req[] = $plugin['pfile'];\r
}\r
}\r
}\r
\r
if ( count($req) > 0 )\r
{\r
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPREQ']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPREQ']) )\r
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPREQ', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPREQ']) )\r
{\r
- $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPREQ'];\r
+ $subTpl = "<br /><br /><%deprlstlbl%><br /><%depreqlist%>";\r
}\r
else\r
{\r
- $subTpl = "<br /><br /><%deprlstlbl%><br /><%depreqlist%>";\r
+ $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPREQ'];\r
}\r
$subData = array(\r
- 'deprlstlbl' => _LIST_PLUGS_DEPREQ,\r
- 'depreqlist' => Entity::hsc(implode(', ', $req)),\r
+ 'deprlstlbl' => _LIST_PLUGS_DEPREQ,\r
+ 'depreqlist' => Entity::hsc(implode(', ', $req)),\r
);\r
$data['depreqlist'] = Template::fill($subTpl, $subData);\r
}\r
}\r
else\r
{\r
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLISTFALSE']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLISTFALSE']) )\r
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGLISTFALSE', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLISTFALSE']) )\r
{\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLISTFALSE'];\r
+ $template = "<td colspan=\"2\"><%noplugalert%></td>\n";\r
}\r
else\r
{\r
- $template = "<td colspan=\"2\"><%noplugalert%></td>\n";\r
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLISTFALSE'];\r
}\r
$data = array(\r
- 'noplugalert' => sprintf(_PLUGINFILE_COULDNT_BELOADED, Entity::hsc($current->pfile)),\r
- );\r
+ 'noplugalert' => sprintf(_PLUGINFILE_COULDNT_BELOADED, Entity::hsc($current['pfile'])),\r
+ );\r
}\r
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ACTN']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ACTN']) )\r
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ACTN', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ACTN']) )\r
{\r
- $template .= $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ACTN'];\r
+ $template .= "<td>\n"\r
+ . "<a href=\"<%actionupurl%>\" tabindex=\"<%tabindex%>\"><%actionuptxt%></a><br />\n"\r
+ . "<a href=\"<%actiondownurl%>\" tabindex=\"<%tabindex%>\"><%actiondowntxt%></a><br />\n"\r
+ . "<a href=\"<%actuninsturl%>\" tabindex=\"<%tabindex%>\"><%actuninsttxt%></a><br />"\r
+ . "<%plugadminurl%>\n"\r
+ . "<%plughelpurl%>\n"\r
+ . "<%plugoptsetting%>\n"\r
+ . "</td>\n";\r
}\r
else\r
{\r
- $template .= "<td>\n"\r
- . "<a href=\"<%actionupurl%>\" tabindex=\"<%tabindex%>\"><%actionuptxt%></a><br />\n"\r
- . "<a href=\"<%actiondownurl%>\" tabindex=\"<%tabindex%>\"><%actiondowntxt%></a><br />\n"\r
- . "<a href=\"<%actuninsturl%>\" tabindex=\"<%tabindex%>\"><%actuninsttxt%></a><br />"\r
- . "<%plugadminurl%>\n"\r
- . "<%plughelpurl%>\n"\r
- . "<%plugoptsetting%>\n"\r
- . "</td>\n";\r
- }\r
- $baseUrl = 'index.php?plugid=' . $pid . '&action=';\r
- $upUrl = $manager->addTicketToUrl($baseUrl . 'pluginup');\r
- $downUrl = $manager->addTicketToUrl($baseUrl . 'plugindown');\r
- $data['actionuptxt'] = _LIST_PLUGS_UP;\r
- $data['actionupurl'] = Entity::hsc($upUrl);\r
- $data['actiondowntxt'] = _LIST_PLUGS_DOWN;\r
- $data['actiondownurl'] = Entity::hsc($downUrl);\r
- $data['actuninsttxt'] = _LIST_PLUGS_UNINSTALL;\r
- $data['actuninsturl'] = 'index.php?action=plugindelete&plugid=' . $pid;\r
+ $template .= $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ACTN'];\r
+ }\r
+ \r
+ $baseUrl = 'index.php?plugid=' . $current['pid'] . '&action=';\r
+ $upUrl = $manager->addTicketToUrl($baseUrl . 'pluginup');\r
+ $downUrl = $manager->addTicketToUrl($baseUrl . 'plugindown');\r
+ \r
+ $data['actionuptxt'] = _LIST_PLUGS_UP;\r
+ $data['actionupurl'] = Entity::hsc($upUrl);\r
+ $data['actiondowntxt'] = _LIST_PLUGS_DOWN;\r
+ $data['actiondownurl'] = Entity::hsc($downUrl);\r
+ $data['actuninsttxt'] = _LIST_PLUGS_UNINSTALL;\r
+ $data['actuninsturl'] = 'index.php?action=plugindelete&plugid=' . $current['pid'];\r
+ \r
if ( $plug && ($plug->hasAdminArea() > 0) )\r
{\r
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ADMN']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ADMN']) )\r
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ADMN', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ADMN']) )\r
{\r
- $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ADMN'];\r
+ $subTpl = "<a href=\"<%actadminurl%>\" tabindex=\"<%tabindex%>\"><%actadmintxt%></a><br />\n";\r
}\r
else\r
{\r
- $subTpl = "<a href=\"<%actadminurl%>\" tabindex=\"<%tabindex%>\"><%actadmintxt%></a><br />\n";\r
+ $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ADMN'];\r
}\r
$subData = array(\r
- 'actadminurl' => Entity::hsc($plug->getAdminURL()),\r
- 'tabindex' => $vars['tabindex'],\r
- 'actadmintxt' => _LIST_PLUGS_ADMIN,\r
- );\r
+ 'actadminurl' => Entity::hsc($plug->getAdminURL()),\r
+ 'tabindex' => $vars['tabindex'],\r
+ 'actadmintxt' => _LIST_PLUGS_ADMIN,\r
+ );\r
$data['plugadminurl'] = Template::fill($subTpl, $subData);\r
}\r
else\r
}\r
if ( $plug && ($plug->supportsFeature('HelpPage') > 0) )\r
{\r
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HELP']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HELP']) )\r
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HELP', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HELP']) )\r
{\r
- $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HELP'];\r
+ $subTpl = "<a href=\"<%acthelpurl%>\" tabindex=\"<%tabindex%>\"><%acthelptxt%></a><br />\n";\r
}\r
else\r
{\r
- $subTpl = "<a href=\"<%acthelpurl%>\" tabindex=\"<%tabindex%>\"><%acthelptxt%></a><br />\n";\r
+ $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HELP'];\r
}\r
$subData = array(\r
- 'acthelpurl' => 'index.php?action=pluginhelp&plugid=' . $pid,\r
- 'tabindex' => $vars['tabindex'],\r
- 'acthelptxt' => _LIST_PLUGS_HELP,\r
+ 'acthelpurl' => 'index.php?action=pluginhelp&plugid=' . $current['pid'],\r
+ 'tabindex' => $vars['tabindex'],\r
+ 'acthelptxt' => _LIST_PLUGS_HELP,\r
);\r
$data['plughelpurl'] = Template::fill($subTpl, $subData);\r
}\r
$data['plughelpurl'] = '';\r
}\r
$optQuery = 'SELECT '\r
- . ' COUNT(*) AS result '\r
- . 'FROM '\r
- . sql_table('plugin_option_desc') . ' '\r
- . 'WHERE '\r
- . ' ocontext = "global" '\r
- . 'AND opid = %d';\r
- $pOptions = quickQuery(sprintf($optQuery, $pid));\r
+ . ' COUNT(*) AS result '\r
+ . 'FROM '\r
+ . sql_table('plugin_option_desc') . ' '\r
+ . 'WHERE '\r
+ . ' ocontext = "global" '\r
+ . 'AND opid = %d';\r
+ $pOptions = DB::getValue(sprintf($optQuery, $current['pid']));\r
if ( $pOptions > 0 )\r
{\r
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_PLUGOPTSETURL']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGOPTSETURL']) )\r
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGOPTSETURL', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGOPTSETURL']) )\r
{\r
- $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGOPTSETURL'];\r
+ $subTpl = "<a href=\"<%actoptionurl%>\" tabindex=\"<%tabindex%>\"><%actoptiontxt%></a>\n";\r
}\r
else\r
{\r
- $subTpl = "<a href=\"<%actoptionurl%>\" tabindex=\"<%tabindex%>\"><%actoptiontxt%></a>\n";\r
+ $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGOPTSETURL'];\r
}\r
$subData = array(\r
- 'actoptionurl' => 'index.php?action=pluginoptions&plugid=' . $pid,\r
- 'tabindex' => $vars['tabindex'],\r
- 'actoptiontxt' => _LIST_PLUGS_OPTIONS,\r
+ 'actoptionurl' => 'index.php?action=pluginoptions&plugid=' . $current['pid'],\r
+ 'tabindex' => $vars['tabindex'],\r
+ 'actoptiontxt' => _LIST_PLUGS_OPTIONS,\r
);\r
$data['plugoptsetting'] = Template::fill($subTpl, $subData);\r
}\r
}\r
break;\r
case 'FOOT':\r
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_FOOT']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_FOOT']) )\r
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_FOOT']) )\r
{\r
- $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_FOOT'];\r
+ $template = "";\r
}\r
else\r
{\r
- $subTpl = "";\r
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_FOOT'];\r
}\r
$data = array();\r
break;\r
return Template::fill($template, $data);\r
}\r
\r
-function listplug_table_plugoptionlist($vars, $type, $templateName = '')\r
+function listplug_table_plugoptionlist($vars, $type, $template_name = '')\r
{\r
global $manager;\r
+ \r
$templates = array();\r
- if ( !empty($templateName) )\r
+ if ( !empty($template_name) )\r
{\r
- $templates = Template::read($templateName);\r
+ $templates =& $manager->getTemplate($template_name);\r
}\r
+ \r
switch( $type )\r
{\r
case 'HEAD':\r
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_POPTLIST_HEAD']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_POPTLIST_HEAD']) )\r
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_POPTLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_POPTLIST_HEAD']) )\r
{\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_POPTLIST_HEAD'];\r
+ $template = "<th><%colinfo%></th>\n"\r
+ . "<th><%colvalue%></th>\n";\r
}\r
else\r
{\r
- $template = "<th><%colinfo%></th><th><%colvalue%></th>\n";\r
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_POPTLIST_HEAD'];\r
}\r
$data = array(\r
- 'colinfo' => _LISTS_INFO,\r
- 'colvalue' => _LISTS_VALUE,\r
- );\r
+ 'colinfo' => _LISTS_INFO,\r
+ 'colvalue' => _LISTS_VALUE,\r
+ );\r
break;\r
case 'BODY':\r
- $current = $vars['current'];\r
- $template = listplug_plugOptionRow($current, $templateName);\r
- $data = array();\r
+ $current = $vars['current'];\r
+ $template = listplug_plugOptionRow($current, $template_name);\r
+ $data = array();\r
break;\r
case 'FOOT':\r
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_POPTLIST_FOOT']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_POPTLIST_FOOT']) )\r
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_POPTLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_POPTLIST_FOOT']) )\r
{\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_POPTLIST_FOOT'];\r
+ $template = "<tr>\n"\r
+ . "<th colspan=\"2\"><%savetext%></th>\n"\r
+ . "</tr>\n"\r
+ . "<tr>\n"\r
+ . "<td><%savetext%></td>\n"\r
+ . "<td><input type=\"submit\" value=\"<%savetext%>\" /></td>\n"\r
+ . "</tr>\n";\r
}\r
else\r
{\r
- $template = "<tr>\n"\r
- . "<th colspan=\"2\"><%savetext%></th>"\r
- . "<th colspan=\"2\"><%savetext%></th>"\r
- . "<td><input type=\"submit\" value=\"<%savetext%>\" /></td>"\r
- . "</tr>\n";\r
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_POPTLIST_FOOT'];\r
}\r
$data = array(\r
- 'savetext' => _PLUGS_SAVE,\r
- );\r
+ 'savetext' => _PLUGS_SAVE,\r
+ );\r
break;\r
}\r
+ \r
return Template::fill($template, $data);\r
}\r
\r
-function listplug_plugOptionRow($current, $templateName = '')\r
+function listplug_plugOptionRow($current, $template_name = '')\r
{\r
+ global $manager;\r
+ \r
$templates = array();\r
- if ( !empty($templateName) )\r
+ if ( !empty($template_name) )\r
{\r
- $templates = Template::read($templateName);\r
+ $templates =& $manager->getTemplate($template_name);\r
}\r
+ \r
$varname = "plugoption[{$current['oid']}][{$current['contextid']}]";\r
\r
// retreive the optionmeta\r
}\r
else\r
{\r
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_POPTLIST_BODY']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_POPTLIST_BODY']) )\r
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_POPTLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_POPTLIST_BODY']) )\r
{\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_POPTLIST_BODY'];\r
+ $template = "<td><%description%></td>\n"\r
+ . "<td>\n";\r
}\r
else\r
{\r
- $template = "<td><%description%></td>\n<td>\n";\r
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_POPTLIST_BODY'];\r
}\r
+ \r
$data = array();\r
+ \r
switch($current['type'])\r
{\r
case 'yesno':\r
- $template .= AdminActions::input_yesno($varname, $current['value'], 0, 'yes', 'no', _YES, _NO, 0, $templateName, 1);\r
+ $template .= listplug_input_yesno($varname, $current['value'], 0, 'yes', 'no', _YES, _NO, 0, $template_name, 1);\r
break;\r
case 'password':\r
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OPWORD']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OPWORD']) )\r
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OPWORD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OPWORD']) )\r
{\r
- $template .= $templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OPWORD'];\r
+ $template .= "<input type=\"password\" size=\"40\" maxlength=\"128\" name=\"<%varname%>\" value=\"<%value%>\" />\n";\r
}\r
else\r
{\r
- $template .= "<input type=\"password\" size=\"40\" maxlength=\"128\" name=\"<%varname%>\" value=\"<%value%>\" />\n";\r
+ $template .= $templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OPWORD'];\r
}\r
$data = array(\r
- 'varname' => Entity::hsc($varname),\r
- 'value' => Entity::hsc($current['value']),\r
- );\r
+ 'varname' => Entity::hsc($varname),\r
+ 'value' => Entity::hsc($current['value']),\r
+ );\r
break;\r
case 'select':\r
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEP']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEP']) )\r
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEP', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEP']) )\r
{\r
- $template .= $templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEP'];\r
+ $template .= "<select name=\"<%varname%>\">\n";\r
}\r
else\r
{\r
- $template .= "<select name=\"<%varname%>\">\n";\r
+ $template .= $templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEP'];\r
}\r
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEO']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEO']) )\r
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEO', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEO']) )\r
{\r
- $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEO'];\r
+ $subTpl = "<option value=\"<%value%>\"<%selected%>><%optname%></option>\n";\r
}\r
else\r
{\r
- $subTpl = "<option value=\"<%value%>\"<%selected%>><%optname%></option>\n";\r
+ $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEO'];\r
}\r
$options = NucleusPlugin::getOptionSelectValues($current['typeinfo']);\r
- $options = i18n::explode('|', $options);\r
-\r
+ $options = preg_split('#\|#', $options);\r
+ \r
for ( $i=0; $i<(count($options)-1); $i+=2 )\r
{\r
+ $name = $options[$i];\r
+ $value = $options[$i+1];\r
+ if ( defined($name) )\r
+ {\r
+ $name = constant($name);\r
+ }\r
+ \r
$subData = array(\r
- 'optname' => Entity::hsc($options[$i]),\r
- 'value' => Entity::hsc($options[$i+1])\r
- );\r
- if ($options[$i+1] == $current['value'])\r
+ 'optname' => Entity::hsc($name),\r
+ 'value' => Entity::hsc($value)\r
+ );\r
+ if ($value != $current['value'])\r
{\r
- $subData['selected'] = ' selected="selected"';\r
+ $subData['selected'] = '';\r
}\r
else\r
{\r
- $subData['selected'] = '';\r
+ $subData['selected'] = ' selected="selected"';\r
}\r
$template .= Template::fill($subTpl, $subData);\r
}\r
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEC']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEC']) )\r
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEC', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEC']) )\r
{\r
- $template .= $templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEC'];\r
+ $template .= "</select>\n";\r
}\r
else\r
{\r
- $template .= "</select>\n";\r
+ $template .= $templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEC'];\r
}\r
$data['varname'] = Entity::hsc($varname);\r
break;\r
case 'textarea':\r
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OTAREA']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OTAREA']) )\r
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OTAREA', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OTAREA']) )\r
{\r
- $template .= $templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OTAREA'];\r
+ $template .= "<textarea class=\"pluginoption\" cols=\"30\" rows=\"5\" name=\"<%varname%>\"<%readonly%>><%value%></textarea>\n";\r
}\r
else\r
{\r
- $template .= "<textarea class=\"pluginoption\" cols=\"30\" rows=\"5\" name=\"<%varname%>\"<%readonly%>><%value%></textarea>";\r
+ $template .= $templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OTAREA'];\r
}\r
$data = array(\r
- 'varname' => Entity::hsc($varname),\r
- 'value' => Entity::hsc($current['value'])\r
- );\r
- if ( array_key_exists('access', $current) && $current['access'] == 'readonly')\r
+ 'varname' => Entity::hsc($varname),\r
+ 'value' => Entity::hsc($current['value'])\r
+ );\r
+ if ( !array_key_exists('access', $current) || $current['access'] != 'readonly')\r
{\r
- $data['readonly'] = ' readonly="readonly"';\r
+ $data['readonly'] = '';\r
}\r
else\r
{\r
- $data['readonly'] = '';\r
+ $data['readonly'] = ' readonly="readonly"';\r
}\r
break;\r
case 'text':\r
default:\r
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OITEXT']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OITEXT']) )\r
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OITEXT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OITEXT']) )\r
{\r
- $template .= $templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OITEXT'];\r
+ $template .= "<input type=\"text\" size=\"40\" maxlength=\"128\" name=\"<%varname%>\" value=\"<%value%>\"<%datatype%><%readonly%> />\n";\r
}\r
else\r
{\r
- $template .= "<input type=\"text\" size=\"40\" maxlength=\"128\" name=\"<%varname%>\" value=\"<%value%>\"<%datatype%><%readonly%> />\n";\r
+ $template .= $templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OITEXT'];\r
}\r
$data = array(\r
- 'varname' => Entity::hsc($varname),\r
- 'value' => Entity::hsc($current['value'])\r
- );\r
- if ( array_key_exists('datatype', $current) && $current['datatype'] == 'numerical')\r
+ 'varname' => Entity::hsc($varname),\r
+ 'value' => Entity::hsc($current['value'])\r
+ );\r
+ if ( !array_key_exists('datatype', $current) || $current['datatype'] != 'numerical')\r
{\r
- $data['datatype'] = ' onkeyup="checkNumeric(this)" onblur="checkNumeric(this)"';\r
+ $data['datatype'] = '';\r
}\r
else\r
{\r
- $data['datatype'] = '';\r
+ $data['datatype'] = ' onkeyup="checkNumeric(this)" onblur="checkNumeric(this)"';\r
}\r
- if ( array_key_exists('access', $current) && $current['access'] == 'readonly')\r
+ if ( !array_key_exists('access', $current) || $current['access'] != 'readonly')\r
{\r
- $data['readonly'] = ' readonly="readonly"';\r
+ $data['readonly'] = '';\r
}\r
else\r
{\r
- $data['readonly'] = '';\r
+ $data['readonly'] = ' readonly="readonly"';\r
}\r
}\r
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_PLUGOPTN_FOOT']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGOPTN_FOOT']) )\r
+ \r
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGOPTN_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGOPTN_FOOT']) )\r
+ {\r
+ $template .= "<%extra%></td>\n";\r
+ }\r
+ else\r
{\r
$template .= $templates['SHOWLIST_LISTPLUG_TABLE_PLUGOPTN_FOOT'];\r
}\r
+ \r
+ if ( !array_key_exists('extra', $current) )\r
+ {\r
+ $data['extra'] = '';\r
+ }\r
else\r
{\r
- $template .= "<%extra%></td>\n";\r
+ $data['extra'] = Entity::hsc($current['extra']);\r
+ }\r
+ \r
+ if ( !array_key_exists('description', $current) )\r
+ {\r
+ $data['description'] = Entity::hsc($current['name']);\r
+ }\r
+ else if ( !defined($current['description']) )\r
+ {\r
+ $data['description'] = Entity::hsc($current['description']);\r
+ }\r
+ else\r
+ {\r
+ $data['description'] = Entity::hsc(constant($current['description']));\r
}\r
- $data['extra'] = isset($current['extra']) ? $current['extra'] : '';\r
- $data['description'] = $current['description'] ? Entity::hsc($current['description']) : Entity::hsc($current['name']);\r
}\r
return Template::fill($template, $data, 1);\r
}\r
\r
-function listplug_table_itemlist($vars, $type, $templateName = '')\r
+/**\r
+ * listplug_templateEditRow()\r
+ * \r
+ * @param array $content content of target template\r
+ * @param string $desc description of target template\r
+ * @param string $name name of target template\r
+ * @param string $help help text\r
+ * @param integer $tabindex a number for tab index\r
+ * @param boolean $big large or small textarea\r
+ * @param array $template_name name of template for filling\r
+ * @return void\r
+ */\r
+function listplug_templateEditRow($content, $desc, $name, $help = '', $tabindex = 0, $big = 0, $template_name = '')\r
{\r
- $cssclass = '';\r
+ global $manager;\r
+ \r
+ static $count = 0;\r
+ \r
+ $tmplt = array();\r
+ $base = array();\r
+ \r
$templates = array();\r
- if ( !empty($templateName) )\r
+ if ( $template_name )\r
{\r
- $templates = Template::read($templateName);\r
+ $templates =& $manager->getTemplate($template_name);\r
}\r
\r
- switch( $type )\r
+ $data = array(\r
+ 'description' => $desc,\r
+ 'help' => empty($help) ? '' : helpHtml('template' . $help),\r
+ 'count' => $count++,\r
+ 'name' => $name,\r
+ 'tabindex' => $tabindex,\r
+ 'rows' => $big ? 10 : 5,\r
+ );\r
+ \r
+ $message = '';\r
+ \r
+ /* row head */\r
+ if ( !array_key_exists('TEMPLATE_EDIT_ROW_HEAD', $templates) || empty($tmplt['TEMPLATE_EDIT_ROW_HEAD']) )\r
{\r
- case 'HEAD':\r
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_ITEMLIST_HEAD']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_ITEMLIST_HEAD']) )\r
- {\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_ITEMLIST_HEAD'];\r
+ $template = "</tr>"\r
+ . "<tr>\n"\r
+ . "<td><%description%><%help%></td>\n"\r
+ . "<td id=\"td<%count%>\">\n"\r
+ . "<textarea class=\"templateedit\" name=\"<%name%>\" tabindex=\"<%tabindex%>\" cols=\"50\" rows=\"<%rows%>\" id=\"textarea<%count%>\">";\r
+ }\r
+ else\r
+ {\r
+ $template = $tmplt['TEMPLATE_EDIT_ROW_HEAD'];\r
+ }\r
+ $message .= TEMPLATE::fill($template, $data);\r
+ \r
+ /* row content */\r
+ $message .= ENTITY::hsc($content);\r
+ \r
+ /* row tail */\r
+ if ( !array_key_exists('TEMPLATE_EDIT_ROW_TAIL', $templates) || empty($tmplt['TEMPLATE_EDIT_ROW_TAIL']) )\r
+ {\r
+ $template = "</textarea>\n"\r
+ . "</td>\n";\r
+ }\r
+ else\r
+ {\r
+ $template = $tmplt['TEMPLATE_EDIT_ROW_TAIL'];\r
+ }\r
+ $message .= TEMPLATE::fill($template, $data);\r
+ \r
+ return $message;\r
+}\r
+\r
+function listplug_table_itemlist($vars, $type, $template_name = '')\r
+{\r
+ global $manager;\r
+ \r
+ $cssclass = '';\r
+ \r
+ $templates = array();\r
+ if ( !empty($template_name) )\r
+ {\r
+ $templates =& $manager->getTemplate($template_name);\r
+ }\r
+ \r
+ switch( $type )\r
+ {\r
+ case 'HEAD':\r
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_ITEMLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_ITEMLIST_HEAD']) )\r
+ {\r
+ $template = "<th><%colinfo%></th>\n"\r
+ . "<th><%colcontent%></th>\n"\r
+ . "<th style=\"white-space:nowrap\"><%colaction%></th>\n";\r
}\r
else\r
{\r
- $template = "<th><%colinfo%></th><th><%colcontent%></th><th style=\"white-space:nowrap\"><%colaction%></th>\n";\r
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_ITEMLIST_HEAD'];\r
}\r
$data = array(\r
- 'colinfo' => _LIST_ITEM_INFO,\r
- 'colcontent' => _LIST_ITEM_CONTENT,\r
- 'colaction' => _LISTS_ACTIONS\r
- );\r
+ 'colinfo' => _LIST_ITEM_INFO,\r
+ 'colcontent' => _LIST_ITEM_CONTENT,\r
+ 'colaction' => _LISTS_ACTIONS\r
+ );\r
break;\r
case 'BODY':\r
$current = $vars['current'];\r
// string -> unix timestamp\r
- $current->itime = strtotime($current->itime);\r
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_ITEMLIST_BODY']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_ITEMLIST_BODY']) )\r
+ $current['itime'] = strtotime($current['itime']);\r
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_ITEMLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_ITEMLIST_BODY']) )\r
{\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_ITEMLIST_BODY'];\r
+ $template = "<td<%cssclass%>>\n"\r
+ . "<%bshortlabel%> <%bshortnameval%><br />\n"\r
+ . "<%categorylabel%> <%categorynameval%><br />\n"\r
+ . "<%authorlabel%> <%authornameval%><br />\n"\r
+ . "<%itemdatelabel%> <%itemdateval%><br />\n"\r
+ . "<%itemtimelabel%> <%itemtimeval%>\n"\r
+ . "</td>\n"\r
+ . "<td<%cssclass%>>\n"\r
+ . "<input type=\"checkbox\" id=\"batch<%batchid%>\" name=\"batch[<%batchid%>]\" value=\"<%itemid%>\" />\n"\r
+ . "<label for=\"batch<%batchid%>\"><b><%itemtitle%></b></label><br />\n"\r
+ . "<%itembody%>\n"\r
+ . "</td>\n"\r
+ . "<td<%cssclass%>>\n"\r
+ . "<a href=\"index.php?action=itemedit&itemid=<%itemid%>\"><%editbtn%></a><br />\n"\r
+ . "<%camount%>\n"\r
+ . "<a href=\"index.php?action=itemmove&itemid=<%itemid%>\"><%movebtn%></a><br />\n"\r
+ . "<a href=\"index.php?action=itemdelete&itemid=<%itemid%>\"><%delbtn%></a><br />\n"\r
+ . "</td>\n";\r
}\r
else\r
{\r
- $template = "<td<%cssclass%>>\n"\r
- . "<%bshortlabel%> <%bshortnameval%><br />\n"\r
- . "<%categorylabel%> <%categorynameval%><br />\n"\r
- . "<%authorlabel%> <%authornameval%><br />\n"\r
- . "<%itemdatelabel%> <%itemdateval%><br />\n"\r
- . "<%itemtimelabel%> <%itemtimeval%>\n"\r
- . "</td>\n"\r
- . "<input type=\"checkbox\" id=\"batch<%batchid%>\" name=\"batch<%batchid%>\" value=\"<%itemid%>\" />\n"\r
- . "<label for=\"batch<%batchid%>\"><b><%itemtitle%></b></label><br />\n"\r
- . "<a href=\"index.php?action=itemedit&itemid=<%itemid%>\"><%editbtn%></a><br />\n"\r
- . "<%camount%>\n"\r
- . "<a href=\"index.php?action=itemmove&itemid=<%itemid%>\"><%movebtn%></a><br />\n"\r
- . "<a href=\"index.php?action=itemdelete&itemid=<%itemid%>\"><%delbtn%></a><br />\n"\r
- . "</td>\n";\r
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_ITEMLIST_BODY'];\r
}\r
$cssclass = '';\r
- \r
- if ( $current->idraft == 1 )\r
+ \r
+ if ( $current['idraft'] == 1 )\r
{\r
$cssclass = ' class="draft"';\r
}\r
\r
// (can't use offset time since offsets might vary between blogs)\r
- if ( $current->itime > $vars['now'] )\r
+ if ( $current['itime'] > $vars['now'] )\r
{\r
$cssclass = ' class="future"';\r
}\r
- $body = strip_tags($current->ibody);\r
+ $body = strip_tags($current['ibody']);\r
$data = array(\r
- 'cssclass' => $cssclass,\r
- 'bshortlabel' => _LIST_ITEM_BLOG,\r
- 'bshortnameval' => Entity::hsc($current->bshortname),\r
- 'categorylabel' => _LIST_ITEM_CAT,\r
- 'categorynameval' => Entity::hsc($current->cname),\r
- 'authorlabel' => _LIST_ITEM_AUTHOR,\r
- 'authornameval' => Entity::hsc($current->mname),\r
- 'itemdatelabel' => _LIST_ITEM_DATE,\r
- 'itemdateval' => date("Y-m-d",$current->itime),\r
- 'itemdatelabel' => _LIST_ITEM_TIME,\r
- 'itemdateval' => date("H:i",$current->itime),\r
- 'batchid' => listplug_nextBatchId(),\r
- 'itemid' => $current->inumber,\r
- 'itemtitle' => Entity::hsc(strip_tags($current->ititle)),\r
- 'itembody' => Entity::hsc(Entity::shorten($body, 300, '...')),\r
- 'editbtn' => _LISTS_EDIT,\r
- 'movebtn' => _LISTS_MOVE,\r
- 'delbtn' => _LISTS_DELETE,\r
+ 'cssclass' => $cssclass,\r
+ 'bshortlabel' => _LIST_ITEM_BLOG,\r
+ 'bshortnameval' => Entity::hsc($current['bshortname']),\r
+ 'categorylabel' => _LIST_ITEM_CAT,\r
+ 'categorynameval' => Entity::hsc($current['cname']),\r
+ 'authorlabel' => _LIST_ITEM_AUTHOR,\r
+ 'authornameval' => Entity::hsc($current['mname']),\r
+ 'itemdatelabel' => _LIST_ITEM_DATE,\r
+ 'itemdateval' => date("Y-m-d",$current['itime']),\r
+ 'itemdatelabel' => _LIST_ITEM_TIME,\r
+ 'itemdateval' => date("H:i",$current['itime']),\r
+ 'batchid' => listplug_nextBatchId(),\r
+ 'itemid' => $current['inumber'],\r
+ 'itemtitle' => Entity::hsc(strip_tags($current['ititle'])),\r
+ 'itembody' => Entity::hsc(Entity::shorten($body, 300, '...')),\r
+ 'editbtn' => _LISTS_EDIT,\r
+ 'movebtn' => _LISTS_MOVE,\r
+ 'delbtn' => _LISTS_DELETE,\r
);\r
// evaluate amount of comments for the item\r
- $comment = new Comments($current->inumber);\r
+ $comment = new Comments($current['inumber']);\r
$camount = $comment->amountComments();\r
if ( $camount > 0 )\r
{\r
- $data['camount'] = "<a href=\"index.php?action=itemcommentlist&itemid=\"{$current->inumber}\">(" . sprintf(_LIST_ITEM_COMMENTS, $comment->amountComments()) . ")</a><br />\n";\r
+ $data['camount'] = "<a href=\"index.php?action=itemcommentlist&itemid={$current['inumber']}\">(" . sprintf(_LIST_ITEM_COMMENTS, $comment->amountComments()) . ")</a><br />\n";\r
}\r
else\r
{\r
- echo "<li>" . _LIST_ITEM_NOCONTENT . "</li>\n";\r
+ $data['camount'] = _LIST_ITEM_NOCONTENT . "<br />\n";\r
}\r
break;\r
case 'FOOT':\r
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_ITEMLIST_FOOT']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_ITEMLIST_FOOT']) )\r
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_ITEMLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_ITEMLIST_FOOT']) )\r
{\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_ITEMLIST_FOOT'];\r
+ $template = "\n";\r
}\r
else\r
{\r
- $template = "\n";\r
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_ITEMLIST_FOOT'];\r
}\r
$data = array();\r
break;\r
return $id++;\r
}\r
\r
-function listplug_table_commentlist($vars, $type, $templateName = '')\r
+function listplug_table_commentlist($vars, $type, $template_name = '')\r
{\r
+ global $manager;\r
+ \r
$templates = array();\r
- if ( !empty($templateName) )\r
+ if ( !empty($template_name) )\r
{\r
- $templates = Template::read($templateName);\r
+ $templates =& $manager->getTemplate($template_name);\r
}\r
+ \r
switch( $type )\r
{\r
case 'HEAD':\r
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_HEAD']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_HEAD']) )\r
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_CMNTLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_HEAD']) )\r
{\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_HEAD'];\r
+ $template = "<th><%colinfo%></th>\n"\r
+ . "<th><%colcontent%></th>\n"\r
+ . "<th colspan=\"3\"><%colaction%></th>\n";\r
}\r
else\r
{\r
- $template = "<th><%colinfo%></th>\n<th><%colcontent%></th>\n<th colspan=\"3\"><%colaction%></th>\n";\r
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_HEAD'];\r
}\r
$data = array(\r
- 'colinfo' => _LISTS_INFO,\r
- 'colcontent' => _LIST_COMMENT,\r
- 'colaction' => _LISTS_ACTIONS\r
- );\r
+ 'colinfo' => _LISTS_INFO,\r
+ 'colcontent' => _LIST_COMMENT,\r
+ 'colaction' => _LISTS_ACTIONS\r
+ );\r
break;\r
case 'BODY':\r
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_BODY']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_BODY']) )\r
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_CMNTLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_BODY']) )\r
{\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_BODY'];\r
+ $template = "<td><%commentdate%><br /><%commentator%><br /><%commentsite%><br /><%commentmail%><br /></td>\n"\r
+ . "<td>\n"\r
+ . "<input type=\"checkbox\" id=\"batch<%batchid%>\" name=\"batch[<%batchid%>]\" value=\"<%commentid%>\" />"\r
+ . "<label for=\"batch<%batchid%>\"><%commentbody%></label>\n"\r
+ . "</td>\n"\r
+ . "<td style=\"white-space:nowrap\">\n"\r
+ . "<a href=\"index.php?action=commentedit&commentid=<%commentid%>\"><%editbtn%></a>\n"\r
+ . "</td>\n"\r
+ . "<td style=\"white-space:nowrap\">\n"\r
+ . "<a href=\"index.php?action=commentdelete&commentid=<%commentid%>\"><%delbtn%></a>\n"\r
+ . "</td>\n"\r
+ . "<%addbanlist%>";\r
}\r
else\r
{\r
- $template = "<td><%commentdate%><br /><%commentator%><br /><%commentsite%><br /><%commentmail%><br /></td>\n"\r
- . "<td><input type=\"checkbox\" id=\"batch<%batchid%>\" name=\"batch[<%batchid%>]\" value=\"<%commentid%>\" />"\r
- . "<label for=\"batch<%batchid%>\"><%commentbody%></label></td>\n"\r
- . "<td style=\"white-space:nowrap\">"\r
- . "<a href=\"index.php?action=commentedit&commentid=<%commentid%>\"><%editbtn%></a></td>\n"\r
- . "<td style=\"white-space:nowrap\">"\r
- . "<a href=\"index.php?action=commentdelete&commentid=<%commentid%>\"><%delbtn%></a></td>\n"\r
- . "<%addbanlist%>";\r
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_BODY'];\r
}\r
$current = $vars['current'];\r
- $body = strip_tags($current->cbody);\r
- $data = array(\r
- 'commentdate' => date("Y-m-d@H:i", strtotime($current->ctime)),\r
- 'batchid' => listplug_nextBatchId(),\r
- 'commentid' => $current->cnumber,\r
- 'commentbody' => Entity::hsc(Entity::shorten($current->cbody, 300, '...')),\r
- 'editbtn' => _LISTS_EDIT,\r
- 'delbtn' => _LISTS_DELETE,\r
- );\r
- if ( isset($current->mname) )\r
+ $body = strip_tags($current['cbody']);\r
+ $data = array(\r
+ 'commentdate' => date("Y-m-d@H:i", strtotime($current['ctime'])),\r
+ 'batchid' => listplug_nextBatchId(),\r
+ 'commentid' => $current['cnumber'],\r
+ 'commentbody' => Entity::hsc(Entity::shorten($current['cbody'], 300, '...')),\r
+ 'editbtn' => _LISTS_EDIT,\r
+ 'delbtn' => _LISTS_DELETE,\r
+ );\r
+ if ( isset($current['mname']) )\r
{\r
- $data['commentator'] = Entity::hsc($current->mname) . ' ' . _LIST_COMMENTS_MEMBER;\r
+ $data['commentator'] = Entity::hsc($current['mname']) . ' ' . _LIST_COMMENTS_MEMBER;\r
}\r
else\r
{\r
- $data['commentator'] = Entity::hsc($current->cuser);\r
+ $data['commentator'] = Entity::hsc($current['cuser']);\r
}\r
- if ( isset($current->cmail) && $current->cmail )\r
+ if ( isset($current['cmail']) && $current['cmail'] )\r
{\r
- $data['commentsite'] = Entity::hsc($current->cmail);\r
+ $data['commentsite'] = Entity::hsc($current['cmail']);\r
}\r
else\r
{\r
$data['commentsite'] = '';\r
}\r
- if ( isset($current->cemail) && $current->cemail )\r
+ if ( isset($current['cemail']) && $current['cemail'] )\r
{\r
- $data['commentmail'] = Entity::hsc($current->cemail);\r
+ $data['commentmail'] = Entity::hsc($current['cemail']);\r
}\r
else\r
{\r
}\r
if ( $vars['canAddBan'] )\r
{\r
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_ABAN']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_ABAN']) )\r
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_CMNTLIST_ABAN', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_ABAN']) )\r
{\r
- $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_ABAN'];\r
+ $subTpl = "<td style=\"white-space:nowrap\">"\r
+ . "<a href=\"index.php?action=banlistnewfromitem&itemid=<%itemid%>&ip=<%banip%>\" title=\"<%banhost%>\"><%banbtn%></a>"\r
+ . "</td>\n";\r
}\r
else\r
{\r
- $subTpl = "<td style=\"white-space:nowrap\"><a href=\"index.php?action=banlistnewfromitem&itemid=<%itemid%>&ip=<%banip%>\" title=\"<%banhost%>\"><%banbtn%></a></td>\n";\r
+ $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_ABAN'];\r
}\r
$subData = array(\r
- 'itemid' => $current->citem,\r
- 'banip' => Entity::hsc($current->cip),\r
- 'banbtn' => _LIST_COMMENT_BANIP,\r
- );\r
+ 'itemid' => $current['citem'],\r
+ 'banip' => Entity::hsc($current['cip']),\r
+ 'banbtn' => _LIST_COMMENT_BANIP,\r
+ );\r
$data['addbanlist'] = Template::fill($subTpl, $subData);\r
}\r
break;\r
case 'FOOT':\r
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_FOOT']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_FOOT']) )\r
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_CMNTLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_FOOT']) )\r
{\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_FOOT'];\r
+ $template = "";\r
}\r
else\r
{\r
- $template = "";\r
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_FOOT'];\r
}\r
- $subData = array();\r
+ $data = array();\r
break;\r
}\r
return Template::fill($template, $data);\r
}\r
\r
-function listplug_table_bloglist($vars, $type, $templateName = '')\r
+function listplug_table_bloglist($vars, $type, $template_name = '')\r
{\r
+ global $manager;\r
+ \r
$templates = array();\r
- if ( !empty($templateName) )\r
+ if ( !empty($template_name) )\r
{\r
- $templates = Template::read($templateName);\r
+ $templates =& $manager->getTemplate($template_name);\r
}\r
+ \r
switch( $type )\r
{\r
case 'HEAD':\r
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_BLOGLIST_HEAD']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_BLOGLIST_HEAD']) )\r
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_BLOGLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_BLOGLIST_HEAD']) )\r
{\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_BLOGLIST_HEAD'];\r
+ $template = "<th><%blognames%></th>\n"\r
+ . "<th colspan=\"7\"><%actionshead%></th>\n";\r
}\r
else\r
{\r
- $template = "<th><%blognames%></th>\n<th colspan=\"7\"><%actionshead%></th>\n";\r
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_BLOGLIST_HEAD'];\r
}\r
$data = array(\r
- 'blognames' => _NAME,\r
- 'actionshead' => _LISTS_ACTIONS,\r
- );\r
+ 'blognames' => _NAME,\r
+ 'actionshead' => _LISTS_ACTIONS,\r
+ );\r
break;\r
case 'BODY':\r
$current = $vars['current'];\r
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_BLOGLIST_BODY']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_BLOGLIST_BODY']) )\r
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_BLOGLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_BLOGLIST_BODY']) )\r
{\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_BLOGLIST_BODY'];\r
+ $template = "<td title=\"blogid:<%blogid%> shortname:<%shortname%>\">\n"\r
+ . "<a href=\"<%blogurl%>\"><img src=\"images/globe.gif\" width=\"13\" height=\"13\" alt=\"<%iconalt%>\" /></a><%blogname%></td>\n"\r
+ . "<td><a href=\"index.php?action=createitem&blogid=<%blogid%>\" title=\"<%ttaddtext%>\"><%addtext%></a></td>\n"\r
+ . "<td><a href=\"index.php?action=itemlist&blogid=<%blogid%>\" title=\"<%ttedittext%>\"><%edittext%></a></td>\n"\r
+ . "<td><a href=\"index.php?action=blogcommentlist&blogid=<%blogid%>\" title=\"<%ttcommenttext%>\"><%commenttext%></a></td>\n"\r
+ . "<td><a href=\"index.php?action=bookmarklet&blogid=<%blogid%>\" title=\"<%ttbmlettext%>\"><%bmlettext%></a></td>\n";\r
}\r
else\r
{\r
- $template = "<td title=\"blogid:<%blogid%> shortname:<%shortname%>\">\n"\r
- . "<a href=\"<%blogurl%>\"><img src=\"images/globe.gif\" width=\"13\" height=\"13\" alt=\"<%iconalt%>\" /></a><%blogname%></td>\n"\r
- . "<td><a href=\"index.php?action=createitem&blogid=<%blogid%>\" title=\"<%ttaddtext%>\"><%addtext%></a></td>\n"\r
- . "<td><a href=\"index.php?action=itemlist&blogid=<%blogid%>\" title=\"<%ttedittext%>\"><%edittext%></a></td>\n"\r
- . "<td><a href=\"index.php?action=blogcommentlist&blogid=<%blogid%>\" title=\"<%ttcommenttext%>\"><%commenttext%></a></td>\n"\r
- . "<td><a href=\"index.php?action=bookmarklet&blogid=<%blogid%>\" title=\"<%ttbmlettext%>\"><%bmlettext%></a></td>\n";\r
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_BLOGLIST_BODY'];\r
}\r
$data = array(\r
- 'blogid' => $current->bnumber,\r
- 'shortname' => Entity::hsc($current->bshortname),\r
- 'blogurl' => $current->burl,\r
- 'blogname' => Entity::hsc($current->bname),\r
- 'ttaddtext' => _BLOGLIST_TT_ADD,\r
- 'addtext' => _BLOGLIST_ADD,\r
- 'ttedittext' => _BLOGLIST_TT_EDIT,\r
- 'edittext' => _BLOGLIST_EDIT,\r
- 'ttcommenttext' => _BLOGLIST_TT_COMMENTS,\r
- 'commenttext' => _BLOGLIST_COMMENTS,\r
- 'ttbmlettext' => _BLOGLIST_TT_BMLET,\r
- 'bmlettext' => _BLOGLIST_BMLET,\r
+ 'blogid' => $current['bnumber'],\r
+ 'shortname' => Entity::hsc($current['bshortname']),\r
+ 'blogurl' => $current['burl'],\r
+ 'blogname' => Entity::hsc($current['bname']),\r
+ 'ttaddtext' => _BLOGLIST_TT_ADD,\r
+ 'addtext' => _BLOGLIST_ADD,\r
+ 'ttedittext' => _BLOGLIST_TT_EDIT,\r
+ 'edittext' => _BLOGLIST_EDIT,\r
+ 'ttcommenttext' => _BLOGLIST_TT_COMMENTS,\r
+ 'commenttext' => _BLOGLIST_COMMENTS,\r
+ 'ttbmlettext' => _BLOGLIST_TT_BMLET,\r
+ 'bmlettext' => _BLOGLIST_BMLET,\r
);\r
- if ( $current->tadmin == 1 )\r
+ if ( $current['tadmin'] == 1 )\r
{\r
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_BLIST_BD_TADM']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_BLIST_BD_TADM']) )\r
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_BLIST_BD_TADM', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_BLIST_BD_TADM']) )\r
{\r
- $template .= $templates['SHOWLIST_LISTPLUG_TABLE_BLIST_BD_TADM'];\r
+ $template .= "<td><a href=\"index.php?action=blogsettings&blogid=<%blogid%>\" title=\"<%ttsettingtext%>\"><%settingtext%></a></td>\n"\r
+ . "<td><a href=\"index.php?action=banlist&blogid=<%blogid%>\" title=\"<%ttbanstext%>\"><%banstext%></a></td>\n";\r
}\r
else\r
{\r
- $template .= "<td><a href=\"index.php?action=blogsettings&blogid=<%blogid%>\" title=\"<%ttsettingtext%>\"><%settingtext%></a></td>\n"\r
- . "<td><a href=\"index.php?action=banlist&blogid=<%blogid%>\" title=\"<%ttbanstext%>\"><%banstext%></a></td>\n";\r
+ $template .= $templates['SHOWLIST_LISTPLUG_TABLE_BLIST_BD_TADM'];\r
}\r
- $data['ttsettingtext'] = _BLOGLIST_TT_SETTINGS;\r
- $data['settingtext'] = _BLOGLIST_SETTINGS;\r
- $data['ttbanstext'] = _BLOGLIST_TT_BANS;\r
- $data['banstext'] = _BLOGLIST_BANS;\r
+ $data['ttsettingtext'] = _BLOGLIST_TT_SETTINGS;\r
+ $data['settingtext'] = _BLOGLIST_SETTINGS;\r
+ $data['ttbanstext'] = _BLOGLIST_TT_BANS;\r
+ $data['banstext'] = _BLOGLIST_BANS;\r
}\r
\r
if ( $vars['superadmin'] )\r
{\r
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_BLIST_BD_TADM']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_BLIST_BD_TADM']) )\r
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_BLIST_BD_SADM', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_BLIST_BD_TADM']) )\r
{\r
- $template .= $templates['SHOWLIST_LISTPLUG_TABLE_BLIST_BD_TADM'];\r
+ $template .= "<td><a href=\"index.php?action=deleteblog&blogid=<%blogid%>\" title=\"<%ttdeletetext%>\"><%deletetext%></a></td>\n";\r
}\r
else\r
{\r
- $template .= "<td><a href=\"index.php?action=deleteblog&blogid=<%blogid%>\" title=\"<%ttdeletetext%>\"></a><%deletetext%></td>\n";\r
+ $template .= $templates['SHOWLIST_LISTPLUG_TABLE_BLIST_BD_SADM'];\r
}\r
- $data['ttdeletetext'] = _BLOGLIST_TT_DELETE;\r
- $data['deletetext'] = _BLOGLIST_DELETE;\r
+ $data['ttdeletetext'] = _BLOGLIST_TT_DELETE;\r
+ $data['deletetext'] = _BLOGLIST_DELETE;\r
}\r
break;\r
case 'FOOT':\r
- $current = $vars['current'];\r
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_BLOGLIST_FOOT']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_BLOGLIST_FOOT']) )\r
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_BLOGLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_BLOGLIST_FOOT']) )\r
{\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_BLOGLIST_FOOT'];\r
+ $template = "\n";\r
}\r
else\r
{\r
- $template = "\n";\r
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_BLOGLIST_FOOT'];\r
}\r
$data = array();\r
break;\r
return Template::fill($template, $data);\r
}\r
\r
-function listplug_table_shortblognames($vars, $type, $templateName = '')\r
+function listplug_table_shortblognames($vars, $type, $template_name = '')\r
{\r
+ global $manager;\r
+ \r
$templates = array();\r
- if ( !empty($templateName) )\r
+ if ( !empty($template_name) )\r
{\r
- $templates = Template::read($templateName);\r
+ $templates =& $manager->getTemplate($template_name);\r
}\r
+ \r
switch( $type )\r
{\r
case 'HEAD':\r
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_HEAD']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_HEAD']) )\r
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_HEAD']) )\r
{\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_HEAD'];\r
+ $template = "<th><%colshortname%></th>\n"\r
+ . "<th><%colblogname%></th>\n";\r
}\r
else\r
{\r
- $template = "<th><%colshortname%></th>\n<th><%colblogname%></th>\n";\r
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_HEAD'];\r
}\r
$data = array(\r
- 'colshortname' => _EBLOG_SHORTNAME,\r
- 'colblogname' => _EBLOG_NAME,\r
- );\r
+ 'colshortname' => _EBLOG_SHORTNAME,\r
+ 'colblogname' => _EBLOG_NAME,\r
+ );\r
break;\r
case 'BODY':\r
$current = $vars['current'];\r
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_BODY']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_BODY']) )\r
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_BODY']) )\r
{\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_BODY'];\r
+ $template = "<td><%bshortname%></td>\n"\r
+ . "<td><%blogname%></td>\n";\r
}\r
else\r
{\r
- $template = "<td><%bshortname%></td>\n<td><%blogname%></td>\n";\r
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_BODY'];\r
}\r
$data = array(\r
- 'bshortname' => Entity::hsc($current->bshortname),\r
- 'blogname' => Entity::hsc($current->bname),\r
- );\r
+ 'bshortname' => Entity::hsc($current['bshortname']),\r
+ 'blogname' => Entity::hsc($current['bname']),\r
+ );\r
break;\r
case 'FOOT':\r
$current = $vars['current'];\r
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_FOOT']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_FOOT']) )\r
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_FOOT']) )\r
{\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_FOOT'];\r
+ $template = "\n";\r
}\r
else\r
{\r
- $template = "\n";\r
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_FOOT'];\r
}\r
$data = array();\r
break;\r
return Template::fill($template, $data);\r
}\r
\r
-function listplug_table_shortnames($vars, $type, $templateName = '')\r
+function listplug_table_shortnames($vars, $type, $template_name = '')\r
{\r
+ global $manager;\r
+ \r
$templates = array();\r
- if ( !empty($templateName) )\r
+ if ( !empty($template_name) )\r
{\r
- $templates = Template::read($templateName);\r
+ $templates =& $manager->getTemplate($template_name);\r
}\r
+ \r
switch( $type )\r
{\r
case 'HEAD':\r
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_SHORTNAM_HEAD']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_SHORTNAM_HEAD']) )\r
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_SHORTNAM_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_SHORTNAM_HEAD']) )\r
{\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_SHORTNAM_HEAD'];\r
+ $template = "<th><%colname%></th>\n"\r
+ . "<th><%coldesc%></th>\n";\r
}\r
else\r
{\r
- $template = "<th><%colname%></th><th><%coldesc%></th>\n";\r
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_SHORTNAM_HEAD'];\r
}\r
$data = array(\r
- 'colname' => _NAME,\r
- 'coldesc' => _LISTS_DESC,\r
- );\r
+ 'colname' => _NAME,\r
+ 'coldesc' => _LISTS_DESC,\r
+ );\r
break;\r
case 'BODY':\r
$current = $vars['current'];\r
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_SHORTNAM_BODY']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_SHORTNAM_BODY']) )\r
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_SHORTNAM_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_SHORTNAM_BODY']) )\r
{\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_SHORTNAM_BODY'];\r
+ $template = "<td><%name%></td>\n"\r
+ . "<td><%desc%></td>\n";\r
}\r
else\r
{\r
- $template = "<td><%name%></td><td><%desc%></td>\n";\r
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_SHORTNAM_BODY'];\r
}\r
$data = array(\r
- 'name' => Entity::hsc($current->name),\r
- 'desc' => Entity::hsc($current->description),\r
- );\r
+ 'name' => Entity::hsc($current['name']),\r
+ 'desc' => Entity::hsc($current['description']),\r
+ );\r
break;\r
case 'FOOT':\r
$current = $vars['current'];\r
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_SHORTNAM_FOOT']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_SHORTNAM_FOOT']) )\r
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_SHORTNAM_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_SHORTNAM_FOOT']) )\r
{\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_SHORTNAM_FOOT'];\r
+ $template = "\n";\r
}\r
else\r
{\r
- $template = "\n";\r
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_SHORTNAM_FOOT'];\r
}\r
$data = array();\r
break;\r
return Template::fill($template, $data);\r
}\r
\r
-function listplug_table_categorylist($vars, $type, $templateName = '')\r
+function listplug_table_categorylist($vars, $type, $template_name = '')\r
{\r
+ global $manager;\r
+ \r
$templates = array();\r
- if ( !empty($templateName) )\r
+ if ( !empty($template_name) )\r
{\r
- $templates = Template::read($templateName);\r
+ $templates =& $manager->getTemplate($template_name);\r
}\r
+ \r
switch( $type )\r
{\r
case 'HEAD':\r
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_CATELIST_HEAD']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_CATELIST_HEAD']) )\r
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_CATELIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_CATELIST_HEAD']) )\r
{\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_CATELIST_HEAD'];\r
+ $template = "<th><%colname%></th>\n"\r
+ . "<th><%coldesc%></th>\n"\r
+ . "<th colspan=\"2\"><%colact%></th>\n";\r
}\r
else\r
{\r
- $template = "<th><%colname%></th><th><%coldesc%></th><th colspan=\"2\"><%colact%></th>\n";\r
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_CATELIST_HEAD'];\r
}\r
$data = array(\r
- 'colname' => _LISTS_NAME,\r
- 'coldesc' => _LISTS_DESC,\r
- 'colact' => _LISTS_ACTIONS,\r
- );\r
+ 'colname' => _LISTS_NAME,\r
+ 'coldesc' => _LISTS_DESC,\r
+ 'colact' => _LISTS_ACTIONS,\r
+ );\r
break;\r
case 'BODY':\r
$current = $vars['current'];\r
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_CATELIST_BODY']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_CATELIST_BODY']) )\r
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_CATELIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_CATELIST_BODY']) )\r
{\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_CATELIST_BODY'];\r
+ $template = "<td>\n"\r
+ . "<input type=\"checkbox\" id=\"batch<%batchid%>\" name=\"batch[<%batchid%>]\" value=\"<%catid%>\" />\n"\r
+ . "<label for=\"batch<%batchid%>\"><%catname%></label>\n"\r
+ . "</td>\n"\r
+ . "<td><%catdesc%></td>\n"\r
+ . "<td><a href=\"index.php?action=categoryedit&blogid=<%blogid%>&catid=<%catid%>\" tabindex=\"<%tabindex%>\"><%editbtn%></a></td>\n"\r
+ . "<td><a href=\"index.php?action=categorydelete&blogid=<%blogid%>&catid=<%catid%>\" tabindex=\"<%tabindex%>\"><%delbtn%></a></td>\n";\r
}\r
else\r
{\r
- $template = "<td>\n"\r
- . "<input type=\"checkbox\" id=\"batch<%batchid%>\" name=\"batch[<%batchid%>]\" value=\"<%catid%>\" />\n"\r
- . "<label for=\"batch<%batchid%>\"><%catname%></label>\n"\r
- . "</td>\n"\r
- . "<td><%catdesc%></td>\n"\r
- . "<td><a href=\"index.php?action=categoryedit&blogid=<%blogid%>&catid=<%catid%>\" tabindex=\"<%tabindex%>\"><%editbtn%></a></td>\n"\r
- . "<td><a href=\"index.php?action=categorydelete&blogid=<%blogid%>&catid=<%catid%>\" tabindex=\"<%tabindex%>\"><%delbtn%></a></td>\n";\r
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_CATELIST_BODY'];\r
}\r
+ \r
$data = array(\r
- 'batchid' => listplug_nextBatchId(),\r
- 'catid' => intval($current->catid),\r
- 'catname' => Entity::hsc($current->cname),\r
- 'catdesc' => Entity::hsc($current->cdesc),\r
- 'blogid' => intval($current->catcblogid),\r
- 'tabindex' => intval($vars['tabindex']),\r
- 'editbtn' => _LISTS_EDIT,\r
- 'delbtn' => _LISTS_DELETE,\r
- );\r
+ 'batchid' => listplug_nextBatchId(),\r
+ 'catid' => intval($current['catid']),\r
+ 'catname' => Entity::hsc($current['cname']),\r
+ 'catdesc' => Entity::hsc($current['cdesc']),\r
+ 'blogid' => intval($current['cblog']),\r
+ 'tabindex' => intval($vars['tabindex']),\r
+ 'editbtn' => _LISTS_EDIT,\r
+ 'delbtn' => _LISTS_DELETE,\r
+ );\r
break;\r
case 'FOOT':\r
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_CATELIST_FOOT']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_CATELIST_FOOT']) )\r
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_CATELIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_CATELIST_FOOT']) )\r
{\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_CATELIST_FOOT'];\r
+ $template = "\n";\r
}\r
else\r
{\r
- $template = "\n";\r
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_CATELIST_FOOT'];\r
}\r
$data = array();\r
break;\r
return Template::fill($template, $data);\r
}\r
\r
-function listplug_table_templatelist($vars, $type, $templateName = '')\r
+function listplug_table_templatelist($vars, $type, $template_name = '')\r
{\r
+ global $manager, $CONF;\r
+ \r
$templates = array();\r
- if ( !empty($templateName) )\r
+ if ( !empty($template_name) )\r
{\r
- $templates = Template::read($templateName);\r
+ $templates =& $manager->getTemplate($template_name);\r
}\r
- global $manager;\r
+ \r
switch( $type )\r
{\r
case 'HEAD':\r
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_HEAD']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_HEAD']) )\r
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_TPLTLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_HEAD']) )\r
{\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_HEAD'];\r
+ $template = "<th><%colname%></th>\n"\r
+ . "<th><%coldesc%></th>\n"\r
+ . "<th colspan=\"3\"><%colact%></th>\n";\r
}\r
else\r
{\r
- $template = "<th><%colname%></th><th><%coldesc%></th><th colspan=\"3\"><%colact%></th>\n";\r
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_HEAD'];\r
}\r
$data = array(\r
- 'colname' => _LISTS_NAME,\r
- 'coldesc' => _LISTS_DESC,\r
- 'colact' => _LISTS_ACTIONS,\r
- );\r
+ 'colname' => _LISTS_NAME,\r
+ 'coldesc' => _LISTS_DESC,\r
+ 'colact' => _LISTS_ACTIONS,\r
+ );\r
break;\r
case 'BODY':\r
$current = $vars['current'];\r
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_BODY']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_BODY']) )\r
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_TPLTLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_BODY']) )\r
{\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_BODY'];\r
+ $template = "<td><%templatename%></td>\n"\r
+ . "<td><%templatedesc%></td>\n"\r
+ . "<td style=\"white-space:nowrap\">"\r
+ . "<a href=\"<%editurl%>\" tabindex=\"<%tabindex%>\"><%editbtn%></a>\n"\r
+ . "</td>\n"\r
+ . "<td style=\"white-space:nowrap\">\n"\r
+ . "<a href=\"<%cloneurl%>\" tabindex=\"<%tabindex%>\"><%clonebtn%></a>\n"\r
+ . "</td>\n"\r
+ . "<td style=\"white-space:nowrap\">\n"\r
+ . "<a href=\"<%deleteurl%>\" tabindex=\"<%tabindex%>\"><%delbtn%></a>\n"\r
+ . "</td>\n";\r
}\r
else\r
{\r
- $template = "<td><%templatename%></td>\n"\r
- . "<td><%templatedesc%></td>\n"\r
- . "<td style=\"white-space:nowrap\">"\r
- . "<a href=\"index.php?action=templateedit&templateid=<%templateid%>\" tabindex=\"<%tabindex%>\"><%editbtn%></a>\n"\r
- . "</td>\n"\r
- . "<td style=\"white-space:nowrap\">\n"\r
- . "<a href=\"<%cloneurl%>\" tabindex=\"<%tabindex%>\"><%clonebtn%></a>\n"\r
- . "</td>\n"\r
- . "<td style=\"white-space:nowrap\">\n"\r
- . "<a href=\"index.php?action=templatedelete&templateid=<%templateid%>\" tabindex=\"<%tabindex%>\"><%delbtn%></a>\n"\r
- . "</td>\n";\r
- }\r
- $url = "index.php?action=templateclone&templateid={$current->tdnumber}";\r
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_BODY'];\r
+ }\r
+ \r
$data = array(\r
- 'templatename' => Entity::hsc($current->tdname),\r
- 'templatedesc' => Entity::hsc($current->tddesc),\r
- 'templateid' => (integer) $current->tdnumber,\r
- 'tabindex' => (integer) $vars['tabindex'],\r
- 'cloneurl' => Entity::hsc($manager->addTicketToUrl($url)),\r
- 'editbtn' => _LISTS_EDIT,\r
- 'clonebtn' => _LISTS_CLONE,\r
- 'delbtn' => _LISTS_DELETE,\r
+ 'templatename' => Entity::hsc($current['tdname']),\r
+ 'templatedesc' => Entity::hsc($current['tddesc']),\r
+ 'templateid' => (integer) $current['tdnumber'],\r
+ 'tabindex' => (integer) $vars['tabindex'],\r
+ \r
+ 'clonebtn' => _LISTS_CLONE,\r
+ 'cloneaction' => $vars['cloneaction'],\r
+ 'cloneurl' => "{$CONF['AdminURL']}index.php?action={$vars['cloneaction']}&templateid={$current['tdnumber']}",\r
+ \r
+ 'delbtn' => _LISTS_DELETE,\r
+ 'deleteaction' => $vars['deleteaction'],\r
+ 'deleteurl' => "{$CONF['AdminURL']}index.php?action={$vars['deleteaction']}&templateid={$current['tdnumber']}",\r
+ \r
+ 'editbtn' => _LISTS_EDIT,\r
+ 'editaction' => $vars['editaction'],\r
+ 'editurl' => "{$CONF['AdminURL']}index.php?action={$vars['editaction']}&templateid={$current['tdnumber']}"\r
);\r
break;\r
case 'FOOT':\r
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_FOOT']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_FOOT']) )\r
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_TPLTLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_FOOT']) )\r
{\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_FOOT'];\r
+ $template = "\n";\r
}\r
else\r
{\r
- $template = "\n";\r
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_FOOT'];\r
}\r
$data = array();\r
break;\r
return Template::fill($template, $data);\r
}\r
\r
-function listplug_table_skinlist($vars, $type, $templateName = '')\r
+function listplug_table_skinlist($vars, $type, $template_name = '')\r
{\r
+ global $CONF, $DIR_SKINS, $manager;\r
+ \r
$templates = array();\r
- if ( !empty($templateName) )\r
+ if ( !empty($template_name) )\r
{\r
- $templates = Template::read($templateName);\r
+ $templates =& $manager->getTemplate($template_name);\r
}\r
- global $CONF, $DIR_SKINS, $manager;\r
+ \r
switch( $type )\r
{\r
case 'HEAD':\r
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_HEAD']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_HEAD']) )\r
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_SKINLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_HEAD']) )\r
{\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_HEAD'];\r
+ $template = "<th><%colname%></th>\n"\r
+ . "<th><%coldesc%></th>\n"\r
+ . "<th colspan=\"3\"><%colact%></th>\n";\r
}\r
else\r
{\r
- $template = "<th><%colname%></th><th><%coldesc%></th><th colspan=\"3\"><%colact%></th>\n";\r
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_HEAD'];\r
}\r
$data = array(\r
- 'colname' => _LISTS_NAME,\r
- 'coldesc' => _LISTS_DESC,\r
- 'colact' => _LISTS_ACTIONS,\r
- );\r
+ 'colname' => _LISTS_NAME,\r
+ 'coldesc' => _LISTS_DESC,\r
+ 'colact' => _LISTS_ACTIONS,\r
+ );\r
break;\r
case 'BODY':\r
$current = $vars['current'];\r
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_BODY']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_BODY']) )\r
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_SKINLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_BODY']) )\r
{\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_BODY'];\r
+ $template = "<td><%skinname%><br /><br />\n"\r
+ . "<%skintypelabel%> <%skintype%><br />\n"\r
+ . "<%incmodelabel%> <%incmode%><br />\n"\r
+ . "<%incpreflabel%> <%incpref%><br />\n"\r
+ . "<%skinthumb%>"\r
+ . "<%readme%></td>\n"\r
+ . "<td class=\"availableSkinTypes\"><%skindesc%><%skinparts%></td>\n"\r
+ . "<td style=\"white-space:nowrap\">"\r
+ . "<a href=\"index.php?action=skinedit&skinid=<%skinid%>\" tabindex=\"<%tabindex%>\"><%editbtn%></a>"\r
+ . "</td>\n"\r
+ . "<td style=\"white-space:nowrap\">"\r
+ . "<a href=\"<%cloneurl%>\" tabindex=\"<%tabindex%>\"><%clonebtn%></a>"\r
+ . "</td>\n"\r
+ . "<td style=\"white-space:nowrap\">"\r
+ . "<a href=\"index.php?action=skindelete&skinid=<%skinid%>\" tabindex=\"<%tabindex%>\"><%delbtn%></a>"\r
+ . "</td>\n";\r
}\r
else\r
{\r
- $template = "<td><%skinname%><br /><br />\n"\r
- . "<%skintypelabel%> <%skintype%><br />\n"\r
- . "<%incmodelabel%> <%incmode%><br />\n"\r
- . "<%incpreflabel%> <%incpref%><br />\n"\r
- . "<%skinthumb%>"\r
- . "<%readme%></td>\n"\r
- . "<td class=\"availableSkinTypes\"><%skindesc%><%skinparts%></td>\n"\r
- . "<td style=\"white-space:nowrap\">"\r
- . "<a href=\"index.php?action=skinedit&skinid=<%skinid%>\" tabindex=\"<%tabindex%>\"><%editbtn%>"\r
- . "</a></td>\n"\r
- . "<td style=\"white-space:nowrap\">"\r
- . "<a href=\"<%cloneurl%>\" tabindex=\"<%tabindex%>\"><%clonebtn%>"\r
- . "</a></td>\n"\r
- . "<td style=\"white-space:nowrap\">"\r
- . "<a href=\"index.php?action=skindelete&skinid=<%skinid%>\" tabindex=\"<%tabindex%>\"><%delbtn%>"\r
- . "</a></td>\n";\r
- }\r
- $url = $manager->addTicketToUrl('index.php?action=skinclone&skinid=' . intval($current->sdnumber));\r
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_BODY'];\r
+ }\r
+ \r
$data = array(\r
- 'skintypelabel' => _LISTS_TYPE,\r
- 'skintype' => Entity::hsc($current->sdtype),\r
- 'incmodelabel' => _LIST_SKINS_INCMODE,\r
- 'incmode' => ($current->sdincmode == 'skindir') ? _PARSER_INCMODE_SKINDIR : _PARSER_INCMODE_NORMAL,\r
- 'incpreflabel' => ($current->sdincpref) ? _LIST_SKINS_INCMODE : '',\r
- 'incpref' => ($current->sdincpref) ? Entity::hsc($current->sdincpref) : '',\r
- 'skindesc' => Entity::hsc($current->sddesc),\r
- 'skinid' => (integer) $current->sdnumber,\r
- 'tabindex' => $vars['tabindex'],\r
- 'cloneurl' => Entity::hsc($url),\r
- 'editbtn' => _LISTS_EDIT,\r
- 'clonebtn' => _LISTS_CLONE,\r
- 'delbtn' => _LISTS_DELETE,\r
- );\r
- // use a special style for the default skin\r
- if ( $current->sdnumber == $CONF['BaseSkin'] )\r
+ 'tabindex' => $vars['tabindex']++,\r
+ \r
+ 'skinid' => (integer) $current['sdnumber'],\r
+ 'skindesc' => Entity::hsc($current['sddesc']),\r
+ \r
+ 'skintypelabel' => _LISTS_TYPE,\r
+ 'skintype' => Entity::hsc($current['sdtype']),\r
+ \r
+ 'incmodelabel' => _LIST_SKINS_INCMODE,\r
+ 'incmode' => ($current['sdincmode'] == 'skindir') ? _PARSER_INCMODE_SKINDIR : _PARSER_INCMODE_NORMAL,\r
+ \r
+ 'incpreflabel' => ($current['sdincpref']) ? _LIST_SKINS_INCMODE : '',\r
+ 'incpref' => ($current['sdincpref']) ? Entity::hsc($current['sdincpref']) : '',\r
+ \r
+ 'editbtn' => _LISTS_EDIT,\r
+ 'editaction' => $vars['editaction'],\r
+ 'editurl' => "{$CONF['AdminURL']}index.php?action={$vars['editaction']}&skinid={$current['sdnumber']}",\r
+ \r
+ 'clonebtn' => _LISTS_CLONE,\r
+ 'cloneaction' => $vars['cloneaction'],\r
+ 'cloneurl' => "{$CONF['AdminURL']}index.php?action={$vars['cloneaction']}&skinid={$current['sdnumber']}",\r
+ \r
+ 'delbtn' => _LISTS_DELETE,\r
+ 'deleteaction' => $vars['deleteaction'],\r
+ 'deleteurl' => "{$CONF['AdminURL']}index.php?action={$vars['deleteaction']}&skinid={$current['sdnumber']}"\r
+ );\r
+ \r
+ if ( $current['sdnumber'] != $vars['default'] )\r
{\r
- $data['skinname'] = '<strong>' . Entity::hsc($current->sdname) . '</strong>';\r
+ $data['skinname'] = Entity::hsc($current['sdname']);\r
}\r
else\r
{\r
- $data['skinname'] = Entity::hsc($current->sdname);\r
+ $data['skinname'] = '<strong>' . Entity::hsc($current['sdname']) . '</strong>';\r
}\r
-\r
+ \r
// add preview image when present\r
- if ( $current->sdincpref && @file_exists("{$DIR_SKINS}{$current->sdincpref}preview.png") )\r
+ if ( $current['sdincpref'] && @file_exists("{$DIR_SKINS}{$current['sdincpref']}preview.png") )\r
{\r
$data['skinthumb'] = "<p>\n";\r
-\r
- $alternatve_text = sprintf(_LIST_SKIN_PREVIEW, $current->sdname);\r
- $has_enlargement = @file_exists($DIR_SKINS . $current->sdincpref . 'preview-large.png');\r
+ \r
+ $alternatve_text = sprintf(_LIST_SKIN_PREVIEW, $current['sdname']);\r
+ $has_enlargement = @file_exists($DIR_SKINS . $current['sdincpref'] . 'preview-large.png');\r
if ( $has_enlargement )\r
{\r
- $data['skinthumb'] .= '<a href="' . $CONF['SkinsURL'] . Entity::hsc($current->sdincpref) . 'preview-large.png" title="' . _LIST_SKIN_PREVIEW_VIEWLARGER . "\">\n";\r
+ $data['skinthumb'] .= '<a href="' . $CONF['SkinsURL'] . Entity::hsc($current['sdincpref']) . 'preview-large.png" title="' . _LIST_SKIN_PREVIEW_VIEWLARGER . "\">\n";\r
}\r
- $data['skinthumb'] .= '<img class="skinpreview" src="' . $CONF['SkinsURL'] . Entity::hsc($current->sdincpref) . 'preview.png" width="100" height="75" alt="' . $alternatve_text . "\" />\n";\r
+ $data['skinthumb'] .= '<img class="skinpreview" src="' . $CONF['SkinsURL'] . Entity::hsc($current['sdincpref']) . 'preview.png" width="100" height="75" alt="' . $alternatve_text . "\" />\n";\r
if ( $has_enlargement )\r
{\r
$data['skinthumb'] .= "</a><br />\n";\r
}\r
\r
- if ( @file_exists("{$DIR_SKINS}{$current->sdincpref}readme.html") )\r
+ if ( @file_exists("{$DIR_SKINS}{$current['sdincpref']}readme.html") )\r
{\r
- $url = $CONF['SkinsURL'] . Entity::hsc($current->sdincpref) . 'readme.html';\r
- $title = sprintf(_LIST_SKIN_README, $current->sdname);\r
+ $url = $CONF['SkinsURL'] . Entity::hsc($current['sdincpref']) . 'readme.html';\r
+ $title = sprintf(_LIST_SKIN_README, $current['sdname']);\r
$data['readme'] = "<a href=\"{$url}\" title=\"{$title}\">" . _LIST_SKIN_README_TXT . "</a>\n";\r
}\r
else\r
\r
$data['skinthumb'] .= "</p>\n";\r
}\r
- /* show list of defined parts */\r
- $query = "SELECT stype FROM %s WHERE sdesc=%d ORDER BY stype";\r
- $query = sprintf($query, sql_table('skin'), $current->sdnumber);\r
- $r = sql_query($query);\r
\r
- $types = array();\r
- while ( $o = sql_fetch_object($r) )\r
- {\r
- array_push($types, $o->stype);\r
- }\r
- if ( sizeof($types) > 0 )\r
+ if ( !preg_match('#^admin#', $current['sdname']) )\r
{\r
- for ( $i = 0; $i < sizeof($types); $i++ )\r
- {\r
- $type = $types[$i];\r
- if ( !array_key_exists($type, $template['friendly_names']) || $type == strtolower($template['friendly_names'][$type]) )\r
- {\r
- $article = 'skinpartspecial';\r
- }\r
- else\r
- {\r
- $article = "skinpart{$type}";\r
- }\r
- $types[$i] = "<li>\n"\r
- . helpHtml($article) . "\n"\r
- . "<a href=\"index.php?action=skinedittype&skinid={$current->sdnumber}&type={$type}\" tabindex=\"{$template['tabindex']}\">"\r
- . Entity::hsc($template['friendly_names'][$type])\r
- . "</a>\n"\r
- . "</li>\n";\r
- }\r
- $data['skinparts'] = '<br /><br />' . _LIST_SKINS_DEFINED . "<ul>\n" . implode($types, '') . "</ul>\n";\r
+ $skin =& $manager->getSkin($current['sdnumber']);\r
}\r
else\r
{\r
- $data['skinparts'] = '';\r
+ $skin =& $manager->getSkin($current['sdnumber'], 'AdminActions');\r
}\r
+ $available_types = $skin->getAvailableTypes();\r
+ \r
+ $data['skinparts'] = _LIST_SKINS_DEFINED\r
+ . "<ul>\n";\r
+ foreach ( $available_types as $type => $label )\r
+ {\r
+ if ( $label === FALSE )\r
+ {\r
+ $label = ucfirst($type);\r
+ $article = 'skinpartspecial';\r
+ }\r
+ else\r
+ {\r
+ $article = "skinpart{$type}";\r
+ }\r
+ $data['skinparts'] .= "<li>\n"\r
+ . helpHtml($article) . "\n"\r
+ . "<a href=\"{$CONF['AdminURL']}index.php?action={$vars['edittypeaction']}&skinid={$current['sdnumber']}&type={$type}\" tabindex=\"{$vars['tabindex']}\">"\r
+ . Entity::hsc($label)\r
+ . "</a>\n"\r
+ . "</li>\n";\r
+ }\r
+ $data['skinparts'] .= "</ul>\n";\r
break;\r
case 'FOOT':\r
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_FOOT']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_FOOT']) )\r
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_SKINLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_FOOT']) )\r
{\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_FOOT'];\r
+ $template = "";\r
}\r
else\r
{\r
- $template = "";\r
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_FOOT'];\r
}\r
$data = array();\r
break;\r
return Template::fill($template, $data);\r
}\r
\r
-function listplug_table_draftlist($vars, $type, $templateName = '')\r
+function listplug_table_draftlist($vars, $type, $template_name = '')\r
{\r
+ global $manager;\r
+ \r
$templates = array();\r
- if ( !empty($templateName) )\r
+ if ( !empty($template_name) )\r
{\r
- $templates = Template::read($templateName);\r
+ $templates =& $manager->getTemplate($template_name);\r
}\r
switch( $type )\r
{\r
case 'HEAD':\r
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_DRFTLIST_HEAD']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_DRFTLIST_HEAD']) )\r
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_DRFTLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_DRFTLIST_HEAD']) )\r
{\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_DRFTLIST_HEAD'];\r
+ $template = "<th><%colblog%></th>\n"\r
+ . "<th><%coldesc%></th>\n"\r
+ . "<th colspan=\"2\"><%colact%></th>\n";\r
}\r
else\r
{\r
- $template = "<th><%colblog%></th><th><%coldesc%></th><th colspan=\"2\"><%colact%></th>\n";\r
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_DRFTLIST_HEAD'];\r
}\r
$data = array(\r
- 'colblog' => _LISTS_BLOG,\r
- 'coldesc' => _LISTS_TITLE,\r
- 'colact' => _LISTS_ACTIONS,\r
- );\r
+ 'colblog' => _LISTS_BLOG,\r
+ 'coldesc' => _LISTS_TITLE,\r
+ 'colact' => _LISTS_ACTIONS,\r
+ );\r
break;\r
case 'BODY':\r
$current = $vars['current'];\r
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_DRFTLIST_BODY']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_DRFTLIST_BODY']) )\r
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_DRFTLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_DRFTLIST_BODY']) )\r
{\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_DRFTLIST_BODY'];\r
+ $template = "<td><%bshortname%></td>\n"\r
+ . "<td><%ititle%></td>\n"\r
+ . "<td><a href=\"index.php?action=itemedit&itemid=<%itemid%>\"><%editbtn%></a></td>\n"\r
+ . "<td><a href=\"index.php?action=itemdelete&itemid=<%itemid%>\"><%delbtn%></a></td>\n";\r
}\r
else\r
{\r
- $template = "<td><%bshortname%></td>\n"\r
- . "<td><%ititle%></td>\n"\r
- . "<td><a href=\"index.php?action=itemedit&itemid=<%itemid%>\"><%editbtn%></a></td>\n"\r
- . "<td><a href=\"index.php?action=itemdelete&itemid=<%itemid%>\"><%delbtn%></a></td>\n";\r
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_DRFTLIST_BODY'];\r
}\r
$data = array(\r
- 'bshortname' => Entity::hsc($current->bshortname),\r
- 'ititle' => Entity::hsc(strip_tags($current->ititle)),\r
- 'itemid' => intval($current->inumber),\r
- 'editbtn' => _LISTS_EDIT,\r
- 'delbtn' => _LISTS_DELETE,\r
+ 'bshortname' => Entity::hsc($current['bshortname']),\r
+ 'ititle' => Entity::hsc(strip_tags($current['ititle'])),\r
+ 'itemid' => intval($current['inumber']),\r
+ 'editbtn' => _LISTS_EDIT,\r
+ 'delbtn' => _LISTS_DELETE,\r
);\r
break;\r
case 'FOOT':\r
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_DRFTLIST_FOOT']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_DRFTLIST_FOOT']) )\r
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_DRFTLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_DRFTLIST_FOOT']) )\r
{\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_DRFTLIST_FOOT'];\r
+ $template = "\n";\r
}\r
else\r
{\r
- $template = "\n";\r
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_DRFTLIST_FOOT'];\r
}\r
$data = array();\r
break;\r
return Template::fill($template, $data);\r
}\r
\r
-function listplug_table_otherdraftlist($vars, $type, $templateName = '')\r
+function listplug_table_otherdraftlist($vars, $type, $template_name = '')\r
{\r
+ global $manager;\r
+ \r
$templates = array();\r
- if ( !empty($templateName) )\r
+ if ( !empty($template_name) )\r
{\r
- $templates = Template::read($templateName);\r
+ $templates =& $manager->getTemplate($template_name);\r
}\r
+ \r
switch( $type )\r
{\r
case 'HEAD':\r
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_HEAD']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_HEAD']) )\r
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_HEAD']) )\r
{\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_HEAD'];\r
+ $template = "<th><%colblog%></th>\n"\r
+ . "<th><%coldesc%></th>\n"\r
+ . "<th><%colautr%></th>\n"\r
+ . "<th colspan=\"2\"><%colact%></th>\n";\r
}\r
else\r
{\r
- $template = "<th><%colblog%></th><th><%coldesc%></th><th><%colautr%></th><th colspan=\"2\"><%colact%></th>\n";\r
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_HEAD'];\r
}\r
$data = array(\r
- 'colblog' => _LISTS_BLOG,\r
- 'coldesc' => _LISTS_TITLE,\r
- 'colautr' => _LISTS_AUTHOR,\r
- 'colact' => _LISTS_ACTIONS,\r
- );\r
+ 'colblog' => _LISTS_BLOG,\r
+ 'coldesc' => _LISTS_TITLE,\r
+ 'colautr' => _LISTS_AUTHOR,\r
+ 'colact' => _LISTS_ACTIONS,\r
+ );\r
break;\r
case 'BODY':\r
$current = $vars['current'];\r
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_BODY']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_BODY']) )\r
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_BODY']) )\r
{\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_BODY'];\r
+ $template = "<td><%bshortname%></td>\n"\r
+ . "<td><%ititle%></td>\n"\r
+ . "<td><%iauthor%></td>\n"\r
+ . "<td><a href=\"index.php?action=itemedit&itemid=<%itemid%>\"><%editbtn%></a></td>\n"\r
+ . "<td><a href=\"index.php?action=itemdelete&itemid=<%itemid%>\"><%delbtn%></a></td>\n";\r
}\r
else\r
{\r
- $template = "<td><%bshortname%></td>\n"\r
- . "<td><%ititle%></td>\n"\r
- . "<td><%iauthor%></td>\n"\r
- . "<td><a href=\"index.php?action=itemedit&itemid=<%itemid%>\"><%editbtn%></a></td>\n"\r
- . "<td><a href=\"index.php?action=itemdelete&itemid=<%itemid%>\"><%delbtn%></a></td>\n";\r
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_BODY'];\r
}\r
$data = array(\r
- 'bshortname' => Entity::hsc($current->bshortname),\r
- 'ititle' => Entity::hsc(strip_tags($current->ititle)),\r
- 'iauthor' => Entity::hsc(strip_tags($current->mname)),\r
- 'itemid' => intval($current->inumber),\r
- 'editbtn' => _LISTS_EDIT,\r
- 'delbtn' => _LISTS_DELETE,\r
+ 'bshortname' => Entity::hsc($current['bshortname']),\r
+ 'ititle' => Entity::hsc(strip_tags($current['ititle'])),\r
+ 'iauthor' => Entity::hsc(strip_tags($current['mname'])),\r
+ 'itemid' => intval($current['inumber']),\r
+ 'editbtn' => _LISTS_EDIT,\r
+ 'delbtn' => _LISTS_DELETE,\r
);\r
break;\r
case 'FOOT':\r
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_FOOT']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_FOOT']) )\r
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_FOOT']) )\r
{\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_FOOT'];\r
+ $template = "\n";\r
}\r
else\r
{\r
- $template = "\n";\r
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_FOOT'];\r
}\r
$data = array();\r
break;\r
return Template::fill($template, $data);\r
}\r
\r
-function listplug_table_actionlist($vars, $type, $templateName = '')\r
+function listplug_table_actionlist($vars, $type, $template_name = '')\r
{\r
+ global $manager;\r
+ \r
$templates = array();\r
- if ( !empty($templateName) )\r
+ if ( !empty($template_name) )\r
{\r
- $templates = Template::read($templateName);\r
+ $templates =& $manager->getTemplate($template_name);\r
}\r
+ \r
switch( $type )\r
{\r
case 'HEAD':\r
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_ACTNLIST_HEAD']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_ACTNLIST_HEAD']) )\r
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_ACTNLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_ACTNLIST_HEAD']) )\r
{\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_ACTNLIST_HEAD'];\r
+ $template = "<th><%coltime%></th>\n"\r
+ . "<th><%colmesg%></th>\n";\r
}\r
else\r
{\r
- $template = "<th><%coltime%></th><th><%colmesg%></th>\n";\r
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_ACTNLIST_HEAD'];\r
}\r
$data = array(\r
- 'coltime' => _LISTS_TIME,\r
- 'colmesg' => _LIST_ACTION_MSG,\r
- );\r
+ 'coltime' => _LISTS_TIME,\r
+ 'colmesg' => _LIST_ACTION_MSG,\r
+ );\r
break;\r
case 'BODY':\r
$current = $vars['current'];\r
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_ACTNLIST_BODY']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_ACTNLIST_BODY']) )\r
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_ACTNLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_ACTNLIST_BODY']) )\r
{\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_ACTNLIST_BODY'];\r
+ $template = "<td><%timestamp%></td>\n"\r
+ . "<td><%message%></td>\n";\r
}\r
else\r
{\r
- $template = "<td><%timestamp%></td><td><%message%></td>\n";\r
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_ACTNLIST_BODY'];\r
}\r
$data = array(\r
- 'timestamp' => Entity::hsc($current->timestamp),\r
- 'message' => Entity::hsc($current->message),\r
- );\r
+ 'timestamp' => Entity::hsc($current['timestamp']),\r
+ 'message' => Entity::hsc($current['message']),\r
+ );\r
break;\r
case 'FOOT':\r
$current = $vars['current'];\r
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_ACTNLIST_FOOT']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_ACTNLIST_FOOT']) )\r
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_ACTNLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_ACTNLIST_FOOT']) )\r
{\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_ACTNLIST_FOOT'];\r
+ $template = "\n";\r
}\r
else\r
{\r
- $template = "\n";\r
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_ACTNLIST_FOOT'];\r
}\r
$data = array();\r
break;\r
return Template::fill($template, $data);\r
}\r
\r
-function listplug_table_banlist($vars, $type, $templateName = '')\r
+function listplug_table_banlist($vars, $type, $template_name = '')\r
{\r
+ global $manager;\r
+ \r
$templates = array();\r
- if ( !empty($templateName) )\r
+ if ( !empty($template_name) )\r
{\r
- $templates = Template::read($templateName);\r
+ $templates =& $manager->getTemplate($template_name);\r
}\r
+ \r
switch( $type )\r
{\r
case 'HEAD':\r
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_IBANLIST_HEAD']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_IBANLIST_HEAD']) )\r
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_IBANLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_IBANLIST_HEAD']) )\r
{\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_IBANLIST_HEAD'];\r
+ $template = "<th><%iprange%></th>\n"\r
+ . "<th><%reason%></th>\n"\r
+ . "<th><%colact%></th>\n";\r
}\r
else\r
{\r
- $template = "<th><%iprange%></th><th><%reason%></th><th><%colact%></th>\n";\r
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_IBANLIST_HEAD'];\r
}\r
$data = array(\r
- 'iprange' => _LIST_BAN_IPRANGE,\r
- 'reason' => _LIST_BAN_REASON,\r
- 'colact' => _LISTS_ACTIONS,\r
+ 'iprange' => _LIST_BAN_IPRANGE,\r
+ 'reason' => _LIST_BAN_REASON,\r
+ 'colact' => _LISTS_ACTIONS,\r
);\r
break;\r
case 'BODY':\r
$current = $vars['current'];\r
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_IBANLIST_BODY']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_IBANLIST_BODY']) )\r
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_IBANLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_IBANLIST_BODY']) )\r
{\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_IBANLIST_BODY'];\r
+ $template = "<td><%iprange%></td>\n"\r
+ . "<td><%reason%></td>\n"\r
+ . "<td><a href=\"index.php?action=banlistdelete&blogid=<%blogid%>&iprange=<%iprange%>\"><%delbtn%></a></td>\n";\r
}\r
else\r
{\r
- $template = "<td><%iprange%></td>\n"\r
- . "<td><%reason%></td>\n"\r
- . "<td><a href=\"index.php?action=banlistdelete&blogid=<%blogid%>&iprange=<%iprange%>\"><%delbtn%></a></td>\n";\r
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_IBANLIST_BODY'];\r
}\r
$data = array(\r
- 'iprange' => Entity::hsc($current->iprange),\r
- 'reason' => Entity::hsc($current->reason),\r
- 'blogid' => intval($current->blogid),\r
- 'delbtn' => _LISTS_DELETE,\r
+ 'iprange' => Entity::hsc($current['iprange']),\r
+ 'reason' => Entity::hsc($current['reason']),\r
+ 'blogid' => intval($current['blogid']),\r
+ 'delbtn' => _LISTS_DELETE,\r
);\r
break;\r
case 'FOOT':\r
$current = $vars['current'];\r
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_IBANLIST_FOOT']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_IBANLIST_FOOT']) )\r
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_IBANLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_IBANLIST_FOOT']) )\r
{\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_IBANLIST_FOOT'];\r
+ $template = "\n";\r
}\r
else\r
{\r
- $template = "\n";\r
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_IBANLIST_FOOT'];\r
}\r
$data = array();\r
break;\r
return Template::fill($template, $data);\r
}\r
\r
-function listplug_table_adminskinlist($vars, $type, $templateName = '')\r
+/**\r
+ * listplug_list_normalskinlist()\r
+ * \r
+ * @param array $vars array for variables\r
+ * @param string $type HEAD/BODY/FOOT\r
+ * @param string $template_name name of template\r
+ * @return string marked-up string\r
+ */\r
+function listplug_list_normalskinlist($vars, $type, $template_name = '')\r
{\r
- global $CONF, $DIR_SKINS, $DIR_NUCLEUS, $manager;\r
- $adminSkinURL = $CONF['AdminURL'] . 'adminskins/';\r
- $adminSkinDir = $DIR_NUCLEUS . 'adminskins/';\r
+ global $manager, $CONF;\r
+ \r
+ /* available variables as a default */\r
+ $data = array(\r
+ 'skinid' => (integer) $vars['skinid'],\r
+ 'skinname' => Entity::hsc($vars['skinname']),\r
+ );\r
+ \r
$templates = array();\r
- if ( !empty($templateName) )\r
+ if ( $template_name )\r
{\r
- $templates = Template::read($templateName);\r
+ $templates =& $manager->getTemplate($template_name);\r
}\r
- switch( $type )\r
+ \r
+ switch ( $type )\r
{\r
case 'HEAD':\r
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_HEAD']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_HEAD']) )\r
+ if ( !array_key_exists('NORMALSKINLIST_HEAD', $templates) || empty($templates['NORMALSKINLIST_HEAD']) )\r
{\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_HEAD'];\r
+ $template = "<ul>\n";\r
}\r
else\r
{\r
- $template = "<th><%colname%></th><th><%coldesc%></th><th colspan=\"3\"><%colact%></th>\n";\r
+ $template = $templates['NORMALSKINLIST_HEAD'];\r
}\r
- $data = array(\r
- 'colname' => _LISTS_NAME,\r
- 'coldesc' => _LISTS_DESC,\r
- 'colact' => _LISTS_ACTIONS,\r
- );\r
+ \r
break;\r
case 'BODY':\r
$current = $vars['current'];\r
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_BODY']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_BODY']) )\r
- {\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_BODY'];\r
- }\r
- else\r
- {\r
- $template = "<td><%skinname%><br /><br />\n"\r
- . "<%skintypelabel%> <%skintype%><br />\n"\r
- . "<%incmodelabel%> <%incmode%><br />\n"\r
- . "<%incpreflabel%> <%incpref%><br />\n"\r
- . "<%skinthumb%>"\r
- . "<%readme%></td>\n"\r
- . "<td class=\"availableSkinTypes\"><%skindesc%><%skinparts%></td>\n"\r
- . "<td style=\"white-space:nowrap\">"\r
- . "<a href=\"index.php?action=skinedit&skinid=<%skinid%>\" tabindex=\"<%tabindex%>\"><%editbtn%>"\r
- . "</a></td>\n"\r
- . "<td style=\"white-space:nowrap\">"\r
- . "<a href=\"<%cloneurl%>\" tabindex=\"<%tabindex%>\"><%clonebtn%>"\r
- . "</a></td>\n"\r
- . "<td style=\"white-space:nowrap\">"\r
- . "<a href=\"index.php?action=skindelete&skinid=<%skinid%>\" tabindex=\"<%tabindex%>\"><%delbtn%>"\r
- . "</a></td>\n";\r
- }\r
- $url = $manager->addTicketToUrl('index.php?action=adminskinclone&skinid=' . intval($current->sdnumber));\r
- $data = array(\r
- 'skintypelabel' => _LISTS_TYPE,\r
- 'skintype' => Entity::hsc($current->sdtype),\r
- 'incmodelabel' => _LIST_SKINS_INCMODE,\r
- 'incmode' => ($current->sdincmode == 'skindir') ? _PARSER_INCMODE_SKINDIR : _PARSER_INCMODE_NORMAL,\r
- 'incpreflabel' => ($current->sdincpref) ? _LIST_SKINS_INCMODE : '',\r
- 'incpref' => ($current->sdincpref) ? Entity::hsc($current->sdincpref) : '',\r
- 'skindesc' => Entity::hsc($current->sddesc),\r
- 'skinid' => (integer) $current->sdnumber,\r
- 'tabindex' => $vars['tabindex'],\r
- 'cloneurl' => Entity::hsc($url),\r
- 'editbtn' => _LISTS_EDIT,\r
- 'clonebtn' => _LISTS_CLONE,\r
- 'delbtn' => _LISTS_DELETE,\r
- );\r
- // use a special style for the default skin\r
- if ( $current->sdnumber == $CONF['DefaultAdminSkin'] )\r
+ if ( !array_key_exists('NORMALSKINLIST_BODY', $templates) || empty($templates['NORMALSKINLIST_BODY']) )\r
{\r
- $data['skinname'] = '<strong>' . Entity::hsc($current->sdname) . '</strong>';\r
+ $template = "<li>"\r
+ . "<a href=\"<%editurl%>\" tabindex=\"<%tabindex%>\"><%skintypename%></a>"\r
+ . " <%help%>"\r
+ . "</li>\n";\r
}\r
else\r
{\r
- $data['skinname'] = Entity::hsc($current->sdname);\r
- }\r
- \r
- // add preview image when present\r
- if ( $current->sdincpref && @file_exists("{$adminSkinDir}{$current->sdincpref}preview.png") )\r
- {\r
- $data['skinthumb'] = "<p>\n";\r
- \r
- $alternatve_text = sprintf(_LIST_SKIN_PREVIEW, $current->sdname);\r
- $has_enlargement = @file_exists($adminSkinDir . $current->sdincpref . 'preview-large.png');\r
- if ( $has_enlargement )\r
- {\r
- $data['skinthumb'] .= '<a href="' . $adminSkinURL . Entity::hsc($current->sdincpref) . 'preview-large.png" title="' . _LIST_SKIN_PREVIEW_VIEWLARGER . "\">\n";\r
- }\r
- $data['skinthumb'] .= '<img class="skinpreview" src="' . $adminSkinURL . Entity::hsc($current->sdincpref) . 'preview.png" width="100" height="75" alt="' . $alternatve_text . "\" />\n";\r
- if ( $has_enlargement )\r
- {\r
- $data['skinthumb'] .= "</a><br />\n";\r
- }\r
- \r
- if ( @file_exists("{$DIR_SKINS}{$current->sdincpref}readme.html") )\r
- {\r
- $url = $adminSkinURL . Entity::hsc($current->sdincpref) . 'readme.html';\r
- $title = sprintf(_LIST_SKIN_README, $current->sdname);\r
- $data['readme'] = "<a href=\"{$url}\" title=\"{$title}\">" . _LIST_SKIN_README_TXT . "</a>\n";\r
- }\r
- else\r
- {\r
- $data['readme'] ="";\r
- }\r
- \r
- $data['skinthumb'] .= "</p>\n";\r
+ $template = $templates['NORMALSKINLIST_BODY'];\r
}\r
- /* show list of defined parts */\r
- $query = "SELECT stype FROM %s WHERE sdesc=%d ORDER BY stype";\r
- $query = sprintf($query, sql_table('skin'), $current->sdnumber);\r
- $r = sql_query($query);\r
\r
- $types = array();\r
- while ( $o = sql_fetch_object($r) )\r
- {\r
- array_push($types, $o->stype);\r
- }\r
- if ( sizeof($types) > 0 )\r
- {\r
- for ( $i = 0; $i < sizeof($types); $i++ )\r
- {\r
- $type = $types[$i];\r
- if ( !in_array($type, $adminDefaultTypes) )\r
- {\r
- $article = 'skinpartspecial';\r
- }\r
- else\r
- {\r
- $article = "skinpart{$type}";\r
- }\r
- $types[$i] = "<li>\n"\r
- . helpHtml($article) . "\n"\r
- . "<a href=\"index.php?action=adminskinedittype&skinid={$current->sdnumber}&type={$type}\" tabindex=\"{$vars['tabindex']}\">"\r
- . Entity::hsc($template['friendly_names'][$type])\r
- . "</a>\n"\r
- . "</li>\n";\r
- }\r
- $data['skinparts'] = '<br /><br />' . _LIST_SKINS_DEFINED . "<ul>\n" . implode($types, '') . "</ul>\n";\r
- }\r
- else\r
- {\r
- $data['skinparts'] = '';\r
- }\r
+ $data['tabindex'] = $vars['tabindex']++;\r
+ $data['skintype'] = $current['skintype'];\r
+ $data['skintypename'] = $current['skintypename'];\r
+ $data['editaction'] = $vars['editaction'];\r
+ $data['editurl'] = "{$CONF['AdminURL']}?action={$vars['editaction']}&skinid={$vars['skinid']}&type={$current['skintype']}";\r
+ /* TODO: removeaction? */\r
+ /* TODO: customHelpHtml("skinpart{$skintype}-{$template_name}") */\r
+ $data['help'] = '';\r
break;\r
case 'FOOT':\r
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_FOOT']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_FOOT']) )\r
+ if ( !array_key_exists('NORMALSKINLIST_FOOT', $templates) || empty($templates['NORMALSKINLIST_FOOT']) )\r
{\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_FOOT'];\r
+ $template = "</ul>\n";\r
}\r
else\r
{\r
- $template = "";\r
+ $template = $templates['NORMALSKINLIST_FOOT'];\r
}\r
- $data = array();\r
+ \r
break;\r
}\r
+ \r
return Template::fill($template, $data);\r
}\r
\r
-function listplug_table_admintemplatelist($vars, $type, $templateName = '')\r
+/**\r
+ * listplug_list_specialskinlist()\r
+ * \r
+ * @param array $vars array for variables\r
+ * @param string $type HEAD/BODY/FOOT\r
+ * @param string $template_name name of template\r
+ * @return string marked-up string\r
+ */\r
+function listplug_list_specialskinlist($vars, $type, $template_name = '')\r
{\r
+ global $manager, $CONF;\r
+ \r
+ /* available variables as a default */\r
+ $data = array(\r
+ 'skinid' => (integer) $vars['skinid'],\r
+ 'skinname' => Entity::hsc($vars['skinname']),\r
+ );\r
+ \r
+ /* retrieve templates */\r
$templates = array();\r
- if ( !empty($templateName) )\r
+ if ( $template_name )\r
{\r
- $templates = Template::read($templateName);\r
+ $templates =& $manager->getTemplate($template_name);\r
}\r
- global $manager;\r
- switch( $type )\r
+ \r
+ switch ( $type )\r
{\r
case 'HEAD':\r
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_HEAD']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_HEAD']) )\r
+ if ( !array_key_exists('SPECIALSKINLIST_HEAD', $templates) || empty($templates['SPECIALSKINLIST_HEAD']) )\r
{\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_HEAD'];\r
+ $template = "<ul>\n";\r
}\r
else\r
{\r
- $template = "<th><%colname%></th><th><%coldesc%></th><th colspan=\"3\"><%colact%></th>\n";\r
+ $template = $templates['SPECIALSKINLIST_HEAD'];\r
}\r
- $data = array(\r
- 'colname' => _LISTS_NAME,\r
- 'coldesc' => _LISTS_DESC,\r
- 'colact' => _LISTS_ACTIONS,\r
- );\r
break;\r
case 'BODY':\r
$current = $vars['current'];\r
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_BODY']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_BODY']) )\r
+ if ( !array_key_exists('SPECIALSKINLIST_BODY', $templates) || empty($templates['SPECIALSKINLIST_BODY']) )\r
{\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_BODY'];\r
+ $template = "<li>"\r
+ . "<a href=\"<%editurl%>\" tabindex=\"<%tabindex%>\">"\r
+ . "<%skintype%>"\r
+ . "</a>"\r
+ . " ("\r
+ . "<a href=\"<%removeurl%>\" tabindex=\"<%tabindex%>\" >"\r
+ . "<%text(_LISTS_DELETE)%>"\r
+ . "</a>"\r
+ . ")"\r
+ . "</li>\n";\r
}\r
else\r
{\r
- $template = "<td><%templatename%></td>\n"\r
- . "<td><%templatedesc%></td>\n"\r
- . "<td style=\"white-space:nowrap\">"\r
- . "<a href=\"index.php?action=admintemplateedit&templateid=<%templateid%>\" tabindex=\"<%tabindex%>\"><%editbtn%></a>\n"\r
- . "</td>\n"\r
- . "<td style=\"white-space:nowrap\">\n"\r
- . "<a href=\"<%cloneurl%>\" tabindex=\"<%tabindex%>\"><%clonebtn%></a>\n"\r
- . "</td>\n"\r
- . "<td style=\"white-space:nowrap\">\n"\r
- . "<a href=\"index.php?action=admintemplatedelete&templateid=<%templateid%>\" tabindex=\"<%tabindex%>\"><%delbtn%></a>\n"\r
- . "</td>\n";\r
- }\r
- $url = "index.php?action=admintemplateclone&templateid={$current->tdnumber}";\r
- $data = array(\r
- 'templatename' => Entity::hsc($current->tdname),\r
- 'templatedesc' => Entity::hsc($current->tddesc),\r
- 'templateid' => (integer) $current->tdnumber,\r
- 'tabindex' => (integer) $vars['tabindex'],\r
- 'cloneurl' => Entity::hsc($manager->addTicketToUrl($url)),\r
- 'editbtn' => _LISTS_EDIT,\r
- 'clonebtn' => _LISTS_CLONE,\r
- 'delbtn' => _LISTS_DELETE,\r
- );\r
+ $template = $templates['SPECIALSKINLIST_BODY'];\r
+ }\r
+ \r
+ $data['tabindex'] = (integer) $vars['tabindex']++;\r
+ $data['skintype'] = Entity::hsc($current['skintype']);\r
+ $data['skintypename'] = Entity::hsc($current['skintypename']);\r
+ $data['editaction'] = $vars['editaction'];\r
+ $data['editurl'] = "{$CONF['AdminURL']}?action={$vars['editaction']}&skinid={$vars['skinid']}&type={$current['skintype']}";\r
+ $data['removeaction'] = $vars['editaction'];\r
+ $data['removeurl'] = "{$CONF['AdminURL']}?action={$vars['removeaction']}&skinid={$vars['skinid']}&type={$current['skintype']}";\r
+ \r
break;\r
case 'FOOT':\r
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_FOOT']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_FOOT']) )\r
+ if ( !array_key_exists('SPECIALSKINLIST_FOOT', $templates) || empty($templates['SPECIALSKINLIST_FOOT']) )\r
{\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_FOOT'];\r
+ $template = "</ul>\n";\r
}\r
else\r
{\r
- $template = "\n";\r
+ $template = $templates['SPECIALSKINLIST_FOOT'];\r
}\r
- $data = array();\r
break;\r
}\r
+ \r
return Template::fill($template, $data);\r
}\r
+\r
+/**\r
+ * listplug_input_yesno()\r
+ *\r
+ * @param string $name name of input element with radio type attribute\r
+ * @param string $checkedval value which should be checked\r
+ * @param integer $tabindex tabindex number\r
+ * @param string $value1 value of radio 1\r
+ * @param string $value2 value of radio 2\r
+ * @param string $yesval label for yes\r
+ * @param string $noval label for no\r
+ * @param boolean $isAdmin super admin or not\r
+ * @param string $template_name name of template\r
+ * @param boolean $showlist used in showlist or not\r
+ * @return string marked-up string\r
+ */\r
+function listplug_input_yesno($name, $checkedval, $tabindex = 0,\r
+ $value1 = 1, $value2 = 0, $yesval = _YES, $noval = _NO,\r
+ $isAdmin = 0, $template_name = '', $showlist = FALSE)\r
+{\r
+ global $manager;\r
+ \r
+ $templates = array();\r
+ if ( $template_name )\r
+ {\r
+ $templates =& $manager->getTemplate($template_name);\r
+ }\r
+ \r
+ if ( $name == 'admin' )\r
+ {\r
+ if ( !array_key_exists('INPUTYESNO_TEMPLATE_ADMIN', $templates) || empty($templates['INPUTYESNO_TEMPLATE_ADMIN']) )\r
+ {\r
+ $template = "<input type=\"radio\" id=\"<%yesid%>\" name=\"<%name%>\" value=\"<%yesval%>\" <%yescheckedval%> onclick=\"selectCanLogin(true);\" />\n"\r
+ . "<label for=\"<%yesid%>\"><%yesvaltext%></label>\n"\r
+ . "<input type=\"radio\" id=\"<%noid%>\" name=\"<%name%>\" value=\"<%noval%>\" <%nocheckedval%> <%disabled%> onclick=\"selectCanLogin(false);\" />\n"\r
+ . "<label for=\"<%noid%>\"><%novaltext%></label>\n";\r
+ }\r
+ else\r
+ {\r
+ $template = $templates['INPUTYESNO_TEMPLATE_ADMIN'];\r
+ }\r
+ }\r
+ else\r
+ {\r
+ if ( array_key_exists('INPUTYESNO_TEMPLATE_NORMAL', $templates) && !empty($templates['INPUTYESNO_TEMPLATE_NORMAL']) )\r
+ {\r
+ $template = $templates['INPUTYESNO_TEMPLATE_NORMAL'];\r
+ }\r
+ else if ( $showlist && array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OYESNO', $templates) && !empty($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OYESNO']) )\r
+ {\r
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OYESNO'];\r
+ }\r
+ else\r
+ {\r
+ $template = "<input type=\"radio\" id=\"<%yesid%>\" name=\"<%name%>\" value=\"<%yesval%>\" <%yescheckedval%> />\n"\r
+ . "<label for=\"<%yesid%>\"><%yesvaltext%></label>\n"\r
+ . "<input type=\"radio\" id=\"<%noid%>\" name=\"<%name%>\" value=\"<%noval%>\" <%nocheckedval%> <%disabled%> />\n"\r
+ . "<label for=\"<%noid%>\"><%novaltext%></label>\n";\r
+ }\r
+ }\r
+ \r
+ $id = preg_replace('#[|]#', '-', $name);\r
+ $id1 = $id . $value1;\r
+ $id2 = $id . $value2;\r
+ $dat = array(\r
+ 'name' => Entity::hsc($name),\r
+ 'yesval' => Entity::hsc($value1),\r
+ 'noval' => Entity::hsc($value2),\r
+ 'yesid' => Entity::hsc($id1),\r
+ 'noid' => Entity::hsc($id2),\r
+ 'yesvaltext' => $yesval,\r
+ 'novaltext' => $noval,\r
+ 'yescheckedval' => ($checkedval == $value1) ? 'checked="checked" tabindex="' . $tabindex . '"': '',\r
+ 'nocheckedval' => ($checkedval != $value1) ? 'checked="checked" tabindex="' . $tabindex . '"': '',\r
+ 'disabled' => ($isAdmin && $name == 'canlogin') ? ' disabled="disabled"' : '',\r
+ );\r
+ \r
+ return Template::fill($template, $dat);\r
+}\r
+\r
+/**\r
+ * listplug_batchlist()\r
+ * \r
+ * @param string $attr item/member/team/category/comment\r
+ * @param resource $query SQL resorce\r
+ * @param string $type type for showlist()\r
+ * @param array $vars array for variables\r
+ */\r
+function listplug_batchlist($attr, $query, $type, $vars)\r
+{\r
+ global $manager;\r
+ \r
+ /* HEAD */\r
+ $content = "<form method=\"post\" action=\"index.php\">\n";\r
+ \r
+ /* BODY */\r
+ $content .= showlist($query, $type, $vars);\r
+ \r
+ /* FOOT */\r
+ switch ( $attr )\r
+ {\r
+ case 'item':\r
+ $options = array(\r
+ 'delete' => _BATCH_ITEM_DELETE,\r
+ 'move' => _BATCH_ITEM_MOVE\r
+ );\r
+ break;\r
+ case 'member':\r
+ $options = array(\r
+ 'delete' => _BATCH_MEMBER_DELETE,\r
+ 'setadmin' => _BATCH_MEMBER_SET_ADM,\r
+ 'unsetadmin' => _BATCH_MEMBER_UNSET_ADM\r
+ );\r
+ break;\r
+ case 'team':\r
+ $options = array(\r
+ 'delete' => _BATCH_TEAM_DELETE,\r
+ 'setadmin' => _BATCH_TEAM_SET_ADM,\r
+ 'unsetadmin' => _BATCH_TEAM_UNSET_ADM,\r
+ );\r
+ break;\r
+ case 'category':\r
+ $options = array(\r
+ 'delete' => _BATCH_CAT_DELETE,\r
+ 'move' => _BATCH_CAT_MOVE,\r
+ );\r
+ break;\r
+ case 'comment':\r
+ $options = array(\r
+ 'delete' => _BATCH_COMMENT_DELETE,\r
+ );\r
+ break;\r
+ default:\r
+ $options = array();\r
+ break;\r
+ }\r
+ \r
+ $content .= "<p class=\"batchoperations\">\n"\r
+ . _BATCH_WITH_SEL\r
+ . "<select name=\"batchaction\">\n";\r
+ \r
+ foreach ( $options as $option => $label )\r
+ {\r
+ $content .= "<option value=\"{$option}\">{$label}</option>\n";\r
+ }\r
+ $content .= "</select>\n";\r
+ \r
+ if ( $attr == 'team' )\r
+ {\r
+ $content .= '<input type="hidden" name="blogid" value="' . intRequestVar('blogid') . '" />';\r
+ }\r
+ else if ( $attr == 'comment' )\r
+ {\r
+ $content .= '<input type="hidden" name="itemid" value="' . intRequestVar('itemid') . '" />';\r
+ }\r
+ \r
+ $content .= '<input type="submit" value="' . _BATCH_EXEC . '" />'\r
+ . "("\r
+ . "<a href=\"\" onclick=\"if( event && event.preventDefault ) event.preventDefault(); return batchSelectAll(1); \">" . _BATCH_SELECTALL . "</a>"\r
+ . " - "\r
+ . "<a href=\"\" onclick=\"if( event && event.preventDefault ) event.preventDefault(); return batchSelectAll(0); \">" . _BATCH_DESELECTALL . "</a>"\r
+ . ")\n"\r
+ . "<input type=\"hidden\" name=\"action\" value=\"batch{$attr}\" />\n"\r
+ . '<input type="hidden" name="ticket" value="' . Entity::hsc($manager->getNewTicket()) . '" />' . "\n"\r
+ . "</p>\n"\r
+ . "</form>\n";\r
+ \r
+ return $content;\r
+}\r
+\r
+/**\r
+ * listplug_navlist()\r
+ * \r
+ * @param string $attr item/member/team/category/comment\r
+ * @param resource $query SQL resorce\r
+ * @param string $type type for showlist()\r
+ * @param array $vars array for variables\r
+ */\r
+function listplug_navlist($attribute, $query, $type, $vars)\r
+{\r
+ global $CONF;\r
+ \r
+ $prev = $vars['start'] - $vars['amount'];\r
+ if ( $prev < $vars['minamount'] )\r
+ {\r
+ $prev = $vars['minamount'];\r
+ }\r
+ \r
+ $next = $vars['start'] + $vars['amount'];\r
+ \r
+ $navi = "\n";\r
+ $navi .= "<table frame=\"box\" rules=\"all\" sumamry=\"navigation actions\" class=\"navigation\">\n"\r
+ . "<tr>\n";\r
+ $navi .= "<td>\n"\r
+ . "<form method=\"post\" action=\"{$CONF['AdminURL']}\">\n"\r
+ . "<input type=\"hidden\" name=\"start\" value=\"{$prev}\" />\n"\r
+ . "<button type=\"submit\" name=\"action\" value=\"{$vars['action']}\">< < " . _LISTS_PREV . "</button>\n"\r
+ . "<input type=\"hidden\" name=\"blogid\" value=\"{$vars['blogid']}\" />\n"\r
+ . "<input type=\"hidden\" name=\"itemid\" value=\"{$vars['itemid']}\" />\n"\r
+ . "<input type=\"hidden\" name=\"search\" value=\"{$vars['search']}\" />\n"\r
+ . "<input type=\"hidden\" name=\"amount\" value=\"{$vars['amount']}\" />\n"\r
+ . "</form>\n"\r
+ . "</td>\n";\r
+ $navi .= "<td>\n"\r
+ . "<form method=\"post\" action=\"{$CONF['AdminURL']}\">\n"\r
+ . "<input type=\"text\" name=\"amount\" size=\"3\" value=\"{$vars['amount']}\" />\n"\r
+ . _LISTS_PERPAGE\r
+ . "<input type=\"hidden\" name=\"start\" value=\"0\" />\n"\r
+ . "<button type=\"submit\" name=\"action\" value=\"{$vars['action']}\">> " . _LISTS_CHANGE . "</button>\n"\r
+ . "<input type=\"hidden\" name=\"blogid\" value=\"{$vars['blogid']}\" />\n"\r
+ . "<input type=\"hidden\" name=\"itemid\" value=\"{$vars['itemid']}\" />\n"\r
+ . "<input type=\"hidden\" name=\"search\" value=\"{$vars['search']}\" />\n"\r
+ . "<input type=\"hidden\" name=\"amount\" value=\"{$vars['amount']}\" />\n"\r
+ . "</form>\n"\r
+ . "</td>\n";\r
+ $navi .= "<td>\n"\r
+ . "<form method=\"post\" action=\"{$CONF['AdminURL']}\">\n"\r
+ . "<input type=\"text\" name=\"search\" value=\"{$vars['search']}\" size=\"7\" />\n"\r
+ . "<input type=\"hidden\" name=\"start\" value=\"0\" />\n"\r
+ . "<button type=\"submit\" name=\"action\" value=\"{$vars['action']}\">> " . _LISTS_SEARCH . "</button>\n"\r
+ . "<input type=\"hidden\" name=\"blogid\" value=\"{$vars['blogid']}\" />\n"\r
+ . "<input type=\"hidden\" name=\"itemid\" value=\"{$vars['itemid']}\" />\n"\r
+ . "<input type=\"hidden\" name=\"search\" value=\"{$vars['search']}\" />\n"\r
+ . "<input type=\"hidden\" name=\"amount\" value=\"{$vars['amount']}\" />\n"\r
+ . "</form>\n"\r
+ . "</td>\n";\r
+ $navi .= "<td>\n"\r
+ . "<form method=\"post\" action=\"{$CONF['AdminURL']}\">\n"\r
+ . "<input type=\"hidden\" name=\"start\" value=\"{$next}\" />\n"\r
+ . "<button type=\"submit\" name=\"action\" value=\"{$vars['action']}\">" . _LISTS_NEXT . "> > </button>\n"\r
+ . "<input type=\"hidden\" name=\"blogid\" value=\"{$vars['blogid']}\" />\n"\r
+ . "<input type=\"hidden\" name=\"itemid\" value=\"{$vars['itemid']}\" />\n"\r
+ . "<input type=\"hidden\" name=\"search\" value=\"{$vars['search']}\" />\n"\r
+ . "<input type=\"hidden\" name=\"amount\" value=\"{$vars['amount']}\" />\n"\r
+ . "</form>\n"\r
+ . "</td>\n";\r
+ $navi .= "</tr>\n"\r
+ . "</table>\n";\r
+ \r
+ /* HEAD */\r
+ $template = $navi;\r
+ \r
+ /* BODY */\r
+ $template .= listplug_batchlist($attribute, $query, $type, $vars);\r
+ \r
+ /* FOOT */\r
+ $template .= $navi;\r
+ \r
+ return $template;\r
+}\r