X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=nucleus%2Flibs%2Fshowlist.php;h=31e36654af252b4dd597ecc6a1a0a0595803d936;hb=587960ec5d94e0b15b0697e68a0226e151785fd4;hp=f287d286c55f94ca924293e8e275dc9d0d1def2e;hpb=c1e98d31055d979b0a3a982775a2ce6d6e9886a2;p=nucleus-jp%2Fnucleus-next.git
diff --git a/nucleus/libs/showlist.php b/nucleus/libs/showlist.php
index f287d28..31e3665 100644
--- a/nucleus/libs/showlist.php
+++ b/nucleus/libs/showlist.php
@@ -19,266 +19,258 @@
// can take either an array of objects, or an SQL query
-function showlist($query, $type, $template, $templateName = '')
+function showlist($query, $type, $vars, $template_name = '')
{
- if ( is_array($query) )
+ $contents = '';
+
+ /* count */
+ if ( is_string($query) )
{
- if ( sizeof($query) == 0 )
- {
- return 0;
- }
-
- call_user_func("listplug_{$type}", $template, 'HEAD', $templateName);
-
- foreach ( $query as $currentObj )
- {
- $template['current'] = $currentObj;
- call_user_func("listplug_{$type}", $template, 'BODY', $templateName);
- }
-
- call_user_func("listplug_{$type}", $template, 'FOOT', $templateName);
-
- return sizeof($query);
+ $resource = DB::getResult($query);
}
else
{
- $res = sql_query($query);
-
- // don't do anything if there are no results
- $numrows = sql_num_rows($res);
- if ( $numrows == 0 )
- {
- return 0;
- }
- call_user_func("listplug_{$type}", $template, 'HEAD', $templateName);
-
- while( $template['current'] = sql_fetch_object($res) )
- {
- call_user_func("listplug_{$type}", $template, 'BODY', $templateName);
- }
-
- call_user_func("listplug_{$type}", $template, 'FOOT', $templateName);
-
- sql_free_result($res);
-
- // return amount of results
- return $numrows;
+ $resource = $query;
+ }
+
+ /* HEAD */
+ $contents .= call_user_func("listplug_{$type}", $vars, 'HEAD', $template_name);
+
+ /* BODY */
+ foreach ( $resource as $row )
+ {
+ $vars['current'] = $row;
+ $contents .= call_user_func("listplug_{$type}", $vars, 'BODY', $template_name);
+ }
+
+ /* FOOT */
+ $contents .= call_user_func("listplug_{$type}", $vars, 'FOOT', $template_name);
+
+ /* close SQL resource */
+ if ( is_string($query) )
+ {
+ $resource->closeCursor();
}
+
+ return $contents;
}
-function listplug_select($vars, $type, $templateName = '')
+function listplug_select($vars, $type, $template_name = '')
{
+ global $manager;
+
$templates = array();
- if ( !empty($templateName) )
+ if ( !empty($template_name) )
{
- $templates = Template::read($templateName);
+ $templates =& $manager->getTemplate($template_name);
}
+
switch( $type )
{
case 'HEAD':
- if ( isset($templates['SHOWLIST_LISTPLUG_SELECT_HEAD']) || !empty($templates['SHOWLIST_LISTPLUG_SELECT_HEAD']) )
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_SELECT_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_SELECT_HEAD']) )
{
- $template = $templates['SHOWLIST_LISTPLUG_SELECT_HEAD'];
+ $template = "\n";
+ $template = $templates['SHOWLIST_LISTPLUG_SELECT_FOOT'];
}
$data = array();
break;
}
- if ( !class_exists('Actions') )
- {
- global $DIR_LIBS;
- include $DIR_LIBS . 'ACTIONS.php';
- }
- $template = Template::fill($template, $data);
- $handler = new Actions('template', $template, $data);
- $parser = new PARSER(Actions::getDefinedActions(), $handler);
- $parser->parse($template);
- return;
+
+ return Template::fill($template, $data);
}
-function listplug_table($vars, $type, $templateName = '')
+function listplug_table($vars, $type, $template_name = '')
{
+ global $manager;
+
$templates = array();
- if ( !empty($templateName) )
+ if ( !empty($template_name) )
{
- $templates = Template::read($templateName);
+ $templates =& $manager->getTemplate($template_name);
}
+
switch( $type )
{
case 'HEAD':
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_HEAD']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_HEAD']) )
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_HEAD']) )
{
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_HEAD'];
+ $template = "
\n"
+ . "\n"
+ . "\n"
+ . "<%typehead%>\n"
+ . "
\n"
+ . "\n"
+ . "\n";
}
else
{
- $template = "\n<%typehead%>\n
\n";
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_HEAD'];
}
$data = array(
- 'typehead' => call_user_func("listplug_table_" . $vars['content'] , $vars, 'HEAD', $templateName)
- );
+ 'summary' => $vars['content'],
+ 'typehead' => call_user_func("listplug_table_" . $vars['content'] , $vars, 'HEAD', $template_name)
+ );
break;
case 'BODY':
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_BODY']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_BODY']) )
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_BODY']) )
{
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_BODY'];
+ $template = "\n"
+ . "<%typebody%>\n"
+ . "
\n";
}
else
{
- $template = "<%typebody%>\n
\n";
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_BODY'];
}
// tabletype specific thingies
$data = array(
- 'typebody' => call_user_func("listplug_table_" . $vars['content'] , $vars, 'BODY', $templateName)
+ 'typebody' => call_user_func("listplug_table_" . $vars['content'] , $vars, 'BODY', $template_name)
);
break;
case 'FOOT':
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_FOOT']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_FOOT']) )
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_FOOT']) )
{
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_FOOT'];
+ $template = "<%typefoot%>\n"
+ . "\n"
+ . "
\n";
}
else
{
- $template = "<%typefoot%>\n
\n";
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_FOOT'];
}
// tabletype specific thingies
$data = array(
- 'typefoot' => call_user_func("listplug_table_" . $vars['content'] , $vars, 'FOOT', $templateName)
+ 'typefoot' => call_user_func("listplug_table_" . $vars['content'] , $vars, 'FOOT', $template_name)
);
break;
}
- $template = Template::fill($template, $data);
- if ( !class_exists('Actions') )
- {
- global $DIR_LIBS;
- include $DIR_LIBS . 'ACTIONS.php';
- }
- $handler = new Actions('template', $template, $data);
- $parser = new PARSER(Actions::getDefinedActions(), $handler);
- $parser->parse($template);
- return;
+
+ return Template::fill($template, $data);
}
-function listplug_table_memberlist($vars, $type, $templateName = '')
+function listplug_table_memberlist($vars, $type, $template_name = '')
{
+ global $manager;
+
$templates = array();
- if ( !empty($templateName) )
+ if ( !empty($template_name) )
{
- $templates = Template::read($templateName);
+ $templates =& $manager->getTemplate($template_name);
}
+
switch( $type )
{
case 'HEAD':
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_MEMBLIST_HEAD']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_MEMBLIST_HEAD']) )
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_MEMBLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_MEMBLIST_HEAD']) )
{
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_MEMBLIST_HEAD'];
+ $template = "<%colmembername%> | \n"
+ . "<%colmemberrname%> | \n"
+ . "<%colmemberurl%> | \n"
+ . "<%colmemberadmin%><%helplink(superadmin)%> | \n"
+ . "<%colmemberlogin%><%helplink(canlogin)%> | \n"
+ . "<%colactions%> | \n";
}
else
{
- $template = "<%colmembername%> | \n"
- . "<%colmemberrname%> | \n"
- . "<%colmemberurl%> | \n"
- . "<%colmemberadmin%><%helplink(superadmin)%> | \n"
- . "<%colmemberlogin%><%helplink(canlogin)%> | \n"
- . "<%colactions%> | \n";
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_MEMBLIST_HEAD'];
}
$data = array(
- 'colmembername' => _LIST_MEMBER_NAME,
- 'colmemberrname' => _LIST_MEMBER_RNAME,
- 'colmemberurl' => _LIST_MEMBER_URL,
- 'colmemberadmin' => _LIST_MEMBER_ADMIN,
- 'colmemberlogin' => _LIST_MEMBER_LOGIN,
- 'colactions' => _LISTS_ACTIONS,
- );
+ 'colmembername' => _LIST_MEMBER_NAME,
+ 'colmemberrname' => _LIST_MEMBER_RNAME,
+ 'colmemberurl' => _LIST_MEMBER_URL,
+ 'colmemberadmin' => _LIST_MEMBER_ADMIN,
+ 'colmemberlogin' => _LIST_MEMBER_LOGIN,
+ 'colactions' => _LISTS_ACTIONS,
+ );
break;
case 'BODY':
$current = $vars['current'];
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_MEMBLIST_BODY']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_MEMBLIST_BODY']) )
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_MEMBLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_MEMBLIST_BODY']) )
{
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_MEMBLIST_BODY'];
+ $template = "\n"
+ . "\" name=\"batch[<%id%>]\" value=\"<%memberid%>\" />\n"
+ . "\n | \n"
+ . "<%realname%> | \n"
+ . "\" tabindex=\"<%tabindex%>\"><%url%> | \n"
+ . "<%admin%> | \n"
+ . "<%login%> | \n"
+ . "\" tabindex=\"<%tabindex%>\"><%editbtn%> | \n"
+ . "\" tabindex=\"<%tabindex%>\"><%deletebtn%> | \n";
}
else
{
- $template = "\n"
- . "\" name=\"batch[<%id%>]\" value=\"<%memberid%>\" />\n"
- . "\n | \n"
- . "<%realname%> | \n"
- . "\" tabindex=\"<%tabindex%>\"><%url%> | \n"
- . "<%admin%> | \n"
- . "<%login%> | \n"
- . "\" tabindex=\"<%tabindex%>\"><%editbtn%> | \n"
- . "\" tabindex=\"<%tabindex%>\"><%deletebtn%> | \n";
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_MEMBLIST_BODY'];
}
$data = array(
- 'id' => listplug_nextBatchId(),
- 'memberid' => $current->mnumber,
- 'mailaddress' => Entity::hsc($current->memail),
- 'tabindex' => $vars['tabindex'],
- 'name' => Entity::hsc($current->mname),
- 'realname' => Entity::hsc($current->mrealname),
- 'url' => Entity::hsc($current->murl),
- 'admin' => ($current->madmin ? _YES : _NO),
- 'login' => ($current->mcanlogin ? _YES : _NO),
- 'editbtn' => _LISTS_EDIT,
- 'deletebtn' => _LISTS_DELETE,
- );
+ 'id' => listplug_nextBatchId(),
+ 'memberid' => $current['mnumber'],
+ 'mailaddress' => Entity::hsc($current['memail']),
+ 'tabindex' => $vars['tabindex'],
+ 'name' => Entity::hsc($current['mname']),
+ 'realname' => Entity::hsc($current['mrealname']),
+ 'url' => Entity::hsc($current['murl']),
+ 'admin' => $current['madmin'] ? _YES : _NO,
+ 'login' => $current['mcanlogin'] ? _YES : _NO,
+ 'editbtn' => _LISTS_EDIT,
+ 'deletebtn' => _LISTS_DELETE,
+ );
break;
case 'FOOT':
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_MEMBLIST_FOOT']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_MEMBLIST_FOOT']) )
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_MEMBLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_MEMBLIST_FOOT']) )
{
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_MEMBLIST_FOOT'];
+ $template = "";
}
else
{
- $template = "";
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_MEMBLIST_FOOT'];
}
$data = array();
break;
@@ -286,160 +278,167 @@ function listplug_table_memberlist($vars, $type, $templateName = '')
return Template::fill($template, $data);
}
-function listplug_table_teamlist($vars, $type, $templateName = '')
+function listplug_table_teamlist($vars, $type, $template_name = '')
{
global $manager;
+
$templates = array();
- if ( !empty($templateName) )
+ if ( !empty($template_name) )
{
- $templates = Template::read($templateName);
+ $templates =& $manager->getTemplate($template_name);
}
+
switch( $type )
{
case 'HEAD':
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_TEAMLIST_HEAD']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_TEAMLIST_HEAD']) )
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_TEAMLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_TEAMLIST_HEAD']) )
{
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_TEAMLIST_HEAD'];
+ $template = "<%colmembername%> | \n"
+ . "<%colmemberrname%> | \n"
+ . "<%colteamadmin%><%helplink(teamadmin)%> | \n"
+ . "<%colactions%> | \n";
}
else
{
- $template = "<%colmembername%> | \n"
- . "<%colmemberrname%> | \n"
- . "<%colteamadmin%><%helplink(teamadmin)%> | \n"
- . "<%colactions%> | \n";
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_TEAMLIST_HEAD'];
}
$data = array(
- 'colmembername' => _LIST_MEMBER_NAME,
- 'colmemberrname' => _LIST_MEMBER_RNAME,
- 'colteamadmin' => _LIST_TEAM_ADMIN,
- 'colactions' => _LISTS_ACTIONS,
- );
+ 'colmembername' => _LIST_MEMBER_NAME,
+ 'colmemberrname' => _LIST_MEMBER_RNAME,
+ 'colteamadmin' => _LIST_TEAM_ADMIN,
+ 'colactions' => _LISTS_ACTIONS,
+ );
break;
case 'BODY':
$current = $vars['current'];
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_TEAMLIST_BODY']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_TEAMLIST_BODY']) )
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_TEAMLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_TEAMLIST_BODY']) )
{
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_TEAMLIST_BODY'];
+ $template = "\n"
+ . "\" name=\"batch[<%id%>]\" value=\"<%memberid%>\" />\n"
+ . "\n | \n"
+ . "<%realname%> | \n"
+ . "<%admin%> | \n"
+ . "&blogid=<%blogid%>\" tabindex=\"<%tabindex%>\"><%deletebtn%> | \n"
+ . "\" tabindex=\"<%tabindex%>\"><%chadminbtn%> | \n";
}
else
{
- $template = "\n"
- . "\" name=\"batch[<%id%>]\" value=\"<%memberid%>\" />\n"
- . "\n | \n"
- . "<%realname%> | \n"
- . "<%admin%> | \n"
- . "&blogid=<%blogid%>\" tabindex=\"<%tabindex%>\"><%deletebtn%> | \n"
- . "\" tabindex=\"<%tabindex%>\"><%chadminbtn%> | \n";
- }
- $url = 'index.php?action=teamchangeadmin&memberid=' . intval($current->tmember) . '&blogid=' . intval($current->tblog);
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_TEAMLIST_BODY'];
+ }
+ $url = 'index.php?action=teamchangeadmin&memberid=' . intval($current['tmember']) . '&blogid=' . intval($current['tblog']);
$url = $manager->addTicketToUrl($url);
$data = array(
- 'id' => listplug_nextBatchId(),
- 'memberid' => $current->tmember,
- 'mailaddress' => Entity::hsc($current->memail),
- 'tabindex' => $vars['tabindex'],
- 'name' => Entity::hsc($current->mname),
- 'realname' => Entity::hsc($current->mrealname),
- 'admin' => ($current->tadmin ? _YES : _NO),
- 'blogid' => $current->tblog,
- 'deletebtn' => _LISTS_DELETE,
- 'chadminurl' => Entity::hsc($url),
+ 'id' => listplug_nextBatchId(),
+ 'memberid' => $current['tmember'],
+ 'mailaddress' => Entity::hsc($current['memail']),
+ 'tabindex' => $vars['tabindex'],
+ 'name' => Entity::hsc($current['mname']),
+ 'realname' => Entity::hsc($current['mrealname']),
+ 'admin' => ($current['tadmin'] ? _YES : _NO),
+ 'blogid' => $current['tblog'],
+ 'deletebtn' => '<%text(_LISTS_DELETE)%>',
+ 'chadminurl' => Entity::hsc($url),
+ 'chadminbtn' => '<%text(_LIST_TEAM_CHADMIN)%>'
);
break;
case 'FOOT':
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_TEAMLIST_FOOT']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_TEAMLIST_FOOT']) )
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_TEAMLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_TEAMLIST_FOOT']) )
{
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_TEAMLIST_FOOT'];
+ $template = "";
}
else
{
- $template = "";
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_TEAMLIST_FOOT'];
}
+ $data = array();
break;
}
return Template::fill($template, $data);
}
-function listplug_table_pluginlist($vars, $type, $templateName = '')
+function listplug_table_pluginlist($vars, $type, $template_name = '')
{
+ static $plugins = array();
global $manager;
+
$templates = array();
- if ( !empty($templateName) )
+ if ( !empty($template_name) )
{
- $templates = Template::read($templateName);
+ $templates =& $manager->getTemplate($template_name);
}
+
switch( $type )
{
case 'HEAD':
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HEAD']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HEAD']) )
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HEAD']) )
{
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HEAD'];
+ $template = "<%colinfo%> | \n"
+ . "<%coldesc%> | \n"
+ . "<%colactions%> | \n";
}
else
{
- $template = "<%colinfo%> | \n"
- . "<%coldesc%> | \n"
- . "<%colactions%> | \n";
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HEAD'];
}
$data = array(
- 'colinfo' => _LISTS_INFO,
- 'coldesc' => _LISTS_DESC,
- 'colactions' => _LISTS_ACTIONS,
- );
+ 'colinfo' => _LISTS_INFO,
+ 'coldesc' => _LISTS_DESC,
+ 'colactions' => _LISTS_ACTIONS,
+ );
break;
case 'BODY':
$current = $vars['current'];
-
- $plug =& $manager->getPlugin($current->pfile);
+
+ $plug =& $manager->getPlugin($current['pfile']);
if ( $plug )
{
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY']) )
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY']) )
{
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY'];
+ $template = "\n"
+ . "<%plugname%> \n"
+ . "<%autherlabel%> <%plugauther%> \n"
+ . "<%versionlabel%> <%plugversion%> \n"
+ . "<%pluggeturl%> \n"
+ . " | \n"
+ . "\n"
+ . "<%desclabel%> <%plugdesc%>\n"
+ . "<%eventlist%>\n"
+ . "<%needupdate%>\n"
+ . "<%dependlist%>\n"
+ . "<%depreqlist%>\n"
+ . " | \n";
}
else
{
- $template = "\n"
- . "<%plugname%> \n"
- . "<%autherlabel%> <%plugauther%> \n"
- . "<%versionlabel%> <%plugversion%> \n"
- . "<%pluggeturl%> \n"
- . " | \n"
- . "\n"
- . "<%desclabel%> <%plugdesc%>\n"
- . "<%eventlist%>\n"
- . "<%needupdate%>\n"
- . "<%dependlist%>\n"
- . "<%depreqlist%>\n"
- . " | \n";
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY'];
}
$data = array(
- 'plugname' => Entity::hsc($plug->getName()),
- 'autherlabel' => _LIST_PLUGS_AUTHOR,
- 'plugauther' => Entity::hsc($plug->getAuthor()),
- 'versionlabel' => _LIST_PLUGS_VER,
- 'plugversion' => Entity::hsc($plug->getVersion()),
- 'tabindex' => $vars['tabindex'],
- 'desclabel' => _LIST_PLUGS_DESC,
- 'plugdesc' => Entity::hen($plug->getDescription()),
- );
+ 'plugname' => Entity::hsc($plug->getName()),
+ 'autherlabel' => _LIST_PLUGS_AUTHOR,
+ 'plugauther' => Entity::hsc($plug->getAuthor()),
+ 'versionlabel' => _LIST_PLUGS_VER,
+ 'plugversion' => Entity::hsc($plug->getVersion()),
+ 'tabindex' => $vars['tabindex'],
+ 'desclabel' => _LIST_PLUGS_DESC,
+ 'plugdesc' => Entity::hen($plug->getDescription()),
+ );
if ( $plug->getURL() )
{
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_GURL']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_GURL']) )
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGLIST_GURL', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_GURL']) )
{
- $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_GURL'];
+ $subTpl = "\" tabindex=\"<%tabindex%>\"><%plugsite%>";
}
else
{
- $subTpl = "\" tabindex=\"<%tabindex%>\"><%plugsite%>";
+ $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_GURL'];
}
$subData = array(
- 'plugurl' => Entity::hsc($plug->getURL()),
- 'tabindex' => $vars['tabindex'],
- 'plugsite' => _LIST_PLUGS_SITE,
- );
+ 'plugurl' => Entity::hsc($plug->getURL()),
+ 'tabindex' => $vars['tabindex'],
+ 'plugsite' => _LIST_PLUGS_SITE,
+ );
$data['pluggeturl'] = Template::fill($subTpl, $subData);
}
else
@@ -448,17 +447,17 @@ function listplug_table_pluginlist($vars, $type, $templateName = '')
}
if ( count($plug->getEventList()) > 0 )
{
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_PLUGEVENTLIST']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGEVENTLIST']) )
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGEVENTLIST', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGEVENTLIST']) )
{
- $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGEVENTLIST'];
+ $subTpl = "
<%evntlstlbl%>
<%eventlist%>";
}
else
{
- $subTpl = "
<%evntlstlbl%>
<%eventlist%>";
+ $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGEVENTLIST'];
}
$subData = array(
- 'evntlstlbl' => _LIST_PLUGS_SUBS,
- 'eventlist' => Entity::hsc(implode(', ', $plug->getEventList())),
+ 'evntlstlbl' => _LIST_PLUGS_SUBS,
+ 'eventlist' => Entity::hsc(implode(', ', $plug->getEventList())),
);
$data['eventlist'] = Template::fill($subTpl, $subData);
}
@@ -468,16 +467,16 @@ function listplug_table_pluginlist($vars, $type, $templateName = '')
}
if ( !$plug->subscribtionListIsUptodate() )
{
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_PLUGNEDUPDATE']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGNEDUPDATE']) )
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGNEDUPDATE', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGNEDUPDATE']) )
{
- $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGNEDUPDATE'];
+ $subTpl = "
<%updatealert%>";
}
else
{
- $subTpl = "
<%updatealert%>";
+ $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGNEDUPDATE'];
}
$subData = array(
- 'updatealert' => _LIST_PLUG_SUBS_NEEDUPDATE,
+ 'updatealert' => _LIST_PLUG_SUBS_NEEDUPDATE,
);
$data['needupdate'] = Template::fill($subTpl, $subData);
}
@@ -487,17 +486,17 @@ function listplug_table_pluginlist($vars, $type, $templateName = '')
}
if ( count($plug->getPluginDep() ) > 0)
{
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPEND']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPEND']) )
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPEND', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPEND']) )
{
- $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPEND'];
+ $subTpl = "
<%deplistlbl%>
<%dependlist%>";
}
else
{
- $subTpl = "
<%deplistlbl%>
<%dependlist%>";
+ $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPEND'];
}
$subData = array(
- 'deplistlbl' => _LIST_PLUGS_DEP,
- 'dependlist' => Entity::hsc(implode(', ', $plug->getPluginDep())),
+ 'deplistlbl' => _LIST_PLUGS_DEP,
+ 'dependlist' => Entity::hsc(implode(', ', $plug->getPluginDep())),
);
$data['dependlist'] = Template::fill($subTpl, $subData);
}
@@ -506,19 +505,22 @@ function listplug_table_pluginlist($vars, $type, $templateName = '')
$data['dependlist'] = '';
}
/* check dependency */
+ if ( empty($plugins) )
+ {
+ $plugins = DB::getResult('SELECT pfile FROM ' . sql_table('plugin'));
+ }
$req = array();
- $res = sql_query('SELECT pfile FROM ' . sql_table('plugin'));
- while( $o = sql_fetch_object($res) )
+ foreach ( $plugins as $plugin )
{
- $preq =& $manager->getPlugin($o->pfile);
+ $preq =& $manager->getPlugin($plugin['pfile']);
if ( $preq )
{
$depList = $preq->getPluginDep();
foreach ( $depList as $depName )
{
- if ( $current->pfile == $depName )
+ if ( $current['pfile'] == $depName )
{
- $req[] = $o->pfile;
+ $req[] = $plugin['pfile'];
}
}
}
@@ -526,17 +528,17 @@ function listplug_table_pluginlist($vars, $type, $templateName = '')
if ( count($req) > 0 )
{
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPREQ']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPREQ']) )
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPREQ', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPREQ']) )
{
- $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPREQ'];
+ $subTpl = "
<%deprlstlbl%>
<%depreqlist%>";
}
else
{
- $subTpl = "
<%deprlstlbl%>
<%depreqlist%>";
+ $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPREQ'];
}
$subData = array(
- 'deprlstlbl' => _LIST_PLUGS_DEPREQ,
- 'depreqlist' => Entity::hsc(implode(', ', $req)),
+ 'deprlstlbl' => _LIST_PLUGS_DEPREQ,
+ 'depreqlist' => Entity::hsc(implode(', ', $req)),
);
$data['depreqlist'] = Template::fill($subTpl, $subData);
}
@@ -547,57 +549,60 @@ function listplug_table_pluginlist($vars, $type, $templateName = '')
}
else
{
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLISTFALSE']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLISTFALSE']) )
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGLISTFALSE', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLISTFALSE']) )
{
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLISTFALSE'];
+ $template = "<%noplugalert%> | \n";
}
else
{
- $template = "<%noplugalert%> | \n";
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLISTFALSE'];
}
$data = array(
- 'noplugalert' => sprintf(_PLUGINFILE_COULDNT_BELOADED, Entity::hsc($current->pfile)),
- );
+ 'noplugalert' => sprintf(_PLUGINFILE_COULDNT_BELOADED, Entity::hsc($current['pfile'])),
+ );
}
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ACTN']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ACTN']) )
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ACTN', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ACTN']) )
{
- $template .= $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ACTN'];
+ $template .= "\n"
+ . "\" tabindex=\"<%tabindex%>\"><%actionuptxt%> \n"
+ . "\" tabindex=\"<%tabindex%>\"><%actiondowntxt%> \n"
+ . "\" tabindex=\"<%tabindex%>\"><%actuninsttxt%> "
+ . "<%plugadminurl%>\n"
+ . "<%plughelpurl%>\n"
+ . "<%plugoptsetting%>\n"
+ . " | \n";
}
else
{
- $template .= "\n"
- . "\" tabindex=\"<%tabindex%>\"><%actionuptxt%> \n"
- . "\" tabindex=\"<%tabindex%>\"><%actiondowntxt%> \n"
- . "\" tabindex=\"<%tabindex%>\"><%actuninsttxt%> "
- . "<%plugadminurl%>\n"
- . "<%plughelpurl%>\n"
- . "<%plugoptsetting%>\n"
- . " | \n";
- }
- $baseUrl = 'index.php?plugid=' . $current->pid . '&action=';
- $upUrl = $manager->addTicketToUrl($baseUrl . 'pluginup');
- $downUrl = $manager->addTicketToUrl($baseUrl . 'plugindown');
- $data['actionuptxt'] = _LIST_PLUGS_UP;
- $data['actionupurl'] = Entity::hsc($upUrl);
- $data['actiondowntxt'] = _LIST_PLUGS_DOWN;
- $data['actiondownurl'] = Entity::hsc($downUrl);
- $data['actuninsttxt'] = _LIST_PLUGS_UNINSTALL;
- $data['actuninsturl'] = 'index.php?action=plugindelete&plugid=' . $current->pid;
+ $template .= $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ACTN'];
+ }
+
+ $baseUrl = 'index.php?plugid=' . $current['pid'] . '&action=';
+ $upUrl = $manager->addTicketToUrl($baseUrl . 'pluginup');
+ $downUrl = $manager->addTicketToUrl($baseUrl . 'plugindown');
+
+ $data['actionuptxt'] = _LIST_PLUGS_UP;
+ $data['actionupurl'] = Entity::hsc($upUrl);
+ $data['actiondowntxt'] = _LIST_PLUGS_DOWN;
+ $data['actiondownurl'] = Entity::hsc($downUrl);
+ $data['actuninsttxt'] = _LIST_PLUGS_UNINSTALL;
+ $data['actuninsturl'] = 'index.php?action=plugindelete&plugid=' . $current['pid'];
+
if ( $plug && ($plug->hasAdminArea() > 0) )
{
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ADMN']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ADMN']) )
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ADMN', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ADMN']) )
{
- $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ADMN'];
+ $subTpl = "\" tabindex=\"<%tabindex%>\"><%actadmintxt%>
\n";
}
else
{
- $subTpl = "\" tabindex=\"<%tabindex%>\"><%actadmintxt%>
\n";
+ $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ADMN'];
}
$subData = array(
- 'actadminurl' => Entity::hsc($plug->getAdminURL()),
- 'tabindex' => $vars['tabindex'],
- 'actadmintxt' => _LIST_PLUGS_ADMIN,
- );
+ 'actadminurl' => Entity::hsc($plug->getAdminURL()),
+ 'tabindex' => $vars['tabindex'],
+ 'actadmintxt' => _LIST_PLUGS_ADMIN,
+ );
$data['plugadminurl'] = Template::fill($subTpl, $subData);
}
else
@@ -606,18 +611,18 @@ function listplug_table_pluginlist($vars, $type, $templateName = '')
}
if ( $plug && ($plug->supportsFeature('HelpPage') > 0) )
{
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HELP']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HELP']) )
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HELP', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HELP']) )
{
- $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HELP'];
+ $subTpl = "\" tabindex=\"<%tabindex%>\"><%acthelptxt%>
\n";
}
else
{
- $subTpl = "\" tabindex=\"<%tabindex%>\"><%acthelptxt%>
\n";
+ $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HELP'];
}
$subData = array(
- 'acthelpurl' => 'index.php?action=pluginhelp&plugid=' . $current->pid,
- 'tabindex' => $vars['tabindex'],
- 'acthelptxt' => _LIST_PLUGS_HELP,
+ 'acthelpurl' => 'index.php?action=pluginhelp&plugid=' . $current['pid'],
+ 'tabindex' => $vars['tabindex'],
+ 'acthelptxt' => _LIST_PLUGS_HELP,
);
$data['plughelpurl'] = Template::fill($subTpl, $subData);
}
@@ -626,27 +631,27 @@ function listplug_table_pluginlist($vars, $type, $templateName = '')
$data['plughelpurl'] = '';
}
$optQuery = 'SELECT '
- . ' COUNT(*) AS result '
- . 'FROM '
- . sql_table('plugin_option_desc') . ' '
- . 'WHERE '
- . ' ocontext = "global" '
- . 'AND opid = %d';
- $pOptions = quickQuery(sprintf($optQuery, $current->pid));
+ . ' COUNT(*) AS result '
+ . 'FROM '
+ . sql_table('plugin_option_desc') . ' '
+ . 'WHERE '
+ . ' ocontext = "global" '
+ . 'AND opid = %d';
+ $pOptions = DB::getValue(sprintf($optQuery, $current['pid']));
if ( $pOptions > 0 )
{
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_PLUGOPTSETURL']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGOPTSETURL']) )
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGOPTSETURL', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGOPTSETURL']) )
{
- $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGOPTSETURL'];
+ $subTpl = "\" tabindex=\"<%tabindex%>\"><%actoptiontxt%>\n";
}
else
{
- $subTpl = "\" tabindex=\"<%tabindex%>\"><%actoptiontxt%>\n";
+ $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGOPTSETURL'];
}
$subData = array(
- 'actoptionurl' => 'index.php?action=pluginoptions&plugid=' . $current->pid,
- 'tabindex' => $vars['tabindex'],
- 'actoptiontxt' => _LIST_PLUGS_OPTIONS,
+ 'actoptionurl' => 'index.php?action=pluginoptions&plugid=' . $current['pid'],
+ 'tabindex' => $vars['tabindex'],
+ 'actoptiontxt' => _LIST_PLUGS_OPTIONS,
);
$data['plugoptsetting'] = Template::fill($subTpl, $subData);
}
@@ -656,13 +661,13 @@ function listplug_table_pluginlist($vars, $type, $templateName = '')
}
break;
case 'FOOT':
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_FOOT']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_FOOT']) )
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_FOOT']) )
{
- $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_FOOT'];
+ $template = "";
}
else
{
- $subTpl = "";
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_FOOT'];
}
$data = array();
break;
@@ -670,63 +675,72 @@ function listplug_table_pluginlist($vars, $type, $templateName = '')
return Template::fill($template, $data);
}
-function listplug_table_plugoptionlist($vars, $type, $templateName = '')
+function listplug_table_plugoptionlist($vars, $type, $template_name = '')
{
global $manager;
+
$templates = array();
- if ( !empty($templateName) )
+ if ( !empty($template_name) )
{
- $templates = Template::read($templateName);
+ $templates =& $manager->getTemplate($template_name);
}
+
switch( $type )
{
case 'HEAD':
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_POPTLIST_HEAD']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_POPTLIST_HEAD']) )
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_POPTLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_POPTLIST_HEAD']) )
{
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_POPTLIST_HEAD'];
+ $template = "<%colinfo%> | \n"
+ . "<%colvalue%> | \n";
}
else
{
- $template = "<%colinfo%> | <%colvalue%> | \n";
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_POPTLIST_HEAD'];
}
$data = array(
- 'colinfo' => _LISTS_INFO,
- 'colvalue' => _LISTS_VALUE,
- );
+ 'colinfo' => _LISTS_INFO,
+ 'colvalue' => _LISTS_VALUE,
+ );
break;
case 'BODY':
- $current = $vars['current'];
- $template = listplug_plugOptionRow($current, $templateName);
- $data = array();
+ $current = $vars['current'];
+ $template = listplug_plugOptionRow($current, $template_name);
+ $data = array();
break;
case 'FOOT':
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_POPTLIST_FOOT']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_POPTLIST_FOOT']) )
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_POPTLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_POPTLIST_FOOT']) )
{
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_POPTLIST_FOOT'];
+ $template = "\n"
+ . "<%savetext%> | \n"
+ . "
\n"
+ . "\n"
+ . "<%savetext%> | \n"
+ . "\" /> | \n"
+ . "
\n";
}
else
{
- $template = "\n"
- . "<%savetext%> | "
- . "<%savetext%> | "
- . "\" /> | "
- . "
\n";
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_POPTLIST_FOOT'];
}
$data = array(
- 'savetext' => _PLUGS_SAVE,
- );
+ 'savetext' => _PLUGS_SAVE,
+ );
break;
}
+
return Template::fill($template, $data);
}
-function listplug_plugOptionRow($current, $templateName = '')
+function listplug_plugOptionRow($current, $template_name = '')
{
+ global $manager;
+
$templates = array();
- if ( !empty($templateName) )
+ if ( !empty($template_name) )
{
- $templates = Template::read($templateName);
+ $templates =& $manager->getTemplate($template_name);
}
+
$varname = "plugoption[{$current['oid']}][{$current['contextid']}]";
// retreive the optionmeta
@@ -739,253 +753,362 @@ function listplug_plugOptionRow($current, $templateName = '')
}
else
{
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_POPTLIST_BODY']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_POPTLIST_BODY']) )
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_POPTLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_POPTLIST_BODY']) )
{
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_POPTLIST_BODY'];
+ $template = "<%description%> | \n"
+ . "\n";
}
else
{
- $template = " | <%description%> | \n\n";
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_POPTLIST_BODY'];
}
+
$data = array();
+
switch($current['type'])
{
case 'yesno':
- $template .= AdminActions::input_yesno($varname, $current['value'], 0, 'yes', 'no', _YES, _NO, 0, $templateName, 1);
+ $template .= listplug_input_yesno($varname, $current['value'], 0, 'yes', 'no', _YES, _NO, 0, $template_name, 1);
break;
case 'password':
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OPWORD']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OPWORD']) )
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OPWORD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OPWORD']) )
{
- $template .= $templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OPWORD'];
+ $template .= "\" value=\"<%value%>\" />\n";
}
else
{
- $template .= "\" value=\"<%value%>\" />\n";
+ $template .= $templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OPWORD'];
}
$data = array(
- 'varname' => Entity::hsc($varname),
- 'value' => Entity::hsc($current['value']),
- );
+ 'varname' => Entity::hsc($varname),
+ 'value' => Entity::hsc($current['value']),
+ );
break;
case 'select':
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEP']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEP']) )
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEP', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEP']) )
{
- $template .= $templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEP'];
+ $template .= "\">\n";
}
else
{
- $template .= "\">\n";
+ $template .= $templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEP'];
}
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEO']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEO']) )
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEO', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEO']) )
{
- $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEO'];
+ $subTpl = "\n";
}
else
{
- $subTpl = "\n";
+ $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEO'];
}
$options = NucleusPlugin::getOptionSelectValues($current['typeinfo']);
- $options = i18n::explode('|', $options);
-
+ $options = preg_split('#\|#', $options);
+
for ( $i=0; $i<(count($options)-1); $i+=2 )
{
+ $name = $options[$i];
+ $value = $options[$i+1];
+ if ( defined($name) )
+ {
+ $name = constant($name);
+ }
+
$subData = array(
- 'optname' => Entity::hsc($options[$i]),
- 'value' => Entity::hsc($options[$i+1])
- );
- if ($options[$i+1] == $current['value'])
+ 'optname' => Entity::hsc($name),
+ 'value' => Entity::hsc($value)
+ );
+ if ($value != $current['value'])
{
- $subData['selected'] = ' selected="selected"';
+ $subData['selected'] = '';
}
else
{
- $subData['selected'] = '';
+ $subData['selected'] = ' selected="selected"';
}
$template .= Template::fill($subTpl, $subData);
}
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEC']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEC']) )
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEC', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEC']) )
{
- $template .= $templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEC'];
+ $template .= "\n";
}
else
{
- $template .= "\n";
+ $template .= $templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEC'];
}
$data['varname'] = Entity::hsc($varname);
break;
case 'textarea':
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OTAREA']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OTAREA']) )
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OTAREA', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OTAREA']) )
{
- $template .= $templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OTAREA'];
+ $template .= "\n";
}
else
{
- $template .= "";
+ $template .= $templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OTAREA'];
}
$data = array(
- 'varname' => Entity::hsc($varname),
- 'value' => Entity::hsc($current['value'])
- );
- if ( array_key_exists('access', $current) && $current['access'] == 'readonly')
+ 'varname' => Entity::hsc($varname),
+ 'value' => Entity::hsc($current['value'])
+ );
+ if ( !array_key_exists('access', $current) || $current['access'] != 'readonly')
{
- $data['readonly'] = ' readonly="readonly"';
+ $data['readonly'] = '';
}
else
{
- $data['readonly'] = '';
+ $data['readonly'] = ' readonly="readonly"';
}
break;
case 'text':
default:
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OITEXT']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OITEXT']) )
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OITEXT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OITEXT']) )
{
- $template .= $templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OITEXT'];
+ $template .= "\" value=\"<%value%>\"<%datatype%><%readonly%> />\n";
}
else
{
- $template .= "\" value=\"<%value%>\"<%datatype%><%readonly%> />\n";
+ $template .= $templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OITEXT'];
}
$data = array(
- 'varname' => Entity::hsc($varname),
- 'value' => Entity::hsc($current['value'])
- );
- if ( array_key_exists('datatype', $current) && $current['datatype'] == 'numerical')
+ 'varname' => Entity::hsc($varname),
+ 'value' => Entity::hsc($current['value'])
+ );
+ if ( !array_key_exists('datatype', $current) || $current['datatype'] != 'numerical')
{
- $data['datatype'] = ' onkeyup="checkNumeric(this)" onblur="checkNumeric(this)"';
+ $data['datatype'] = '';
}
else
{
- $data['datatype'] = '';
+ $data['datatype'] = ' onkeyup="checkNumeric(this)" onblur="checkNumeric(this)"';
}
- if ( array_key_exists('access', $current) && $current['access'] == 'readonly')
+ if ( !array_key_exists('access', $current) || $current['access'] != 'readonly')
{
- $data['readonly'] = ' readonly="readonly"';
+ $data['readonly'] = '';
}
else
{
- $data['readonly'] = '';
+ $data['readonly'] = ' readonly="readonly"';
}
}
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_PLUGOPTN_FOOT']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGOPTN_FOOT']) )
+
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGOPTN_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGOPTN_FOOT']) )
+ {
+ $template .= "<%extra%> | \n";
+ }
+ else
{
$template .= $templates['SHOWLIST_LISTPLUG_TABLE_PLUGOPTN_FOOT'];
}
+
+ if ( !array_key_exists('extra', $current) )
+ {
+ $data['extra'] = '';
+ }
else
{
- $template .= "<%extra%>\n";
+ $data['extra'] = Entity::hsc($current['extra']);
+ }
+
+ if ( !array_key_exists('description', $current) )
+ {
+ $data['description'] = Entity::hsc($current['name']);
+ }
+ else if ( !defined($current['description']) )
+ {
+ $data['description'] = Entity::hsc($current['description']);
+ }
+ else
+ {
+ $data['description'] = Entity::hsc(constant($current['description']));
}
- $data['extra'] = isset($current['extra']) ? $current['extra'] : '';
- $data['description'] = $current['description'] ? Entity::hsc($current['description']) : Entity::hsc($current['name']);
}
return Template::fill($template, $data, 1);
}
-function listplug_table_itemlist($vars, $type, $templateName = '')
+/**
+ * listplug_templateEditRow()
+ *
+ * @param array $content content of target template
+ * @param string $desc description of target template
+ * @param string $name name of target template
+ * @param string $help help text
+ * @param integer $tabindex a number for tab index
+ * @param boolean $big large or small textarea
+ * @param array $template_name name of template for filling
+ * @return void
+ */
+function listplug_templateEditRow($content, $desc, $name, $help = '', $tabindex = 0, $big = 0, $template_name = '')
{
- $cssclass = '';
+ global $manager;
+
+ static $count = 0;
+
+ $tmplt = array();
+ $base = array();
+
$templates = array();
- if ( !empty($templateName) )
+ if ( $template_name )
{
- $templates = Template::read($templateName);
+ $templates =& $manager->getTemplate($template_name);
+ }
+
+ $data = array(
+ 'description' => $desc,
+ 'help' => empty($help) ? '' : helpHtml('template' . $help),
+ 'count' => $count++,
+ 'name' => $name,
+ 'tabindex' => $tabindex,
+ 'rows' => $big ? 10 : 5,
+ );
+
+ $message = '';
+
+ /* row head */
+ if ( !array_key_exists('TEMPLATE_EDIT_ROW_HEAD', $templates) || empty($tmplt['TEMPLATE_EDIT_ROW_HEAD']) )
+ {
+ $template = ""
+ . "\n"
+ . "<%description%><%help%> | \n"
+ . "\">\n"
+ . "\n"
+ . " | \n";
+ }
+ else
+ {
+ $template = $tmplt['TEMPLATE_EDIT_ROW_TAIL'];
+ }
+ $message .= TEMPLATE::fill($template, $data);
+
+ return $message;
+}
+
+function listplug_table_itemlist($vars, $type, $template_name = '')
+{
+ global $manager;
+
+ $cssclass = '';
+
+ $templates = array();
+ if ( !empty($template_name) )
+ {
+ $templates =& $manager->getTemplate($template_name);
}
switch( $type )
{
case 'HEAD':
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_ITEMLIST_HEAD']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_ITEMLIST_HEAD']) )
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_ITEMLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_ITEMLIST_HEAD']) )
{
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_ITEMLIST_HEAD'];
+ $template = "<%colinfo%> | \n"
+ . "<%colcontent%> | \n"
+ . "<%colaction%> | \n";
}
else
{
- $template = "<%colinfo%> | <%colcontent%> | <%colaction%> | \n";
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_ITEMLIST_HEAD'];
}
$data = array(
- 'colinfo' => _LIST_ITEM_INFO,
- 'colcontent' => _LIST_ITEM_CONTENT,
- 'colaction' => _LISTS_ACTIONS
- );
+ 'colinfo' => _LIST_ITEM_INFO,
+ 'colcontent' => _LIST_ITEM_CONTENT,
+ 'colaction' => _LISTS_ACTIONS
+ );
break;
case 'BODY':
$current = $vars['current'];
// string -> unix timestamp
- $current->itime = strtotime($current->itime);
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_ITEMLIST_BODY']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_ITEMLIST_BODY']) )
+ $current['itime'] = strtotime($current['itime']);
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_ITEMLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_ITEMLIST_BODY']) )
{
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_ITEMLIST_BODY'];
+ $template = ">\n"
+ . "<%bshortlabel%> <%bshortnameval%> \n"
+ . "<%categorylabel%> <%categorynameval%> \n"
+ . "<%authorlabel%> <%authornameval%> \n"
+ . "<%itemdatelabel%> <%itemdateval%> \n"
+ . "<%itemtimelabel%> <%itemtimeval%>\n"
+ . " | \n"
+ . ">\n"
+ . "\" name=\"batch[<%batchid%>]\" value=\"<%itemid%>\" />\n"
+ . " \n"
+ . "<%itembody%>\n"
+ . " | \n"
+ . ">\n"
+ . "\"><%editbtn%> \n"
+ . "\"><%movebtn%> \n"
+ . "\"><%delbtn%> \n"
+ . "<%camount%>\n"
+ . " | \n";
}
else
{
- $template = ">\n"
- . "<%bshortlabel%> <%bshortnameval%> \n"
- . "<%categorylabel%> <%categorynameval%> \n"
- . "<%authorlabel%> <%authornameval%> \n"
- . "<%itemdatelabel%> <%itemdateval%> \n"
- . "<%itemtimelabel%> <%itemtimeval%>\n"
- . " | \n"
- . "\" name=\"batch<%batchid%>\" value=\"<%itemid%>\" />\n"
- . " \n"
- . "<%itembody%>\n"
- . " | "
- . "\"><%editbtn%> \n"
- . "<%camount%>\n"
- . "\"><%movebtn%> \n"
- . "\"><%delbtn%> \n"
- . " | \n";
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_ITEMLIST_BODY'];
}
$cssclass = '';
-
- if ( $current->idraft == 1 )
+
+ if ( $current['idraft'] == 1 )
{
$cssclass = ' class="draft"';
}
// (can't use offset time since offsets might vary between blogs)
- if ( $current->itime > $vars['now'] )
+ if ( $current['itime'] > $vars['now'] )
{
$cssclass = ' class="future"';
}
- $body = strip_tags($current->ibody);
+ $body = strip_tags($current['ibody']);
$data = array(
- 'cssclass' => $cssclass,
- 'bshortlabel' => _LIST_ITEM_BLOG,
- 'bshortnameval' => Entity::hsc($current->bshortname),
- 'categorylabel' => _LIST_ITEM_CAT,
- 'categorynameval' => Entity::hsc($current->cname),
- 'authorlabel' => _LIST_ITEM_AUTHOR,
- 'authornameval' => Entity::hsc($current->mname),
- 'itemdatelabel' => _LIST_ITEM_DATE,
- 'itemdateval' => date("Y-m-d",$current->itime),
- 'itemdatelabel' => _LIST_ITEM_TIME,
- 'itemdateval' => date("H:i",$current->itime),
- 'batchid' => listplug_nextBatchId(),
- 'itemid' => $current->inumber,
- 'itemtitle' => Entity::hsc(strip_tags($current->ititle)),
- 'itembody' => Entity::hsc(Entity::shorten($body, 300, '...')),
- 'editbtn' => _LISTS_EDIT,
- 'movebtn' => _LISTS_MOVE,
- 'delbtn' => _LISTS_DELETE,
+ 'cssclass' => $cssclass,
+ 'bshortlabel' => _LIST_ITEM_BLOG,
+ 'bshortnameval' => Entity::hsc($current['bshortname']),
+ 'categorylabel' => _LIST_ITEM_CAT,
+ 'categorynameval' => Entity::hsc($current['cname']),
+ 'authorlabel' => _LIST_ITEM_AUTHOR,
+ 'authornameval' => Entity::hsc($current['mname']),
+ 'itemdatelabel' => _LIST_ITEM_DATE,
+ 'itemdateval' => date("Y-m-d",$current['itime']),
+ 'itemdatelabel' => _LIST_ITEM_TIME,
+ 'itemdateval' => date("H:i",$current['itime']),
+ 'batchid' => listplug_nextBatchId(),
+ 'itemid' => $current['inumber'],
+ 'itemtitle' => Entity::hsc(strip_tags($current['ititle'])),
+ 'itembody' => Entity::hsc(Entity::shorten($body, 300, '...')),
+ 'editbtn' => _LISTS_EDIT,
+ 'movebtn' => _LISTS_MOVE,
+ 'delbtn' => _LISTS_DELETE,
);
// evaluate amount of comments for the item
- $comment = new Comments($current->inumber);
+ $comment = new Comments($current['inumber']);
$camount = $comment->amountComments();
if ( $camount > 0 )
{
- $data['camount'] = "inumber}\">(" . sprintf(_LIST_ITEM_COMMENTS, $comment->amountComments()) . ")
\n";
+ $data['camount'] = "(" . sprintf(_LIST_ITEM_COMMENTS, $comment->amountComments()) . ")
\n";
}
else
{
- $data['camount'] = "" . _LIST_ITEM_NOCONTENT . "\n";
+ $data['camount'] = _LIST_ITEM_NOCONTENT . "
\n";
}
break;
case 'FOOT':
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_ITEMLIST_FOOT']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_ITEMLIST_FOOT']) )
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_ITEMLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_ITEMLIST_FOOT']) )
{
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_ITEMLIST_FOOT'];
+ $template = "\n";
}
else
{
- $template = "\n";
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_ITEMLIST_FOOT'];
}
$data = array();
break;
@@ -1000,75 +1123,84 @@ function listplug_nextBatchId()
return $id++;
}
-function listplug_table_commentlist($vars, $type, $templateName = '')
+function listplug_table_commentlist($vars, $type, $template_name = '')
{
+ global $manager;
+
$templates = array();
- if ( !empty($templateName) )
+ if ( !empty($template_name) )
{
- $templates = Template::read($templateName);
+ $templates =& $manager->getTemplate($template_name);
}
+
switch( $type )
{
case 'HEAD':
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_HEAD']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_HEAD']) )
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_CMNTLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_HEAD']) )
{
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_HEAD'];
+ $template = "<%colinfo%> | \n"
+ . "<%colcontent%> | \n"
+ . "<%colaction%> | \n";
}
else
{
- $template = "<%colinfo%> | \n<%colcontent%> | \n<%colaction%> | \n";
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_HEAD'];
}
$data = array(
- 'colinfo' => _LISTS_INFO,
- 'colcontent' => _LIST_COMMENT,
- 'colaction' => _LISTS_ACTIONS
- );
+ 'colinfo' => _LISTS_INFO,
+ 'colcontent' => _LIST_COMMENT,
+ 'colaction' => _LISTS_ACTIONS
+ );
break;
case 'BODY':
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_BODY']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_BODY']) )
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_CMNTLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_BODY']) )
{
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_BODY'];
+ $template = "<%commentdate%> <%commentator%> <%commentsite%> <%commentmail%>
| \n"
+ . "\n"
+ . "\" name=\"batch[<%batchid%>]\" value=\"<%commentid%>\" />"
+ . "\n"
+ . " | \n"
+ . "\n"
+ . "\"><%editbtn%>\n"
+ . " | \n"
+ . "\n"
+ . "\"><%delbtn%>\n"
+ . " | \n"
+ . "<%addbanlist%>";
}
else
{
- $template = "<%commentdate%> <%commentator%> <%commentsite%> <%commentmail%>
| \n"
- . "\" name=\"batch[<%batchid%>]\" value=\"<%commentid%>\" />"
- . " | \n"
- . ""
- . "\"><%editbtn%> | \n"
- . ""
- . "\"><%delbtn%> | \n"
- . "<%addbanlist%>";
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_BODY'];
}
$current = $vars['current'];
- $body = strip_tags($current->cbody);
- $data = array(
- 'commentdate' => date("Y-m-d@H:i", strtotime($current->ctime)),
- 'batchid' => listplug_nextBatchId(),
- 'commentid' => $current->cnumber,
- 'commentbody' => Entity::hsc(Entity::shorten($current->cbody, 300, '...')),
- 'editbtn' => _LISTS_EDIT,
- 'delbtn' => _LISTS_DELETE,
- );
- if ( isset($current->mname) )
+ $body = strip_tags($current['cbody']);
+ $data = array(
+ 'commentdate' => date("Y-m-d@H:i", strtotime($current['ctime'])),
+ 'batchid' => listplug_nextBatchId(),
+ 'commentid' => $current['cnumber'],
+ 'commentbody' => Entity::hsc(Entity::shorten($current['cbody'], 300, '...')),
+ 'editbtn' => _LISTS_EDIT,
+ 'delbtn' => _LISTS_DELETE,
+ );
+ if ( isset($current['mname']) )
{
- $data['commentator'] = Entity::hsc($current->mname) . ' ' . _LIST_COMMENTS_MEMBER;
+ $data['commentator'] = Entity::hsc($current['mname']) . ' ' . _LIST_COMMENTS_MEMBER;
}
else
{
- $data['commentator'] = Entity::hsc($current->cuser);
+ $data['commentator'] = Entity::hsc($current['cuser']);
}
- if ( isset($current->cmail) && $current->cmail )
+ if ( isset($current['cmail']) && $current['cmail'] )
{
- $data['commentsite'] = Entity::hsc($current->cmail);
+ $data['commentsite'] = Entity::hsc($current['cmail']);
}
else
{
$data['commentsite'] = '';
}
- if ( isset($current->cemail) && $current->cemail )
+ if ( isset($current['cemail']) && $current['cemail'] )
{
- $data['commentmail'] = Entity::hsc($current->cemail);
+ $data['commentmail'] = Entity::hsc($current['cemail']);
}
else
{
@@ -1076,129 +1208,134 @@ function listplug_table_commentlist($vars, $type, $templateName = '')
}
if ( $vars['canAddBan'] )
{
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_ABAN']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_ABAN']) )
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_CMNTLIST_ABAN', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_ABAN']) )
{
- $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_ABAN'];
+ $subTpl = ""
+ . "&ip=<%banip%>\" title=\"<%banhost%>\"><%banbtn%>"
+ . " | \n";
}
else
{
- $subTpl = "&ip=<%banip%>\" title=\"<%banhost%>\"><%banbtn%> | \n";
+ $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_ABAN'];
}
$subData = array(
- 'itemid' => $current->citem,
- 'banip' => Entity::hsc($current->cip),
- 'banbtn' => _LIST_COMMENT_BANIP,
- );
+ 'itemid' => $current['citem'],
+ 'banip' => Entity::hsc($current['cip']),
+ 'banbtn' => _LIST_COMMENT_BANIP,
+ );
$data['addbanlist'] = Template::fill($subTpl, $subData);
}
break;
case 'FOOT':
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_FOOT']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_FOOT']) )
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_CMNTLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_FOOT']) )
{
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_FOOT'];
+ $template = "";
}
else
{
- $template = "";
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_FOOT'];
}
- $subData = array();
+ $data = array();
break;
}
return Template::fill($template, $data);
}
-function listplug_table_bloglist($vars, $type, $templateName = '')
+function listplug_table_bloglist($vars, $type, $template_name = '')
{
+ global $manager;
+
$templates = array();
- if ( !empty($templateName) )
+ if ( !empty($template_name) )
{
- $templates = Template::read($templateName);
+ $templates =& $manager->getTemplate($template_name);
}
+
switch( $type )
{
case 'HEAD':
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_BLOGLIST_HEAD']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_BLOGLIST_HEAD']) )
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_BLOGLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_BLOGLIST_HEAD']) )
{
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_BLOGLIST_HEAD'];
+ $template = "<%blognames%> | \n"
+ . "<%actionshead%> | \n";
}
else
{
- $template = "<%blognames%> | \n<%actionshead%> | \n";
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_BLOGLIST_HEAD'];
}
$data = array(
- 'blognames' => _NAME,
- 'actionshead' => _LISTS_ACTIONS,
- );
+ 'blognames' => _NAME,
+ 'actionshead' => _LISTS_ACTIONS,
+ );
break;
case 'BODY':
$current = $vars['current'];
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_BLOGLIST_BODY']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_BLOGLIST_BODY']) )
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_BLOGLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_BLOGLIST_BODY']) )
{
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_BLOGLIST_BODY'];
+ $template = " shortname:<%shortname%>\">\n"
+ . "\">\" /><%blogname%> | \n"
+ . "\" title=\"<%ttaddtext%>\"><%addtext%> | \n"
+ . "\" title=\"<%ttedittext%>\"><%edittext%> | \n"
+ . "\" title=\"<%ttcommenttext%>\"><%commenttext%> | \n"
+ . "\" title=\"<%ttbmlettext%>\"><%bmlettext%> | \n";
}
else
{
- $template = " shortname:<%shortname%>\">\n"
- . "\">\" /><%blogname%> | \n"
- . "\" title=\"<%ttaddtext%>\"><%addtext%> | \n"
- . "\" title=\"<%ttedittext%>\"><%edittext%> | \n"
- . "\" title=\"<%ttcommenttext%>\"><%commenttext%> | \n"
- . "\" title=\"<%ttbmlettext%>\"><%bmlettext%> | \n";
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_BLOGLIST_BODY'];
}
$data = array(
- 'blogid' => $current->bnumber,
- 'shortname' => Entity::hsc($current->bshortname),
- 'blogurl' => $current->burl,
- 'blogname' => Entity::hsc($current->bname),
- 'ttaddtext' => _BLOGLIST_TT_ADD,
- 'addtext' => _BLOGLIST_ADD,
- 'ttedittext' => _BLOGLIST_TT_EDIT,
- 'edittext' => _BLOGLIST_EDIT,
- 'ttcommenttext' => _BLOGLIST_TT_COMMENTS,
- 'commenttext' => _BLOGLIST_COMMENTS,
- 'ttbmlettext' => _BLOGLIST_TT_BMLET,
- 'bmlettext' => _BLOGLIST_BMLET,
+ 'blogid' => $current['bnumber'],
+ 'shortname' => Entity::hsc($current['bshortname']),
+ 'blogurl' => $current['burl'],
+ 'blogname' => Entity::hsc($current['bname']),
+ 'ttaddtext' => _BLOGLIST_TT_ADD,
+ 'addtext' => _BLOGLIST_ADD,
+ 'ttedittext' => _BLOGLIST_TT_EDIT,
+ 'edittext' => _BLOGLIST_EDIT,
+ 'ttcommenttext' => _BLOGLIST_TT_COMMENTS,
+ 'commenttext' => _BLOGLIST_COMMENTS,
+ 'ttbmlettext' => _BLOGLIST_TT_BMLET,
+ 'bmlettext' => _BLOGLIST_BMLET,
);
- if ( $current->tadmin == 1 )
+ if ( $current['tadmin'] == 1 )
{
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_BLIST_BD_TADM']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_BLIST_BD_TADM']) )
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_BLIST_BD_TADM', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_BLIST_BD_TADM']) )
{
- $template .= $templates['SHOWLIST_LISTPLUG_TABLE_BLIST_BD_TADM'];
+ $template .= "\" title=\"<%ttsettingtext%>\"><%settingtext%> | \n"
+ . "\" title=\"<%ttbanstext%>\"><%banstext%> | \n";
}
else
{
- $template .= "\" title=\"<%ttsettingtext%>\"><%settingtext%> | \n"
- . "\" title=\"<%ttbanstext%>\"><%banstext%> | \n";
+ $template .= $templates['SHOWLIST_LISTPLUG_TABLE_BLIST_BD_TADM'];
}
- $data['ttsettingtext'] = _BLOGLIST_TT_SETTINGS;
- $data['settingtext'] = _BLOGLIST_SETTINGS;
- $data['ttbanstext'] = _BLOGLIST_TT_BANS;
- $data['banstext'] = _BLOGLIST_BANS;
+ $data['ttsettingtext'] = _BLOGLIST_TT_SETTINGS;
+ $data['settingtext'] = _BLOGLIST_SETTINGS;
+ $data['ttbanstext'] = _BLOGLIST_TT_BANS;
+ $data['banstext'] = _BLOGLIST_BANS;
}
if ( $vars['superadmin'] )
{
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_BLIST_BD_TADM']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_BLIST_BD_TADM']) )
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_BLIST_BD_SADM', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_BLIST_BD_TADM']) )
{
- $template .= $templates['SHOWLIST_LISTPLUG_TABLE_BLIST_BD_TADM'];
+ $template .= "\" title=\"<%ttdeletetext%>\"><%deletetext%> | \n";
}
else
{
- $template .= "\" title=\"<%ttdeletetext%>\"><%deletetext%> | \n";
+ $template .= $templates['SHOWLIST_LISTPLUG_TABLE_BLIST_BD_SADM'];
}
- $data['ttdeletetext'] = _BLOGLIST_TT_DELETE;
- $data['deletetext'] = _BLOGLIST_DELETE;
+ $data['ttdeletetext'] = _BLOGLIST_TT_DELETE;
+ $data['deletetext'] = _BLOGLIST_DELETE;
}
break;
case 'FOOT':
- $current = $vars['current'];
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_BLOGLIST_FOOT']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_BLOGLIST_FOOT']) )
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_BLOGLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_BLOGLIST_FOOT']) )
{
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_BLOGLIST_FOOT'];
+ $template = "\n";
}
else
{
- $template = "\n";
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_BLOGLIST_FOOT'];
}
$data = array();
break;
@@ -1206,53 +1343,58 @@ function listplug_table_bloglist($vars, $type, $templateName = '')
return Template::fill($template, $data);
}
-function listplug_table_shortblognames($vars, $type, $templateName = '')
+function listplug_table_shortblognames($vars, $type, $template_name = '')
{
+ global $manager;
+
$templates = array();
- if ( !empty($templateName) )
+ if ( !empty($template_name) )
{
- $templates = Template::read($templateName);
+ $templates =& $manager->getTemplate($template_name);
}
+
switch( $type )
{
case 'HEAD':
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_HEAD']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_HEAD']) )
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_HEAD']) )
{
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_HEAD'];
+ $template = "<%colshortname%> | \n"
+ . "<%colblogname%> | \n";
}
else
{
- $template = "<%colshortname%> | \n<%colblogname%> | \n";
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_HEAD'];
}
$data = array(
- 'colshortname' => _EBLOG_SHORTNAME,
- 'colblogname' => _EBLOG_NAME,
- );
+ 'colshortname' => _EBLOG_SHORTNAME,
+ 'colblogname' => _EBLOG_NAME,
+ );
break;
case 'BODY':
$current = $vars['current'];
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_BODY']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_BODY']) )
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_BODY']) )
{
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_BODY'];
+ $template = "<%bshortname%> | \n"
+ . "<%blogname%> | \n";
}
else
{
- $template = "<%bshortname%> | \n<%blogname%> | \n";
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_BODY'];
}
$data = array(
- 'bshortname' => Entity::hsc($current->bshortname),
- 'blogname' => Entity::hsc($current->bname),
- );
+ 'bshortname' => Entity::hsc($current['bshortname']),
+ 'blogname' => Entity::hsc($current['bname']),
+ );
break;
case 'FOOT':
$current = $vars['current'];
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_FOOT']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_FOOT']) )
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_FOOT']) )
{
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_FOOT'];
+ $template = "\n";
}
else
{
- $template = "\n";
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_FOOT'];
}
$data = array();
break;
@@ -1260,53 +1402,58 @@ function listplug_table_shortblognames($vars, $type, $templateName = '')
return Template::fill($template, $data);
}
-function listplug_table_shortnames($vars, $type, $templateName = '')
+function listplug_table_shortnames($vars, $type, $template_name = '')
{
+ global $manager;
+
$templates = array();
- if ( !empty($templateName) )
+ if ( !empty($template_name) )
{
- $templates = Template::read($templateName);
+ $templates =& $manager->getTemplate($template_name);
}
+
switch( $type )
{
case 'HEAD':
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_SHORTNAM_HEAD']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_SHORTNAM_HEAD']) )
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_SHORTNAM_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_SHORTNAM_HEAD']) )
{
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_SHORTNAM_HEAD'];
+ $template = "<%colname%> | \n"
+ . "<%coldesc%> | \n";
}
else
{
- $template = "<%colname%> | <%coldesc%> | \n";
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_SHORTNAM_HEAD'];
}
$data = array(
- 'colname' => _NAME,
- 'coldesc' => _LISTS_DESC,
- );
+ 'colname' => _NAME,
+ 'coldesc' => _LISTS_DESC,
+ );
break;
case 'BODY':
$current = $vars['current'];
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_SHORTNAM_BODY']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_SHORTNAM_BODY']) )
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_SHORTNAM_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_SHORTNAM_BODY']) )
{
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_SHORTNAM_BODY'];
+ $template = "<%name%> | \n"
+ . "<%desc%> | \n";
}
else
{
- $template = "<%name%> | <%desc%> | \n";
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_SHORTNAM_BODY'];
}
$data = array(
- 'name' => Entity::hsc($current->name),
- 'desc' => Entity::hsc($current->description),
- );
+ 'name' => Entity::hsc($current['name']),
+ 'desc' => Entity::hsc($current['description']),
+ );
break;
case 'FOOT':
$current = $vars['current'];
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_SHORTNAM_FOOT']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_SHORTNAM_FOOT']) )
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_SHORTNAM_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_SHORTNAM_FOOT']) )
{
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_SHORTNAM_FOOT'];
+ $template = "\n";
}
else
{
- $template = "\n";
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_SHORTNAM_FOOT'];
}
$data = array();
break;
@@ -1314,65 +1461,71 @@ function listplug_table_shortnames($vars, $type, $templateName = '')
return Template::fill($template, $data);
}
-function listplug_table_categorylist($vars, $type, $templateName = '')
+function listplug_table_categorylist($vars, $type, $template_name = '')
{
+ global $manager;
+
$templates = array();
- if ( !empty($templateName) )
+ if ( !empty($template_name) )
{
- $templates = Template::read($templateName);
+ $templates =& $manager->getTemplate($template_name);
}
+
switch( $type )
{
case 'HEAD':
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_CATELIST_HEAD']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_CATELIST_HEAD']) )
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_CATELIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_CATELIST_HEAD']) )
{
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_CATELIST_HEAD'];
+ $template = "<%colname%> | \n"
+ . "<%coldesc%> | \n"
+ . "<%colact%> | \n";
}
else
{
- $template = "<%colname%> | <%coldesc%> | <%colact%> | \n";
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_CATELIST_HEAD'];
}
$data = array(
- 'colname' => _LISTS_NAME,
- 'coldesc' => _LISTS_DESC,
- 'colact' => _LISTS_ACTIONS,
- );
+ 'colname' => _LISTS_NAME,
+ 'coldesc' => _LISTS_DESC,
+ 'colact' => _LISTS_ACTIONS,
+ );
break;
case 'BODY':
$current = $vars['current'];
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_CATELIST_BODY']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_CATELIST_BODY']) )
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_CATELIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_CATELIST_BODY']) )
{
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_CATELIST_BODY'];
+ $template = "\n"
+ . "\" name=\"batch[<%batchid%>]\" value=\"<%catid%>\" />\n"
+ . "\n"
+ . " | \n"
+ . "<%catdesc%> | \n"
+ . "&catid=<%catid%>\" tabindex=\"<%tabindex%>\"><%editbtn%> | \n"
+ . "&catid=<%catid%>\" tabindex=\"<%tabindex%>\"><%delbtn%> | \n";
}
else
{
- $template = "\n"
- . "\" name=\"batch[<%batchid%>]\" value=\"<%catid%>\" />\n"
- . "\n"
- . " | \n"
- . "<%catdesc%> | \n"
- . "&catid=<%catid%>\" tabindex=\"<%tabindex%>\"><%editbtn%> | \n"
- . "&catid=<%catid%>\" tabindex=\"<%tabindex%>\"><%delbtn%> | \n";
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_CATELIST_BODY'];
}
+
$data = array(
- 'batchid' => listplug_nextBatchId(),
- 'catid' => intval($current->catid),
- 'catname' => Entity::hsc($current->cname),
- 'catdesc' => Entity::hsc($current->cdesc),
- 'blogid' => intval($current->catcblogid),
- 'tabindex' => intval($vars['tabindex']),
- 'editbtn' => _LISTS_EDIT,
- 'delbtn' => _LISTS_DELETE,
- );
+ 'batchid' => listplug_nextBatchId(),
+ 'catid' => intval($current['catid']),
+ 'catname' => Entity::hsc($current['cname']),
+ 'catdesc' => Entity::hsc($current['cdesc']),
+ 'blogid' => intval($current['cblog']),
+ 'tabindex' => intval($vars['tabindex']),
+ 'editbtn' => _LISTS_EDIT,
+ 'delbtn' => _LISTS_DELETE,
+ );
break;
case 'FOOT':
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_CATELIST_FOOT']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_CATELIST_FOOT']) )
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_CATELIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_CATELIST_FOOT']) )
{
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_CATELIST_FOOT'];
+ $template = "\n";
}
else
{
- $template = "\n";
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_CATELIST_FOOT'];
}
$data = array();
break;
@@ -1380,71 +1533,83 @@ function listplug_table_categorylist($vars, $type, $templateName = '')
return Template::fill($template, $data);
}
-function listplug_table_templatelist($vars, $type, $templateName = '')
+function listplug_table_templatelist($vars, $type, $template_name = '')
{
+ global $manager, $CONF;
+
$templates = array();
- if ( !empty($templateName) )
+ if ( !empty($template_name) )
{
- $templates = Template::read($templateName);
+ $templates =& $manager->getTemplate($template_name);
}
- global $manager;
+
switch( $type )
{
case 'HEAD':
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_HEAD']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_HEAD']) )
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_TPLTLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_HEAD']) )
{
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_HEAD'];
+ $template = "<%colname%> | \n"
+ . "<%coldesc%> | \n"
+ . "<%colact%> | \n";
}
else
{
- $template = "<%colname%> | <%coldesc%> | <%colact%> | \n";
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_HEAD'];
}
$data = array(
- 'colname' => _LISTS_NAME,
- 'coldesc' => _LISTS_DESC,
- 'colact' => _LISTS_ACTIONS,
- );
+ 'colname' => _LISTS_NAME,
+ 'coldesc' => _LISTS_DESC,
+ 'colact' => _LISTS_ACTIONS,
+ );
break;
case 'BODY':
$current = $vars['current'];
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_BODY']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_BODY']) )
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_TPLTLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_BODY']) )
{
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_BODY'];
+ $template = "<%templatename%> | \n"
+ . "<%templatedesc%> | \n"
+ . ""
+ . "\" tabindex=\"<%tabindex%>\"><%editbtn%>\n"
+ . " | \n"
+ . "\n"
+ . "\" tabindex=\"<%tabindex%>\"><%clonebtn%>\n"
+ . " | \n"
+ . "\n"
+ . "\" tabindex=\"<%tabindex%>\"><%delbtn%>\n"
+ . " | \n";
}
else
{
- $template = "<%templatename%> | \n"
- . "<%templatedesc%> | \n"
- . ""
- . "\" tabindex=\"<%tabindex%>\"><%editbtn%>\n"
- . " | \n"
- . "\n"
- . "\" tabindex=\"<%tabindex%>\"><%clonebtn%>\n"
- . " | \n"
- . "\n"
- . "\" tabindex=\"<%tabindex%>\"><%delbtn%>\n"
- . " | \n";
- }
- $url = "index.php?action=templateclone&templateid={$current->tdnumber}";
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_BODY'];
+ }
+
$data = array(
- 'templatename' => Entity::hsc($current->tdname),
- 'templatedesc' => Entity::hsc($current->tddesc),
- 'templateid' => (integer) $current->tdnumber,
- 'tabindex' => (integer) $vars['tabindex'],
- 'cloneurl' => Entity::hsc($manager->addTicketToUrl($url)),
- 'editbtn' => _LISTS_EDIT,
- 'clonebtn' => _LISTS_CLONE,
- 'delbtn' => _LISTS_DELETE,
+ 'templatename' => Entity::hsc($current['tdname']),
+ 'templatedesc' => Entity::hsc($current['tddesc']),
+ 'templateid' => (integer) $current['tdnumber'],
+ 'tabindex' => (integer) $vars['tabindex'],
+
+ 'clonebtn' => _LISTS_CLONE,
+ 'cloneaction' => $vars['cloneaction'],
+ 'cloneurl' => "{$CONF['AdminURL']}index.php?action={$vars['cloneaction']}&templateid={$current['tdnumber']}",
+
+ 'delbtn' => _LISTS_DELETE,
+ 'deleteaction' => $vars['deleteaction'],
+ 'deleteurl' => "{$CONF['AdminURL']}index.php?action={$vars['deleteaction']}&templateid={$current['tdnumber']}",
+
+ 'editbtn' => _LISTS_EDIT,
+ 'editaction' => $vars['editaction'],
+ 'editurl' => "{$CONF['AdminURL']}index.php?action={$vars['editaction']}&templateid={$current['tdnumber']}"
);
break;
case 'FOOT':
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_FOOT']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_FOOT']) )
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_TPLTLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_FOOT']) )
{
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_FOOT'];
+ $template = "\n";
}
else
{
- $template = "\n";
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_FOOT'];
}
$data = array();
break;
@@ -1452,103 +1617,119 @@ function listplug_table_templatelist($vars, $type, $templateName = '')
return Template::fill($template, $data);
}
-function listplug_table_skinlist($vars, $type, $templateName = '')
+function listplug_table_skinlist($vars, $type, $template_name = '')
{
+ global $CONF, $DIR_SKINS, $manager;
+
$templates = array();
- if ( !empty($templateName) )
+ if ( !empty($template_name) )
{
- $templates = Template::read($templateName);
+ $templates =& $manager->getTemplate($template_name);
}
- global $CONF, $DIR_SKINS, $manager;
+
switch( $type )
{
case 'HEAD':
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_HEAD']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_HEAD']) )
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_SKINLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_HEAD']) )
{
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_HEAD'];
+ $template = "<%colname%> | \n"
+ . "<%coldesc%> | \n"
+ . "<%colact%> | \n";
}
else
{
- $template = "<%colname%> | <%coldesc%> | <%colact%> | \n";
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_HEAD'];
}
$data = array(
- 'colname' => _LISTS_NAME,
- 'coldesc' => _LISTS_DESC,
- 'colact' => _LISTS_ACTIONS,
- );
+ 'colname' => _LISTS_NAME,
+ 'coldesc' => _LISTS_DESC,
+ 'colact' => _LISTS_ACTIONS,
+ );
break;
case 'BODY':
$current = $vars['current'];
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_BODY']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_BODY']) )
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_SKINLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_BODY']) )
{
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_BODY'];
+ $template = "<%skinname%>
\n"
+ . "<%skintypelabel%> <%skintype%> \n"
+ . "<%incmodelabel%> <%incmode%> \n"
+ . "<%incpreflabel%> <%incpref%> \n"
+ . "<%skinthumb%>"
+ . "<%readme%> | \n"
+ . "<%skindesc%><%skinparts%> | \n"
+ . ""
+ . "\" tabindex=\"<%tabindex%>\"><%editbtn%>"
+ . " | \n"
+ . ""
+ . "\" tabindex=\"<%tabindex%>\"><%clonebtn%>"
+ . " | \n"
+ . ""
+ . "\" tabindex=\"<%tabindex%>\"><%delbtn%>"
+ . " | \n";
}
else
{
- $template = "<%skinname%>
\n"
- . "<%skintypelabel%> <%skintype%> \n"
- . "<%incmodelabel%> <%incmode%> \n"
- . "<%incpreflabel%> <%incpref%> \n"
- . "<%skinthumb%>"
- . "<%readme%> | \n"
- . "<%skindesc%><%skinparts%> | \n"
- . ""
- . "\" tabindex=\"<%tabindex%>\"><%editbtn%>"
- . " | \n"
- . ""
- . "\" tabindex=\"<%tabindex%>\"><%clonebtn%>"
- . " | \n"
- . ""
- . "\" tabindex=\"<%tabindex%>\"><%delbtn%>"
- . " | \n";
- }
- $url = $manager->addTicketToUrl('index.php?action=skinclone&skinid=' . intval($current->sdnumber));
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_BODY'];
+ }
+
$data = array(
- 'skintypelabel' => _LISTS_TYPE,
- 'skintype' => Entity::hsc($current->sdtype),
- 'incmodelabel' => _LIST_SKINS_INCMODE,
- 'incmode' => ($current->sdincmode == 'skindir') ? _PARSER_INCMODE_SKINDIR : _PARSER_INCMODE_NORMAL,
- 'incpreflabel' => ($current->sdincpref) ? _LIST_SKINS_INCMODE : '',
- 'incpref' => ($current->sdincpref) ? Entity::hsc($current->sdincpref) : '',
- 'skindesc' => Entity::hsc($current->sddesc),
- 'skinid' => (integer) $current->sdnumber,
- 'tabindex' => $vars['tabindex'],
- 'cloneurl' => Entity::hsc($url),
- 'editbtn' => _LISTS_EDIT,
- 'clonebtn' => _LISTS_CLONE,
- 'delbtn' => _LISTS_DELETE,
- );
- // use a special style for the default skin
- if ( $current->sdnumber == $CONF['BaseSkin'] )
+ 'tabindex' => $vars['tabindex']++,
+
+ 'skinid' => (integer) $current['sdnumber'],
+ 'skindesc' => Entity::hsc($current['sddesc']),
+
+ 'skintypelabel' => _LISTS_TYPE,
+ 'skintype' => Entity::hsc($current['sdtype']),
+
+ 'incmodelabel' => _LIST_SKINS_INCMODE,
+ 'incmode' => ($current['sdincmode'] == 'skindir') ? _PARSER_INCMODE_SKINDIR : _PARSER_INCMODE_NORMAL,
+
+ 'incpreflabel' => ($current['sdincpref']) ? _SKIN_INCLUDE_PREFIX : '',
+ 'incpref' => ($current['sdincpref']) ? Entity::hsc($current['sdincpref']) : '',
+
+ 'editbtn' => _LISTS_EDIT,
+ 'editaction' => $vars['editaction'],
+ 'editurl' => "{$CONF['AdminURL']}index.php?action={$vars['editaction']}&skinid={$current['sdnumber']}",
+
+ 'clonebtn' => _LISTS_CLONE,
+ 'cloneaction' => $vars['cloneaction'],
+ 'cloneurl' => "{$CONF['AdminURL']}index.php?action={$vars['cloneaction']}&skinid={$current['sdnumber']}",
+
+ 'delbtn' => _LISTS_DELETE,
+ 'deleteaction' => $vars['deleteaction'],
+ 'deleteurl' => "{$CONF['AdminURL']}index.php?action={$vars['deleteaction']}&skinid={$current['sdnumber']}"
+ );
+
+ if ( $current['sdnumber'] != $vars['default'] )
{
- $data['skinname'] = '' . Entity::hsc($current->sdname) . '';
+ $data['skinname'] = Entity::hsc($current['sdname']);
}
else
{
- $data['skinname'] = Entity::hsc($current->sdname);
+ $data['skinname'] = '' . Entity::hsc($current['sdname']) . '';
}
-
+
// add preview image when present
- if ( $current->sdincpref && @file_exists("{$DIR_SKINS}{$current->sdincpref}preview.png") )
+ if ( $current['sdincpref'] && @file_exists("{$DIR_SKINS}{$current['sdincpref']}preview.png") )
{
$data['skinthumb'] = "\n";
-
- $alternatve_text = sprintf(_LIST_SKIN_PREVIEW, $current->sdname);
- $has_enlargement = @file_exists($DIR_SKINS . $current->sdincpref . 'preview-large.png');
+
+ $alternatve_text = sprintf(_LIST_SKIN_PREVIEW, $current['sdname']);
+ $has_enlargement = @file_exists($DIR_SKINS . $current['sdincpref'] . 'preview-large.png');
if ( $has_enlargement )
{
- $data['skinthumb'] .= '\n";
+ $data['skinthumb'] .= '\n";
}
- $data['skinthumb'] .= '\n";
+ $data['skinthumb'] .= '\n";
if ( $has_enlargement )
{
$data['skinthumb'] .= "
\n";
}
- if ( @file_exists("{$DIR_SKINS}{$current->sdincpref}readme.html") )
+ if ( @file_exists("{$DIR_SKINS}{$current['sdincpref']}readme.html") )
{
- $url = $CONF['SkinsURL'] . Entity::hsc($current->sdincpref) . 'readme.html';
- $title = sprintf(_LIST_SKIN_README, $current->sdname);
+ $url = $CONF['SkinsURL'] . Entity::hsc($current['sdincpref']) . 'readme.html';
+ $title = sprintf(_LIST_SKIN_README, $current['sdname']);
$data['readme'] = "" . _LIST_SKIN_README_TXT . "\n";
}
else
@@ -1558,51 +1739,40 @@ function listplug_table_skinlist($vars, $type, $templateName = '')
$data['skinthumb'] .= "
\n";
}
- /* show list of defined parts */
- $query = "SELECT stype FROM %s WHERE sdesc=%d ORDER BY stype";
- $query = sprintf($query, sql_table('skin'), $current->sdnumber);
- $r = sql_query($query);
- $types = array();
- while ( $o = sql_fetch_object($r) )
- {
- array_push($types, $o->stype);
- }
- if ( sizeof($types) > 0 )
+ $skin =& $manager->getSkin($current['sdnumber'], $vars['handler']);
+ $available_types = $skin->getAvailableTypes();
+
+ $data['skinparts'] = _LIST_SKINS_DEFINED
+ . "\n";
+ foreach ( $available_types as $type => $label )
{
- for ( $i = 0; $i < sizeof($types); $i++ )
+ if ( $label === FALSE )
{
- $type = $types[$i];
- if ( !array_key_exists($type, $template['friendly_names']) || $type == strtolower($template['friendly_names'][$type]) )
- {
- $article = 'skinpartspecial';
- }
- else
- {
- $article = "skinpart{$type}";
- }
- $types[$i] = "- \n"
- . helpHtml($article) . "\n"
- . "sdnumber}&type={$type}\" tabindex=\"{$template['tabindex']}\">"
- . Entity::hsc($template['friendly_names'][$type])
- . "\n"
- . "
\n";
+ $label = ucfirst($type);
+ $article = 'skinpartspecial';
}
- $data['skinparts'] = '
' . _LIST_SKINS_DEFINED . "\n" . implode($types, '') . "
\n";
- }
- else
- {
- $data['skinparts'] = '';
- }
+ else
+ {
+ $article = "skinpart{$type}";
+ }
+ $data['skinparts'] .= "- \n"
+ . helpHtml($article) . "\n"
+ . ""
+ . Entity::hsc($label)
+ . "\n"
+ . "
\n";
+ }
+ $data['skinparts'] .= "
\n";
break;
case 'FOOT':
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_FOOT']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_FOOT']) )
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_SKINLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_FOOT']) )
{
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_FOOT'];
+ $template = "";
}
else
{
- $template = "";
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_FOOT'];
}
$data = array();
break;
@@ -1610,59 +1780,63 @@ function listplug_table_skinlist($vars, $type, $templateName = '')
return Template::fill($template, $data);
}
-function listplug_table_draftlist($vars, $type, $templateName = '')
+function listplug_table_draftlist($vars, $type, $template_name = '')
{
+ global $manager;
+
$templates = array();
- if ( !empty($templateName) )
+ if ( !empty($template_name) )
{
- $templates = Template::read($templateName);
+ $templates =& $manager->getTemplate($template_name);
}
switch( $type )
{
case 'HEAD':
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_DRFTLIST_HEAD']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_DRFTLIST_HEAD']) )
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_DRFTLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_DRFTLIST_HEAD']) )
{
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_DRFTLIST_HEAD'];
+ $template = "<%colblog%> | \n"
+ . "<%coldesc%> | \n"
+ . "<%colact%> | \n";
}
else
{
- $template = "<%colblog%> | <%coldesc%> | <%colact%> | \n";
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_DRFTLIST_HEAD'];
}
$data = array(
- 'colblog' => _LISTS_BLOG,
- 'coldesc' => _LISTS_TITLE,
- 'colact' => _LISTS_ACTIONS,
- );
+ 'colblog' => _LISTS_BLOG,
+ 'coldesc' => _LISTS_TITLE,
+ 'colact' => _LISTS_ACTIONS,
+ );
break;
case 'BODY':
$current = $vars['current'];
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_DRFTLIST_BODY']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_DRFTLIST_BODY']) )
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_DRFTLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_DRFTLIST_BODY']) )
{
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_DRFTLIST_BODY'];
+ $template = "<%bshortname%> | \n"
+ . "<%ititle%> | \n"
+ . "\"><%editbtn%> | \n"
+ . "\"><%delbtn%> | \n";
}
else
{
- $template = "<%bshortname%> | \n"
- . "<%ititle%> | \n"
- . "\"><%editbtn%> | \n"
- . "\"><%delbtn%> | \n";
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_DRFTLIST_BODY'];
}
$data = array(
- 'bshortname' => Entity::hsc($current->bshortname),
- 'ititle' => Entity::hsc(strip_tags($current->ititle)),
- 'itemid' => intval($current->inumber),
- 'editbtn' => _LISTS_EDIT,
- 'delbtn' => _LISTS_DELETE,
+ 'bshortname' => Entity::hsc($current['bshortname']),
+ 'ititle' => Entity::hsc(strip_tags($current['ititle'])),
+ 'itemid' => intval($current['inumber']),
+ 'editbtn' => _LISTS_EDIT,
+ 'delbtn' => _LISTS_DELETE,
);
break;
case 'FOOT':
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_DRFTLIST_FOOT']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_DRFTLIST_FOOT']) )
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_DRFTLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_DRFTLIST_FOOT']) )
{
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_DRFTLIST_FOOT'];
+ $template = "\n";
}
else
{
- $template = "\n";
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_DRFTLIST_FOOT'];
}
$data = array();
break;
@@ -1670,62 +1844,68 @@ function listplug_table_draftlist($vars, $type, $templateName = '')
return Template::fill($template, $data);
}
-function listplug_table_otherdraftlist($vars, $type, $templateName = '')
+function listplug_table_otherdraftlist($vars, $type, $template_name = '')
{
+ global $manager;
+
$templates = array();
- if ( !empty($templateName) )
+ if ( !empty($template_name) )
{
- $templates = Template::read($templateName);
+ $templates =& $manager->getTemplate($template_name);
}
+
switch( $type )
{
case 'HEAD':
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_HEAD']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_HEAD']) )
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_HEAD']) )
{
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_HEAD'];
+ $template = "<%colblog%> | \n"
+ . "<%coldesc%> | \n"
+ . "<%colautr%> | \n"
+ . "<%colact%> | \n";
}
else
{
- $template = "<%colblog%> | <%coldesc%> | <%colautr%> | <%colact%> | \n";
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_HEAD'];
}
$data = array(
- 'colblog' => _LISTS_BLOG,
- 'coldesc' => _LISTS_TITLE,
- 'colautr' => _LISTS_AUTHOR,
- 'colact' => _LISTS_ACTIONS,
- );
+ 'colblog' => _LISTS_BLOG,
+ 'coldesc' => _LISTS_TITLE,
+ 'colautr' => _LISTS_AUTHOR,
+ 'colact' => _LISTS_ACTIONS,
+ );
break;
case 'BODY':
$current = $vars['current'];
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_BODY']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_BODY']) )
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_BODY']) )
{
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_BODY'];
+ $template = "<%bshortname%> | \n"
+ . "<%ititle%> | \n"
+ . "<%iauthor%> | \n"
+ . "\"><%editbtn%> | \n"
+ . "\"><%delbtn%> | \n";
}
else
{
- $template = "<%bshortname%> | \n"
- . "<%ititle%> | \n"
- . "<%iauthor%> | \n"
- . "\"><%editbtn%> | \n"
- . "\"><%delbtn%> | \n";
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_BODY'];
}
$data = array(
- 'bshortname' => Entity::hsc($current->bshortname),
- 'ititle' => Entity::hsc(strip_tags($current->ititle)),
- 'iauthor' => Entity::hsc(strip_tags($current->mname)),
- 'itemid' => intval($current->inumber),
- 'editbtn' => _LISTS_EDIT,
- 'delbtn' => _LISTS_DELETE,
+ 'bshortname' => Entity::hsc($current['bshortname']),
+ 'ititle' => Entity::hsc(strip_tags($current['ititle'])),
+ 'iauthor' => Entity::hsc(strip_tags($current['mname'])),
+ 'itemid' => intval($current['inumber']),
+ 'editbtn' => _LISTS_EDIT,
+ 'delbtn' => _LISTS_DELETE,
);
break;
case 'FOOT':
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_FOOT']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_FOOT']) )
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_FOOT']) )
{
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_FOOT'];
+ $template = "\n";
}
else
{
- $template = "\n";
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_FOOT'];
}
$data = array();
break;
@@ -1733,53 +1913,58 @@ function listplug_table_otherdraftlist($vars, $type, $templateName = '')
return Template::fill($template, $data);
}
-function listplug_table_actionlist($vars, $type, $templateName = '')
+function listplug_table_actionlist($vars, $type, $template_name = '')
{
+ global $manager;
+
$templates = array();
- if ( !empty($templateName) )
+ if ( !empty($template_name) )
{
- $templates = Template::read($templateName);
+ $templates =& $manager->getTemplate($template_name);
}
+
switch( $type )
{
case 'HEAD':
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_ACTNLIST_HEAD']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_ACTNLIST_HEAD']) )
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_ACTNLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_ACTNLIST_HEAD']) )
{
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_ACTNLIST_HEAD'];
+ $template = "<%coltime%> | \n"
+ . "<%colmesg%> | \n";
}
else
{
- $template = "<%coltime%> | <%colmesg%> | \n";
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_ACTNLIST_HEAD'];
}
$data = array(
- 'coltime' => _LISTS_TIME,
- 'colmesg' => _LIST_ACTION_MSG,
- );
+ 'coltime' => _LISTS_TIME,
+ 'colmesg' => _LIST_ACTION_MSG,
+ );
break;
case 'BODY':
$current = $vars['current'];
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_ACTNLIST_BODY']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_ACTNLIST_BODY']) )
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_ACTNLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_ACTNLIST_BODY']) )
{
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_ACTNLIST_BODY'];
+ $template = "<%timestamp%> | \n"
+ . "<%message%> | \n";
}
else
{
- $template = "<%timestamp%> | <%message%> | \n";
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_ACTNLIST_BODY'];
}
$data = array(
- 'timestamp' => Entity::hsc($current->timestamp),
- 'message' => Entity::hsc($current->message),
- );
+ 'timestamp' => Entity::hsc($current['timestamp']),
+ 'message' => Entity::hsc($current['message']),
+ );
break;
case 'FOOT':
$current = $vars['current'];
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_ACTNLIST_FOOT']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_ACTNLIST_FOOT']) )
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_ACTNLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_ACTNLIST_FOOT']) )
{
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_ACTNLIST_FOOT'];
+ $template = "\n";
}
else
{
- $template = "\n";
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_ACTNLIST_FOOT'];
}
$data = array();
break;
@@ -1787,58 +1972,63 @@ function listplug_table_actionlist($vars, $type, $templateName = '')
return Template::fill($template, $data);
}
-function listplug_table_banlist($vars, $type, $templateName = '')
+function listplug_table_banlist($vars, $type, $template_name = '')
{
+ global $manager;
+
$templates = array();
- if ( !empty($templateName) )
+ if ( !empty($template_name) )
{
- $templates = Template::read($templateName);
+ $templates =& $manager->getTemplate($template_name);
}
+
switch( $type )
{
case 'HEAD':
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_IBANLIST_HEAD']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_IBANLIST_HEAD']) )
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_IBANLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_IBANLIST_HEAD']) )
{
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_IBANLIST_HEAD'];
+ $template = "<%iprange%> | \n"
+ . "<%reason%> | \n"
+ . "<%colact%> | \n";
}
else
{
- $template = "<%iprange%> | <%reason%> | <%colact%> | \n";
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_IBANLIST_HEAD'];
}
$data = array(
- 'iprange' => _LIST_BAN_IPRANGE,
- 'reason' => _LIST_BAN_REASON,
- 'colact' => _LISTS_ACTIONS,
+ 'iprange' => _LIST_BAN_IPRANGE,
+ 'reason' => _LIST_BAN_REASON,
+ 'colact' => _LISTS_ACTIONS,
);
break;
case 'BODY':
$current = $vars['current'];
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_IBANLIST_BODY']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_IBANLIST_BODY']) )
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_IBANLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_IBANLIST_BODY']) )
{
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_IBANLIST_BODY'];
+ $template = "<%iprange%> | \n"
+ . "<%reason%> | \n"
+ . "&iprange=<%iprange%>\"><%delbtn%> | \n";
}
else
{
- $template = "<%iprange%> | \n"
- . "<%reason%> | \n"
- . "&iprange=<%iprange%>\"><%delbtn%> | \n";
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_IBANLIST_BODY'];
}
$data = array(
- 'iprange' => Entity::hsc($current->iprange),
- 'reason' => Entity::hsc($current->reason),
- 'blogid' => intval($current->blogid),
- 'delbtn' => _LISTS_DELETE,
+ 'iprange' => Entity::hsc($current['iprange']),
+ 'reason' => Entity::hsc($current['reason']),
+ 'blogid' => intval($current['blogid']),
+ 'delbtn' => _LISTS_DELETE,
);
break;
case 'FOOT':
$current = $vars['current'];
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_IBANLIST_FOOT']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_IBANLIST_FOOT']) )
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_IBANLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_IBANLIST_FOOT']) )
{
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_IBANLIST_FOOT'];
+ $template = "\n";
}
else
{
- $template = "\n";
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_IBANLIST_FOOT'];
}
$data = array();
break;
@@ -1846,234 +2036,411 @@ function listplug_table_banlist($vars, $type, $templateName = '')
return Template::fill($template, $data);
}
-function listplug_table_adminskinlist($vars, $type, $templateName = '')
+/**
+ * listplug_list_normalskinlist()
+ *
+ * @param array $vars array for variables
+ * @param string $type HEAD/BODY/FOOT
+ * @param string $template_name name of template
+ * @return string marked-up string
+ */
+function listplug_list_normalskinlist($vars, $type, $template_name = '')
{
- global $CONF, $DIR_SKINS, $DIR_NUCLEUS, $manager;
- $adminSkinURL = $CONF['SkinURL'] . 'admin/';
- $adminSkinDir = $DIR_NUCLEUS . 'admin/';
+ global $manager, $CONF;
+
+ /* available variables as a default */
+ $data = array(
+ 'skinid' => (integer) $vars['skinid'],
+ 'skinname' => Entity::hsc($vars['skinname']),
+ );
+
$templates = array();
- if ( !empty($templateName) )
+ if ( $template_name )
{
- $templates = Template::read($templateName);
+ $templates =& $manager->getTemplate($template_name);
}
- switch( $type )
+
+ switch ( $type )
{
case 'HEAD':
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_HEAD']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_HEAD']) )
+ if ( !array_key_exists('NORMALSKINLIST_HEAD', $templates) || empty($templates['NORMALSKINLIST_HEAD']) )
{
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_HEAD'];
+ $template = "\n";
}
else
{
- $template = "<%colname%> | <%coldesc%> | <%colact%> | \n";
+ $template = $templates['NORMALSKINLIST_HEAD'];
}
- $data = array(
- 'colname' => _LISTS_NAME,
- 'coldesc' => _LISTS_DESC,
- 'colact' => _LISTS_ACTIONS,
- );
+
break;
case 'BODY':
$current = $vars['current'];
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_BODY']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_BODY']) )
- {
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_BODY'];
- }
- else
- {
- $template = "<%skinname%>
\n"
- . "<%skintypelabel%> <%skintype%> \n"
- . "<%incmodelabel%> <%incmode%> \n"
- . "<%incpreflabel%> <%incpref%> \n"
- . "<%skinthumb%>"
- . "<%readme%> | \n"
- . "<%skindesc%><%skinparts%> | \n"
- . ""
- . "\" tabindex=\"<%tabindex%>\"><%editbtn%>"
- . " | \n"
- . ""
- . "\" tabindex=\"<%tabindex%>\"><%clonebtn%>"
- . " | \n"
- . ""
- . "\" tabindex=\"<%tabindex%>\"><%delbtn%>"
- . " | \n";
- }
- $url = $manager->addTicketToUrl('index.php?action=adminskinclone&skinid=' . intval($current->sdnumber));
- $data = array(
- 'skintypelabel' => _LISTS_TYPE,
- 'skintype' => Entity::hsc($current->sdtype),
- 'incmodelabel' => _LIST_SKINS_INCMODE,
- 'incmode' => ($current->sdincmode == 'skindir') ? _PARSER_INCMODE_SKINDIR : _PARSER_INCMODE_NORMAL,
- 'incpreflabel' => ($current->sdincpref) ? _LIST_SKINS_INCMODE : '',
- 'incpref' => ($current->sdincpref) ? Entity::hsc($current->sdincpref) : '',
- 'skindesc' => Entity::hsc($current->sddesc),
- 'skinid' => (integer) $current->sdnumber,
- 'tabindex' => $vars['tabindex'],
- 'cloneurl' => Entity::hsc($url),
- 'editbtn' => _LISTS_EDIT,
- 'clonebtn' => _LISTS_CLONE,
- 'delbtn' => _LISTS_DELETE,
- );
- // use a special style for the default skin
- if ( $current->sdnumber == $CONF['DefaultAdminSkin'] )
+ if ( !array_key_exists('NORMALSKINLIST_BODY', $templates) || empty($templates['NORMALSKINLIST_BODY']) )
{
- $data['skinname'] = '' . Entity::hsc($current->sdname) . '';
+ $template = "- "
+ . "\" tabindex=\"<%tabindex%>\"><%skintypename%>"
+ . " <%help%>"
+ . "
\n";
}
else
{
- $data['skinname'] = Entity::hsc($current->sdname);
- }
-
- // add preview image when present
- if ( $current->sdincpref && @file_exists("{$adminSkinDir}{$current->sdincpref}preview.png") )
- {
- $data['skinthumb'] = "\n";
-
- $alternatve_text = sprintf(_LIST_SKIN_PREVIEW, $current->sdname);
- $has_enlargement = @file_exists($adminSkinDir . $current->sdincpref . 'preview-large.png');
- if ( $has_enlargement )
- {
- $data['skinthumb'] .= '\n";
- }
- $data['skinthumb'] .= '\n";
- if ( $has_enlargement )
- {
- $data['skinthumb'] .= "
\n";
- }
-
- if ( @file_exists("{$DIR_SKINS}{$current->sdincpref}readme.html") )
- {
- $url = $adminSkinURL . Entity::hsc($current->sdincpref) . 'readme.html';
- $title = sprintf(_LIST_SKIN_README, $current->sdname);
- $data['readme'] = "" . _LIST_SKIN_README_TXT . "\n";
- }
- else
- {
- $data['readme'] ="";
- }
-
- $data['skinthumb'] .= "
\n";
+ $template = $templates['NORMALSKINLIST_BODY'];
}
- /* show list of defined parts */
- $query = "SELECT stype FROM %s WHERE sdesc=%d ORDER BY stype";
- $query = sprintf($query, sql_table('skin'), $current->sdnumber);
- $r = sql_query($query);
- $types = array();
- while ( $o = sql_fetch_object($r) )
- {
- array_push($types, $o->stype);
- }
- if ( sizeof($types) > 0 )
- {
- for ( $i = 0; $i < sizeof($types); $i++ )
- {
- $type = $types[$i];
- if ( !array_key_exists($type, $template['friendly_names']) || $type == strtolower($template['friendly_names'][$type]) )
- {
- $article = 'skinpartspecial';
- }
- else
- {
- $article = "skinpart{$type}";
- }
- $types[$i] = "- \n"
- . helpHtml($article) . "\n"
- . "sdnumber}&type={$type}\" tabindex=\"{$vars['tabindex']}\">"
- . Entity::hsc($template['friendly_names'][$type])
- . "\n"
- . "
\n";
- }
- $data['skinparts'] = '
' . _LIST_SKINS_DEFINED . "\n" . implode($types, '') . "
\n";
- }
- else
- {
- $data['skinparts'] = '';
- }
+ $data['tabindex'] = $vars['tabindex']++;
+ $data['skintype'] = $current['skintype'];
+ $data['skintypename'] = $current['skintypename'];
+ $data['editaction'] = $vars['editaction'];
+ $data['editurl'] = "{$CONF['AdminURL']}?action={$vars['editaction']}&skinid={$vars['skinid']}&type={$current['skintype']}";
+ /* TODO: removeaction? */
+ /* TODO: customHelpHtml("skinpart{$skintype}-{$template_name}") */
+ $data['help'] = '';
break;
case 'FOOT':
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_FOOT']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_FOOT']) )
+ if ( !array_key_exists('NORMALSKINLIST_FOOT', $templates) || empty($templates['NORMALSKINLIST_FOOT']) )
{
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_FOOT'];
+ $template = "
\n";
}
else
{
- $template = "";
+ $template = $templates['NORMALSKINLIST_FOOT'];
}
- $data = array();
+
break;
}
+
return Template::fill($template, $data);
}
-function listplug_table_admintemplatelist($vars, $type, $templateName = '')
+/**
+ * listplug_list_specialskinlist()
+ *
+ * @param array $vars array for variables
+ * @param string $type HEAD/BODY/FOOT
+ * @param string $template_name name of template
+ * @return string marked-up string
+ */
+function listplug_list_specialskinlist($vars, $type, $template_name = '')
{
+ global $manager, $CONF;
+
+ /* available variables as a default */
+ $data = array(
+ 'skinid' => (integer) $vars['skinid'],
+ 'skinname' => Entity::hsc($vars['skinname']),
+ );
+
+ /* retrieve templates */
$templates = array();
- if ( !empty($templateName) )
+ if ( $template_name )
{
- $templates = Template::read($templateName);
+ $templates =& $manager->getTemplate($template_name);
}
- global $manager;
- switch( $type )
+
+ switch ( $type )
{
case 'HEAD':
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_HEAD']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_HEAD']) )
+ if ( !array_key_exists('SPECIALSKINLIST_HEAD', $templates) || empty($templates['SPECIALSKINLIST_HEAD']) )
{
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_HEAD'];
+ $template = "\n";
}
else
{
- $template = "<%colname%> | <%coldesc%> | <%colact%> | \n";
+ $template = $templates['SPECIALSKINLIST_HEAD'];
}
- $data = array(
- 'colname' => _LISTS_NAME,
- 'coldesc' => _LISTS_DESC,
- 'colact' => _LISTS_ACTIONS,
- );
break;
case 'BODY':
$current = $vars['current'];
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_BODY']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_BODY']) )
+ if ( !array_key_exists('SPECIALSKINLIST_BODY', $templates) || empty($templates['SPECIALSKINLIST_BODY']) )
{
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_BODY'];
+ $template = "- "
+ . "\" tabindex=\"<%tabindex%>\">"
+ . "<%skintype%>"
+ . ""
+ . " ("
+ . "\" tabindex=\"<%tabindex%>\" >"
+ . "<%text(_LISTS_DELETE)%>"
+ . ""
+ . ")"
+ . "
\n";
}
else
{
- $template = "<%templatename%> | \n"
- . "<%templatedesc%> | \n"
- . ""
- . "\" tabindex=\"<%tabindex%>\"><%editbtn%>\n"
- . " | \n"
- . "\n"
- . "\" tabindex=\"<%tabindex%>\"><%clonebtn%>\n"
- . " | \n"
- . "\n"
- . "\" tabindex=\"<%tabindex%>\"><%delbtn%>\n"
- . " | \n";
- }
- $url = "index.php?action=admintemplateclone&templateid={$current->tdnumber}";
- $data = array(
- 'templatename' => Entity::hsc($current->tdname),
- 'templatedesc' => Entity::hsc($current->tddesc),
- 'templateid' => (integer) $current->tdnumber,
- 'tabindex' => (integer) $vars['tabindex'],
- 'cloneurl' => Entity::hsc($manager->addTicketToUrl($url)),
- 'editbtn' => _LISTS_EDIT,
- 'clonebtn' => _LISTS_CLONE,
- 'delbtn' => _LISTS_DELETE,
- );
+ $template = $templates['SPECIALSKINLIST_BODY'];
+ }
+
+ $data['tabindex'] = (integer) $vars['tabindex']++;
+ $data['skintype'] = Entity::hsc($current['skintype']);
+ $data['skintypename'] = Entity::hsc($current['skintypename']);
+ $data['editaction'] = $vars['editaction'];
+ $data['editurl'] = "{$CONF['AdminURL']}?action={$vars['editaction']}&skinid={$vars['skinid']}&type={$current['skintype']}";
+ $data['removeaction'] = $vars['editaction'];
+ $data['removeurl'] = "{$CONF['AdminURL']}?action={$vars['removeaction']}&skinid={$vars['skinid']}&type={$current['skintype']}";
+
break;
case 'FOOT':
- if ( isset($templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_FOOT']) || !empty($templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_FOOT']) )
+ if ( !array_key_exists('SPECIALSKINLIST_FOOT', $templates) || empty($templates['SPECIALSKINLIST_FOOT']) )
{
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_FOOT'];
+ $template = "
\n";
}
else
{
- $template = "\n";
+ $template = $templates['SPECIALSKINLIST_FOOT'];
}
- $data = array();
break;
}
+
return Template::fill($template, $data);
}
+
+/**
+ * listplug_input_yesno()
+ *
+ * @param string $name name of input element with radio type attribute
+ * @param string $checkedval value which should be checked
+ * @param integer $tabindex tabindex number
+ * @param string $value1 value of radio 1
+ * @param string $value2 value of radio 2
+ * @param string $yesval label for yes
+ * @param string $noval label for no
+ * @param boolean $isAdmin super admin or not
+ * @param string $template_name name of template
+ * @param boolean $showlist used in showlist or not
+ * @return string marked-up string
+ */
+function listplug_input_yesno($name, $checkedval, $tabindex = 0,
+ $value1 = 1, $value2 = 0, $yesval = _YES, $noval = _NO,
+ $isAdmin = 0, $template_name = '', $showlist = FALSE)
+{
+ global $manager;
+
+ $templates = array();
+ if ( $template_name )
+ {
+ $templates =& $manager->getTemplate($template_name);
+ }
+
+ if ( $name == 'admin' )
+ {
+ if ( !array_key_exists('INPUTYESNO_TEMPLATE_ADMIN', $templates) || empty($templates['INPUTYESNO_TEMPLATE_ADMIN']) )
+ {
+ $template = "\" name=\"<%name%>\" value=\"<%yesval%>\" <%yescheckedval%> onclick=\"selectCanLogin(true);\" />\n"
+ . "\n"
+ . "\" name=\"<%name%>\" value=\"<%noval%>\" <%nocheckedval%> <%disabled%> onclick=\"selectCanLogin(false);\" />\n"
+ . "\n";
+ }
+ else
+ {
+ $template = $templates['INPUTYESNO_TEMPLATE_ADMIN'];
+ }
+ }
+ else
+ {
+ if ( array_key_exists('INPUTYESNO_TEMPLATE_NORMAL', $templates) && !empty($templates['INPUTYESNO_TEMPLATE_NORMAL']) )
+ {
+ $template = $templates['INPUTYESNO_TEMPLATE_NORMAL'];
+ }
+ else if ( $showlist && array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OYESNO', $templates) && !empty($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OYESNO']) )
+ {
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OYESNO'];
+ }
+ else
+ {
+ $template = "\" name=\"<%name%>\" value=\"<%yesval%>\" <%yescheckedval%> />\n"
+ . "\n"
+ . "\" name=\"<%name%>\" value=\"<%noval%>\" <%nocheckedval%> <%disabled%> />\n"
+ . "\n";
+ }
+ }
+
+ $id = preg_replace('#[|]#', '-', $name);
+ $id1 = $id . $value1;
+ $id2 = $id . $value2;
+ $dat = array(
+ 'name' => Entity::hsc($name),
+ 'yesval' => Entity::hsc($value1),
+ 'noval' => Entity::hsc($value2),
+ 'yesid' => Entity::hsc($id1),
+ 'noid' => Entity::hsc($id2),
+ 'yesvaltext' => $yesval,
+ 'novaltext' => $noval,
+ 'yescheckedval' => ($checkedval == $value1) ? 'checked="checked" tabindex="' . $tabindex . '"': '',
+ 'nocheckedval' => ($checkedval != $value1) ? 'checked="checked" tabindex="' . $tabindex . '"': '',
+ 'disabled' => ($isAdmin && $name == 'canlogin') ? ' disabled="disabled"' : '',
+ );
+
+ return Template::fill($template, $dat);
+}
+
+/**
+ * listplug_batchlist()
+ *
+ * @param string $attr item/member/team/category/comment
+ * @param resource $query SQL resorce
+ * @param string $type type for showlist()
+ * @param array $vars array for variables
+ */
+function listplug_batchlist($attr, $query, $type, $vars, $template_name)
+{
+ global $manager;
+
+ /* HEAD */
+ $content = "\n";
+
+ return $content;
+}
+
+/**
+ * listplug_navlist()
+ *
+ * @param string $attr item/member/team/category/comment
+ * @param resource $query SQL resorce
+ * @param string $type type for showlist()
+ * @param array $vars array for variables
+ * @param string $template_name name of template
+ * @return string contents
+ */
+function listplug_navlist($attribute, $query, $type, $vars, $template_name)
+{
+ global $CONF;
+
+ $prev = $vars['start'] - $vars['amount'];
+ if ( $prev < $vars['minamount'] )
+ {
+ $prev = $vars['minamount'];
+ }
+
+ $next = $vars['start'] + $vars['amount'];
+
+ $navi = "\n";
+ $navi .= "\n"
+ . "\n";
+ $navi .= "\n"
+ . "\n"
+ . " | \n";
+ $navi .= "\n"
+ . "\n"
+ . " | \n";
+ $navi .= "\n"
+ . "\n"
+ . " | \n";
+ $navi .= "\n"
+ . "\n"
+ . " | \n";
+ $navi .= "
\n"
+ . "
\n";
+
+ /* HEAD */
+ $template = $navi;
+
+ /* BODY */
+ $template .= listplug_batchlist($attribute, $query, $type, $vars, $template_name);
+
+ /* FOOT */
+ $template .= $navi;
+
+ return $template;
+}