OSDN Git Service

typo修正
[nucleus-jp/nucleus-jp-ancient.git] / utf8 / nucleus / libs / showlist.php
index 456842a..f879f60 100644 (file)
  */
 
 
-// can take either an array of objects, or an SQL query\r
-function showlist($query, $type, $template) {\r
-\r
-       if (is_array($query)) {\r
-               if (sizeof($query) == 0)\r
-                       return 0;\r
-\r
-               call_user_func('listplug_' . $type, $template, 'HEAD');\r
-\r
-               foreach ($query as $currentObj) {\r
-                       $template['current'] = $currentObj;\r
-                       call_user_func('listplug_' . $type, $template, 'BODY');\r
-               }\r
-\r
-               call_user_func('listplug_' . $type, $template, 'FOOT');\r
-\r
-               return sizeof($query);\r
-\r
-       } else {\r
-               $res = sql_query($query);\r
-\r
-               // don't do anything if there are no results\r
-               $numrows = mysql_num_rows($res);\r
-               if ($numrows == 0)\r
-                       return 0;\r
-\r
-               call_user_func('listplug_' . $type, $template, 'HEAD');\r
-\r
-               while($template['current'] = mysql_fetch_object($res))\r
-                       call_user_func('listplug_' . $type, $template, 'BODY');\r
-\r
-               call_user_func('listplug_' . $type, $template, 'FOOT');\r
-\r
-               mysql_free_result($res);\r
-\r
-               // return amount of results\r
-               return $numrows;\r
-       }\r
-}\r
-\r
-function listplug_select($template, $type) {\r
-       switch($type) {\r
-               case 'HEAD':\r
-                       echo '<select name="' . ifset($template['name']) . '" tabindex="' . ifset($template['tabindex']) . '" ' . ifset($template['javascript']) . '>';\r
-\r
-                       // add extra row if needed\r
-                       if (ifset($template['extra'])) {\r
-                               echo '<option value="', ifset($template['extraval']), '">', $template['extra'], '</option>';\r
-                       }\r
-\r
-                       break;\r
-               case 'BODY':\r
-                       $current = $template['current'];\r
-\r
-                       echo '<option value="' . htmlspecialchars($current->value) . '"';\r
-                       if ($template['selected'] == $current->value)\r
-                               echo ' selected="selected" ';\r
-                       if (isset($template['shorten']) && $template['shorten'] > 0) {\r
-                               echo ' title="'. htmlspecialchars($current->text).'"';\r
-                               $current->text = shorten($current->text, $template['shorten'], $template['shortenel']);\r
-                       }\r
-                       echo '>' . htmlspecialchars($current->text) . '</option>';\r
-                       break;\r
-               case 'FOOT':\r
-                       echo '</select>';\r
-                       break;\r
-       }\r
-}\r
-\r
-function listplug_table($template, $type) {\r
-       switch($type) {\r
-               case 'HEAD':\r
-                       echo "<table>";\r
-                       echo "<thead><tr>";\r
-                       // print head\r
-                       call_user_func("listplug_table_" . $template['content'] , $template, 'HEAD');\r
-                       echo "</tr></thead><tbody>";\r
-                       break;\r
-               case 'BODY':\r
-                       // print tabletype specific thingies\r
-                       echo "<tr onmouseover='focusRow(this);' onmouseout='blurRow(this);'>";\r
-                       call_user_func("listplug_table_" . $template['content'] , $template,  'BODY');\r
-                       echo "</tr>";\r
-                       break;\r
-               case 'FOOT':\r
-                       call_user_func("listplug_table_" . $template['content'] , $template,  'FOOT');\r
-                       echo "</tbody></table>";\r
-                       break;\r
-       }\r
-}\r
-\r
-function listplug_table_memberlist($template, $type) {\r
-       switch($type) {\r
-               case 'HEAD':\r
-                       echo '<th>' . _LIST_MEMBER_NAME . '</th><th>' . _LIST_MEMBER_RNAME . '</th><th>' . _LIST_MEMBER_URL . '</th><th>' . _LIST_MEMBER_ADMIN;\r
-                       help('superadmin');\r
-                       echo "</th><th>" . _LIST_MEMBER_LOGIN;\r
-                       help('canlogin');\r
-                       echo "</th><th colspan='2'>" . _LISTS_ACTIONS. "</th>";\r
-                       break;\r
-               case 'BODY':\r
-                       $current = $template['current'];\r
-\r
-                       echo '<td>';\r
-                       $id = listplug_nextBatchId();\r
-                       echo '<input type="checkbox" id="batch',$id,'" name="batch[',$id,']" value="',$current->mnumber,'" />';\r
-                       echo '<label for="batch',$id,'">';\r
-                       echo "<a href='mailto:", htmlspecialchars($current->memail), "' tabindex='".$template['tabindex']."'>", htmlspecialchars($current->mname), "</a>";\r
-                       echo '</label>';\r
-                       echo '</td>';\r
-                       echo '<td>', htmlspecialchars($current->mrealname), '</td>';\r
-                       echo "<td><a href='", htmlspecialchars($current->murl), "' tabindex='", $template['tabindex'] , "'>", htmlspecialchars($current->murl), "</a></td>";\r
-                       echo '<td>', ($current->madmin ? _YES : _NO),'</td>';\r
-                       echo '<td>', ($current->mcanlogin ? _YES : _NO), '</td>';\r
-                       echo "<td><a href='index.php?action=memberedit&amp;memberid=$current->mnumber' tabindex='".$template['tabindex']."'>"._LISTS_EDIT."</a></td>";\r
-                       echo "<td><a href='index.php?action=memberdelete&amp;memberid=$current->mnumber' tabindex='".$template['tabindex']."'>"._LISTS_DELETE."</a></td>";\r
-                       break;\r
-       }\r
-}\r
-\r
-function listplug_table_teamlist($template, $type) {\r
-       global $manager;\r
-       switch($type) {\r
-               case 'HEAD':\r
-                       echo "<th>"._LIST_MEMBER_NAME."</th><th>"._LIST_MEMBER_RNAME."</th><th>"._LIST_TEAM_ADMIN;\r
-                       help('teamadmin');\r
-                       echo "</th><th colspan='2'>"._LISTS_ACTIONS."</th>";\r
-                       break;\r
-               case 'BODY':\r
-                       $current = $template['current'];\r
-\r
-                       echo '<td>';\r
-                       $id = listplug_nextBatchId();\r
-                       echo '<input type="checkbox" id="batch',$id,'" name="batch[',$id,']" value="',$current->tmember,'" />';\r
-                       echo '<label for="batch',$id,'">';\r
-                       echo "<a href='mailto:", htmlspecialchars($current->memail), "' tabindex='".$template['tabindex']."'>", htmlspecialchars($current->mname), "</a>";\r
-                       echo '</label>';\r
-                       echo '</td>';\r
-                       echo '<td>', htmlspecialchars($current->mrealname), '</td>';\r
-                       echo '<td>', ($current->tadmin ? _YES : _NO) , '</td>';\r
-                       echo "<td><a href='index.php?action=teamdelete&amp;memberid=$current->tmember&amp;blogid=$current->tblog' tabindex='".$template['tabindex']."'>"._LISTS_DELETE."</a></td>";\r
-\r
-                       $url = 'index.php?action=teamchangeadmin&memberid=' . intval($current->tmember) . '&blogid=' . intval($current->tblog);\r
-                       $url = $manager->addTicketToUrl($url);\r
-                       echo "<td><a href='",htmlspecialchars($url),"' tabindex='".$template['tabindex']."'>"._LIST_TEAM_CHADMIN."</a></td>";\r
-                       break;\r
-       }\r
-}\r
-\r
-function listplug_table_pluginlist($template, $type) {\r
-       global $manager;\r
-       switch($type) {\r
-               case 'HEAD':\r
-                       echo '<th>'._LISTS_INFO.'</th><th>'._LISTS_DESC.'</th>';\r
-                       echo '<th style="white-space:nowrap">'._LISTS_ACTIONS.'</th>';\r
-                       break;\r
-               case 'BODY':\r
-                       $current = $template['current'];\r
-\r
-                       $plug =& $manager->getPlugin($current->pfile);\r
-                       if ($plug) {\r
-                               echo '<td>';\r
-                                       echo '<strong>' , htmlspecialchars($plug->getName()) , '</strong><br />';\r
-                                       echo _LIST_PLUGS_AUTHOR, ' ' , htmlspecialchars($plug->getAuthor()) , '<br />';\r
-                                       echo _LIST_PLUGS_VER, ' ' , htmlspecialchars($plug->getVersion()) , '<br />';\r
-                                       if ($plug->getURL())\r
-                                       echo '<a href="',htmlspecialchars($plug->getURL()),'" tabindex="'.$template['tabindex'].'">',_LIST_PLUGS_SITE,'</a><br />';\r
-                               echo '</td>';\r
-                               echo '<td>';\r
-                                       echo _LIST_PLUGS_DESC .'<br/>'. encode_desc($plug->getDescription());\r
-                                       if (sizeof($plug->getEventList()) > 0) {\r
-                                               echo '<br /><br />',_LIST_PLUGS_SUBS,'<br />',htmlspecialchars(implode($plug->getEventList(),', '));\r
-                                               // check the database to see if it is up-to-date and notice the user if not\r
-                                       }\r
-                                       if (!$plug->subscribtionListIsUptodate()) {\r
-                                               echo '<br /><br /><strong>',_LIST_PLUG_SUBS_NEEDUPDATE,'</strong>';\r
-                                       }\r
-                                       if (sizeof($plug->getPluginDep()) > 0) {\r
-                                               echo '<br /><br />',_LIST_PLUGS_DEP,'<br />',htmlspecialchars(implode($plug->getPluginDep(),', '));\r
-                                       }\r
-// <add by shizuki>\r
-                               // check dependency require\r
-                               $req = array();\r
-                               $res = sql_query('SELECT pfile FROM ' . sql_table('plugin'));\r
-                               while($o = mysql_fetch_object($res)) {\r
-                                       $preq =& $manager->getPlugin($o->pfile);\r
-                                       if ($plug) {\r
-                                               $depList = $preq->getPluginDep();\r
-                                               foreach ($depList as $depName) {\r
-                                                       if ($current->pfile == $depName) {\r
-                                                               $req[] = $o->pfile;\r
-                                                       }\r
-                                               }\r
-                                       }\r
-                               }\r
-                               if (count($req) > 0) {\r
-                                       echo '<h4 class="plugin_dependreq_title">' . _LIST_PLUGS_DEPREQ . "</h4>\n";\r
-                                       echo '<p class="plugin_dependreq_text">';\r
-                                       echo htmlspecialchars(implode(', ', $req), ENT_QUOTES);\r
-                                       echo "</p>\n";\r
-                               }\r
-// </add by shizuki>\r
-                               echo '</td>';\r
-                       } else {\r
-                               echo '<td colspan="2">' . sprintf(_PLUGINFILE_COULDNT_BELOADED, htmlspecialchars($current->pfile, ENT_QUOTES)) . '</td>';\r
-                       }\r
-                       echo '<td>';\r
-\r
-                               $baseUrl = 'index.php?plugid=' . intval($current->pid) . '&action=';\r
-                               $url = $manager->addTicketToUrl($baseUrl . 'pluginup');\r
-                               echo "<a href='",htmlspecialchars($url),"' tabindex='".$template['tabindex']."'>",_LIST_PLUGS_UP,"</a>";\r
-                               $url = $manager->addTicketToUrl($baseUrl . 'plugindown');\r
-                               echo "<br /><a href='",htmlspecialchars($url),"' tabindex='".$template['tabindex']."'>",_LIST_PLUGS_DOWN,"</a>";\r
-                               echo "<br /><a href='index.php?action=plugindelete&amp;plugid=$current->pid' tabindex='".$template['tabindex']."'>",_LIST_PLUGS_UNINSTALL,"</a>";\r
-                               if ($plug && ($plug->hasAdminArea() > 0))\r
-                                       echo "<br /><a href='".htmlspecialchars($plug->getAdminURL())."'  tabindex='".$template['tabindex']."'>",_LIST_PLUGS_ADMIN,"</a>";\r
-                               if ($plug && ($plug->supportsFeature('HelpPage') > 0))\r
-                                       echo "<br /><a href='index.php?action=pluginhelp&amp;plugid=$current->pid'  tabindex='".$template['tabindex']."'>",_LIST_PLUGS_HELP,"</a>";\r
-                               if (quickQuery('SELECT COUNT(*) AS result FROM '.sql_table('plugin_option_desc').' WHERE ocontext=\'global\' and opid='.$current->pid) > 0)\r
-                                       echo "<br /><a href='index.php?action=pluginoptions&amp;plugid=$current->pid'  tabindex='".$template['tabindex']."'>",_LIST_PLUGS_OPTIONS,"</a>";\r
-                       echo '</td>';\r
-                       break;\r
-       }\r
-}\r
-\r
-function listplug_table_plugoptionlist($template, $type) {\r
-       global $manager;\r
-       switch($type) {\r
-               case 'HEAD':\r
-                       echo '<th>'._LISTS_INFO.'</th><th>'._LISTS_VALUE.'</th>';\r
-                       break;\r
-               case 'BODY':\r
-                       $current = $template['current'];\r
-                       listplug_plugOptionRow($current);\r
-                       break;\r
-               case 'FOOT':\r
-                       ?>\r
-                       <tr>\r
-                               <th colspan="2"><?php echo _PLUGS_SAVE?></th>\r
-                       </tr><tr>\r
-                               <td><?php echo _PLUGS_SAVE?></td>\r
-                               <td><input type="submit" value="<?php echo _PLUGS_SAVE?>" /></td>\r
-                       </tr>\r
-                       <?php                   break;\r
-       }\r
-}\r
-\r
-function listplug_plugOptionRow($current) {\r
-       $varname = 'plugoption['.$current['oid'].']['.$current['contextid'].']';\r
-       // retreive the optionmeta\r
-       $meta = NucleusPlugin::getOptionMeta($current['typeinfo']);\r
-\r
-       // only if it is not a hidden option write the controls to the page\r
-       if (@$meta['access'] != 'hidden') {\r
-               echo '<td>',htmlspecialchars($current['description']?$current['description']:$current['name']),'</td>';\r
-               echo '<td>';\r
-               switch($current['type']) {\r
-                       case 'yesno':\r
-                               ADMIN::input_yesno($varname, $current['value'], 0, 'yes', 'no');\r
-                               break;\r
-                       case 'password':\r
-                               echo '<input type="password" size="40" maxlength="128" name="',htmlspecialchars($varname),'" value="',htmlspecialchars($current['value']),'" />';\r
-                               break;\r
-                       case 'select':\r
-                               echo '<select name="'.htmlspecialchars($varname).'">';\r
-                               $aOptions = NucleusPlugin::getOptionSelectValues($current['typeinfo']);\r
-                               $aOptions = explode('|', $aOptions);\r
-                               for ($i=0; $i<(count($aOptions)-1); $i+=2) {\r
-                                       echo '<option value="'.htmlspecialchars($aOptions[$i+1]).'"';\r
-                                       if ($aOptions[$i+1] == $current['value'])\r
-                                               echo ' selected="selected"';\r
-                                       echo '>'.htmlspecialchars($aOptions[$i]).'</option>';\r
-                               }\r
-                               echo '</select>';\r
-                               break;\r
-                       case 'textarea':\r
-                               //$meta = NucleusPlugin::getOptionMeta($current['typeinfo']);\r
-                               echo '<textarea class="pluginoption" cols="30" rows="5" name="',htmlspecialchars($varname),'"';\r
-                               if (@$meta['access'] == 'readonly') {\r
-                                       echo ' readonly="readonly"';\r
-                               }\r
-                               echo '>',htmlspecialchars($current['value']),'</textarea>';\r
-                               break;\r
-                       case 'text':\r
-                       default:\r
-                               //$meta = NucleusPlugin::getOptionMeta($current['typeinfo']);\r
-\r
-                               echo '<input type="text" size="40" maxlength="128" name="',htmlspecialchars($varname),'" value="',htmlspecialchars($current['value']),'"';\r
-                               if (@$meta['datatype'] == 'numerical') {\r
-                                       echo ' onkeyup="checkNumeric(this)" onblur="checkNumeric(this)"';\r
-                               }\r
-                               if (@$meta['access'] == 'readonly') {\r
-                                       echo ' readonly="readonly"';\r
-                               }\r
-                               echo ' />';\r
-               }\r
-               echo @$current['extra'];\r
-               echo '</td>';\r
-       }\r
-}\r
-\r
-function listplug_table_itemlist($template, $type) {\r
-       $cssclass = null;\r
-\r
-       switch($type) {\r
-               case 'HEAD':\r
-                       echo "<th>"._LIST_ITEM_INFO."</th><th>"._LIST_ITEM_CONTENT."</th><th style=\"white-space:nowrap\" colspan='1'>"._LISTS_ACTIONS."</th>";\r
-                       break;\r
-               case 'BODY':\r
-                       $current = $template['current'];\r
-                       $current->itime = strtotime($current->itime);   // string -> unix timestamp\r
-\r
-                       if ($current->idraft == 1)\r
-                               $cssclass = "class='draft'";\r
-\r
-                       // (can't use offset time since offsets might vary between blogs)\r
-                       if ($current->itime > $template['now'])\r
-                               $cssclass = "class='future'";\r
-\r
-                       echo "<td $cssclass>",_LIST_ITEM_BLOG,' ', htmlspecialchars($current->bshortname);\r
-                       echo "    <br />",_LIST_ITEM_CAT,' ', htmlspecialchars($current->cname);\r
-                       echo "    <br />",_LIST_ITEM_AUTHOR, ' ', htmlspecialchars($current->mname);\r
-                       echo "    <br />",_LIST_ITEM_DATE," " . date("Y-m-d",$current->itime);\r
-                       echo "<br />",_LIST_ITEM_TIME," " . date("H:i",$current->itime);\r
-                       echo "</td>";\r
-                       echo "<td $cssclass>";\r
-\r
-                       $id = listplug_nextBatchId();\r
-\r
-                       echo '<input type="checkbox" id="batch',$id,'" name="batch[',$id,']" value="',$current->inumber,'" />';\r
-                       echo '<label for="batch',$id,'">';\r
-                       echo "<b>" . htmlspecialchars(strip_tags($current->ititle)) . "</b>";\r
-                       echo '</label>';\r
-                       echo "<br />";\r
-\r
-\r
-                       $current->ibody = strip_tags($current->ibody);\r
-                       $current->ibody = htmlspecialchars(shorten($current->ibody,300,'...'));\r
-\r
-                       $COMMENTS = new COMMENTS($current->inumber);\r
-                       echo "$current->ibody</td>";\r
-                       echo "<td  style=\"white-space:nowrap\" $cssclass>";\r
-                       echo    "<a href='index.php?action=itemedit&amp;itemid=$current->inumber'>"._LISTS_EDIT."</a>";\r
-                       // evaluate amount of comments for the item\r
-                       $camount = $COMMENTS->amountComments();\r
-                       if ($camount>0) {\r
-                               echo    "<br /><a href='index.php?action=itemcommentlist&amp;itemid=$current->inumber'>".sprintf(_LIST_ITEM_COMMENTS, $COMMENTS->amountComments())."</a>";\r
-                       }\r
-                       else {\r
-                               echo "<br />"._LIST_ITEM_NOCONTENT;\r
-                       }\r
-                       echo    "<br /><a href='index.php?action=itemmove&amp;itemid=$current->inumber'>"._LISTS_MOVE."</a>";\r
-                       echo    "<br /><a href='index.php?action=itemdelete&amp;itemid=$current->inumber'>"._LISTS_DELETE."</a>";\r
-                       echo "</td>";\r
-                       break;\r
-       }\r
-}\r
-\r
-// for batch operations: generates the index numbers for checkboxes\r
-function listplug_nextBatchId() {\r
-       static $id = 0;\r
-       return $id++;\r
-}\r
-\r
-function listplug_table_commentlist($template, $type) {\r
-       switch($type) {\r
-               case 'HEAD':\r
-                       echo "<th>"._LISTS_INFO."</th><th>"._LIST_COMMENT."</th><th colspan='3'>"._LISTS_ACTIONS."</th>";\r
-                       break;\r
-               case 'BODY':\r
-                       $current = $template['current'];\r
-                       $current->ctime = strtotime($current->ctime);   // string -> unix timestamp\r
-\r
-                       echo '<td>';\r
-                       echo date("Y-m-d@H:i",$current->ctime);\r
-                       echo '<br />';\r
-                       if ($current->mname)\r
-                               echo htmlspecialchars($current->mname) ,' ', _LIST_COMMENTS_MEMBER;\r
-                       else\r
-                               echo htmlspecialchars($current->cuser);\r
-                       if ($current->cmail != '') {\r
-                                echo '<br />';\r
-                                echo htmlspecialchars($current->cmail);\r
-                        }\r
-                       if ($current->cemail != '') {\r
-                                echo '<br />';\r
-                                echo htmlspecialchars($current->cemail);\r
-                        }\r
-                       echo '</td>';\r
-\r
-                       $current->cbody = strip_tags($current->cbody);\r
-                       $current->cbody = htmlspecialchars(shorten($current->cbody, 300, '...'));\r
-\r
-                       echo '<td>';\r
-                       $id = listplug_nextBatchId();\r
-                       echo '<input type="checkbox" id="batch',$id,'" name="batch[',$id,']" value="',$current->cnumber,'" />';\r
-                       echo '<label for="batch',$id,'">';\r
-                       echo $current->cbody;\r
-                       echo '</label>';\r
-                       echo '</td>';\r
-\r
-                       echo "<td style=\"white-space:nowrap\"><a href='index.php?action=commentedit&amp;commentid=$current->cnumber'>"._LISTS_EDIT."</a></td>";\r
-                       echo "<td style=\"white-space:nowrap\"><a href='index.php?action=commentdelete&amp;commentid=$current->cnumber'>"._LISTS_DELETE."</a></td>";\r
-                       if ($template['canAddBan'])\r
-                               echo "<td style=\"white-space:nowrap\"><a href='index.php?action=banlistnewfromitem&amp;itemid=$current->citem&amp;ip=", htmlspecialchars($current->cip), "' title='", htmlspecialchars($current->chost), "'>"._LIST_COMMENT_BANIP."</a></td>";\r
-                       break;\r
-       }\r
-}\r
-\r
-\r
-function listplug_table_bloglist($template, $type) {\r
-       switch($type) {\r
-               case 'HEAD':\r
-                       echo "<th>" . _NAME . "</th><th colspan='7'>" ._LISTS_ACTIONS. "</th>";\r
-                       break;\r
-               case 'BODY':\r
-                       $current = $template['current'];\r
-\r
-                       echo "<td title='blogid:$current->bnumber shortname:$current->bshortname'><a href='$current->burl'><img src='images/globe.gif' width='13' height='13' alt='". _BLOGLIST_TT_VISIT."' /></a> " . htmlspecialchars($current->bname) . "</td>";\r
-                       echo "<td><a href='index.php?action=createitem&amp;blogid=$current->bnumber' title='" . _BLOGLIST_TT_ADD ."'>" . _BLOGLIST_ADD . "</a></td>";\r
-                       echo "<td><a href='index.php?action=itemlist&amp;blogid=$current->bnumber' title='". _BLOGLIST_TT_EDIT."'>". _BLOGLIST_EDIT."</a></td>";\r
-                       echo "<td><a href='index.php?action=blogcommentlist&amp;blogid=$current->bnumber' title='". _BLOGLIST_TT_COMMENTS."'>". _BLOGLIST_COMMENTS."</a></td>";\r
-                       echo "<td><a href='index.php?action=bookmarklet&amp;blogid=$current->bnumber' title='". _BLOGLIST_TT_BMLET."'>". _BLOGLIST_BMLET . "</a></td>";\r
-\r
-                       if ($current->tadmin == 1) {\r
-                               echo "<td><a href='index.php?action=blogsettings&amp;blogid=$current->bnumber' title='" . _BLOGLIST_TT_SETTINGS . "'>" ._BLOGLIST_SETTINGS. "</a></td>";\r
-                               echo "<td><a href='index.php?action=banlist&amp;blogid=$current->bnumber' title='" . _BLOGLIST_TT_BANS. "'>". _BLOGLIST_BANS."</a></td>";\r
-                       }\r
-\r
-                       if ($template['superadmin']) {\r
-                               echo "<td><a href='index.php?action=deleteblog&amp;blogid=$current->bnumber' title='". _BLOGLIST_TT_DELETE."'>" ._BLOGLIST_DELETE. "</a></td>";\r
-                       }\r
-\r
-\r
-\r
-                       break;\r
-       }\r
-}\r
-\r
-function listplug_table_shortblognames($template, $type) {\r
-       switch($type) {\r
-               case 'HEAD':\r
-                       echo "<th>" . _EBLOG_SHORTNAME . "</th><th>" . _EBLOG_NAME. "</th>";\r
-                       break;\r
-               case 'BODY':\r
-                       $current = $template['current'];\r
-\r
-                       echo '<td>' , htmlspecialchars($current->bshortname) , '</td>';\r
-                       echo '<td>' , htmlspecialchars($current->bname) , '</td>';\r
-\r
-                       break;\r
-       }\r
-}\r
-\r
-function listplug_table_shortnames($template, $type) {\r
-       switch($type) {\r
-               case 'HEAD':\r
-                       echo "<th>" . _NAME . "</th><th>" . _LISTS_DESC. "</th>";\r
-                       break;\r
-               case 'BODY':\r
-                       $current = $template['current'];\r
-\r
-                       echo '<td>' , htmlspecialchars($current->name) , '</td>';\r
-                       echo '<td>' , htmlspecialchars($current->description) , '</td>';\r
-\r
-                       break;\r
-       }\r
-}\r
-\r
-\r
-function listplug_table_categorylist($template, $type) {\r
-       switch($type) {\r
-               case 'HEAD':\r
-                       echo "<th>"._LISTS_NAME."</th><th>"._LISTS_DESC."</th><th colspan='2'>"._LISTS_ACTIONS."</th>";\r
-                       break;\r
-               case 'BODY':\r
-                       $current = $template['current'];\r
-\r
-                       echo '<td>';\r
-                       $id = listplug_nextBatchId();\r
-                       echo '<input type="checkbox" id="batch',$id,'" name="batch[',$id,']" value="',$current->catid,'" />';\r
-                       echo '<label for="batch',$id,'">';\r
-                       echo htmlspecialchars($current->cname);\r
-                       echo '</label>';\r
-                       echo '</td>';\r
-\r
-                       echo '<td>', htmlspecialchars($current->cdesc), '</td>';\r
-                       echo "<td><a href='index.php?action=categorydelete&amp;blogid=$current->cblog&amp;catid=$current->catid' tabindex='".$template['tabindex']."'>"._LISTS_DELETE."</a></td>";\r
-                       echo "<td><a href='index.php?action=categoryedit&amp;blogid=$current->cblog&amp;catid=$current->catid' tabindex='".$template['tabindex']."'>"._LISTS_EDIT."</a></td>";\r
-\r
-                       break;\r
-       }\r
-}\r
-\r
-\r
-function listplug_table_templatelist($template, $type) {\r
-       global $manager;\r
-       switch($type) {\r
-               case 'HEAD':\r
-                       echo "<th>"._LISTS_NAME."</th><th>"._LISTS_DESC."</th><th colspan='3'>"._LISTS_ACTIONS."</th>";\r
-                       break;\r
-               case 'BODY':\r
-                       $current = $template['current'];\r
-\r
-                       echo "<td>" , htmlspecialchars($current->tdname), "</td>";\r
-                       echo "<td>" , htmlspecialchars($current->tddesc), "</td>";\r
-                       echo "<td style=\"white-space:nowrap\"><a href='index.php?action=templateedit&amp;templateid=$current->tdnumber' tabindex='".$template['tabindex']."'>"._LISTS_EDIT."</a></td>";\r
-\r
-                       $url = $manager->addTicketToUrl('index.php?action=templateclone&templateid=' . intval($current->tdnumber));\r
-                       echo "<td style=\"white-space:nowrap\"><a href='",htmlspecialchars($url),"' tabindex='".$template['tabindex']."'>"._LISTS_CLONE."</a></td>";\r
-                       echo "<td style=\"white-space:nowrap\"><a href='index.php?action=templatedelete&amp;templateid=$current->tdnumber' tabindex='".$template['tabindex']."'>"._LISTS_DELETE."</a></td>";\r
-\r
-                       break;\r
-       }\r
-}\r
-\r
-function listplug_table_skinlist($template, $type) {\r
-       global $CONF, $DIR_SKINS, $manager;\r
-       switch($type) {\r
-               case 'HEAD':\r
-                       echo "<th>"._LISTS_NAME."</th><th>"._LISTS_DESC."</th><th colspan='3'>"._LISTS_ACTIONS."</th>";\r
-                       break;\r
-               case 'BODY':\r
-                       $current = $template['current'];\r
-\r
-                       echo '<td>';\r
-\r
-                       // use a special style for the default skin\r
-                       if ($current->sdnumber == $CONF['BaseSkin']) {\r
-                               echo '<strong>',htmlspecialchars($current->sdname),'</strong>';\r
-                       } else {\r
-                               echo htmlspecialchars($current->sdname);\r
-                       }\r
-\r
-                       echo '<br /><br />';\r
-                       echo _LISTS_TYPE ,': ' , htmlspecialchars($current->sdtype);\r
-                       echo '<br />', _LIST_SKINS_INCMODE , ' ' , (($current->sdincmode=='skindir') ?_PARSER_INCMODE_SKINDIR:_PARSER_INCMODE_NORMAL);\r
-                       if ($current->sdincpref) echo '<br />' , _LIST_SKINS_INCPREFIX , ' ', htmlspecialchars($current->sdincpref);\r
-\r
-                       // add preview image when present\r
-                       if ($current->sdincpref && @file_exists($DIR_SKINS . $current->sdincpref . 'preview.png'))\r
-                       {\r
-                               echo '<br /><br />';\r
-\r
-                               $hasEnlargement = @file_exists($DIR_SKINS . $current->sdincpref . 'preview-large.png');\r
-                               if ($hasEnlargement)\r
-                                       echo '<a href="',$CONF['SkinsURL'], htmlspecialchars($current->sdincpref),'preview-large.png" title="' . _LIST_SKIN_PREVIEW_VIEWLARGER . '">';\r
-\r
-                               $imgAlt = sprintf(_LIST_SKIN_PREVIEW, htmlspecialchars($current->sdname, ENT_QUOTES));\r
-                               echo '<img class="skinpreview" src="',$CONF['SkinsURL'], htmlspecialchars($current->sdincpref),'preview.png" width="100" height="75" alt="' . $imgAlt . '" />';\r
-\r
-                               if ($hasEnlargement)\r
-                                       echo '</a>';\r
-\r
-                               if (@file_exists($DIR_SKINS . $current->sdincpref . 'readme.html'))\r
-                               {\r
-                                       $url         = $CONF['SkinsURL'] . htmlspecialchars($current->sdincpref, ENT_QUOTES) . 'readme.html';\r
-                                       $readmeTitle = sprintf(_LIST_SKIN_README, htmlspecialchars($current->sdname, ENT_QUOTES));\r
-                                       echo '<br /><a href="' . $url . '" title="' . $readmeTitle . '">' . _LIST_SKIN_README_TXT . '</a>';\r
-                               }\r
-\r
-\r
-                       }\r
-\r
-                       echo "</td>";\r
-\r
-\r
-                       echo '<td class="availableSkinTypes">' . htmlspecialchars($current->sddesc);\r
-                               // show list of defined parts\r
-                               $r = sql_query('SELECT stype FROM '.sql_table('skin').' WHERE sdesc='.$current->sdnumber . ' ORDER BY stype');\r
-                               $types = array();\r
-                               while ($o = mysql_fetch_object($r))\r
-                                       array_push($types,$o->stype);\r
-                               if (sizeof($types) > 0) {\r
-                                       $friendlyNames = SKIN::getFriendlyNames();\r
-                                       for ($i=0;$i<sizeof($types);$i++) {\r
-                                               $type = $types[$i];\r
-                                               if (in_array($type, array('index', 'item', 'archivelist', 'archive', 'search', 'error', 'member', 'imagepopup'))) {\r
-                                                       $types[$i] = '<li> <a href="index.php?action=skinedittype&amp;skinid='.$current->sdnumber.'&amp;type='.$type.'" tabindex="'.$template['tabindex'].'">' . htmlspecialchars($friendlyNames[$type]) . helpHtml('skinpart'.$type) . "</a></li>";\r
-                                               } else {\r
-                                                       $types[$i] = '<li> <a href="index.php?action=skinedittype&amp;skinid='.$current->sdnumber.'&amp;type='.$type.'" tabindex="'.$template['tabindex'].'">' . htmlspecialchars($friendlyNames[$type]) . helpHtml('skinpartspecial') . "</a></li>";\r
-                                               }\r
-                                       }\r
-                                       echo '<br /><br />',_LIST_SKINS_DEFINED,' <ul>',implode($types,'') ,'</ul>';\r
-                               }\r
-                       echo "</td>";\r
-                       echo "<td style=\"white-space:nowrap\"><a href='index.php?action=skinedit&amp;skinid=$current->sdnumber' tabindex='".$template['tabindex']."'>"._LISTS_EDIT."</a></td>";\r
-\r
-                       $url = $manager->addTicketToUrl('index.php?action=skinclone&skinid=' . intval($current->sdnumber));\r
-                       echo "<td style=\"white-space:nowrap\"><a href='",htmlspecialchars($url),"' tabindex='".$template['tabindex']."'>"._LISTS_CLONE."</a></td>";\r
-                       echo "<td style=\"white-space:nowrap\"><a href='index.php?action=skindelete&amp;skinid=$current->sdnumber' tabindex='".$template['tabindex']."'>"._LISTS_DELETE."</a></td>";\r
-\r
-                       break;\r
-       }\r
-}\r
-\r
-function listplug_table_draftlist($template, $type) {\r
-       switch($type) {\r
-               case 'HEAD':\r
-                       echo "<th>"._LISTS_BLOG."</th><th>"._LISTS_TITLE."</th><th colspan='2'>"._LISTS_ACTIONS."</th>";\r
-                       break;\r
-               case 'BODY':\r
-                       $current = $template['current'];\r
-\r
-                       echo '<td>', htmlspecialchars($current->bshortname) , '</td>';\r
-                       echo '<td>', htmlspecialchars(strip_tags($current->ititle)) , '</td>';\r
-                       echo "<td><a href='index.php?action=itemedit&amp;itemid=$current->inumber'>"._LISTS_EDIT."</a></td>";\r
-                       echo "<td><a href='index.php?action=itemdelete&amp;itemid=$current->inumber'>"._LISTS_DELETE."</a></td>";\r
-\r
-                       break;\r
-       }\r
-}\r
-\r
-\r
-function listplug_table_actionlist($template, $type) {\r
-       switch($type) {\r
-               case 'HEAD':\r
-                       echo '<th>'._LISTS_TIME.'</th><th>'._LIST_ACTION_MSG.'</th>';\r
-                       break;\r
-               case 'BODY':\r
-                       $current = $template['current'];\r
-\r
-                       echo '<td>' , htmlspecialchars($current->timestamp), '</td>';\r
-                       echo '<td>' , htmlspecialchars($current->message), '</td>';\r
-\r
-                       break;\r
-       }\r
-}\r
-\r
-function listplug_table_banlist($template, $type) {\r
-       switch($type) {\r
-               case 'HEAD':\r
-                       echo '<th>'._LIST_BAN_IPRANGE.'</th><th>'. _LIST_BAN_REASON.'</th><th>'._LISTS_ACTIONS.'</th>';\r
-                       break;\r
-               case 'BODY':\r
-                       $current = $template['current'];\r
-\r
-                       echo '<td>' , htmlspecialchars($current->iprange) , '</td>';\r
-                       echo '<td>' , htmlspecialchars($current->reason) , '</td>';\r
-                       echo "<td><a href='index.php?action=banlistdelete&amp;blogid=", intval($current->blogid) , "&amp;iprange=" , htmlspecialchars($current->iprange) , "'>",_LISTS_DELETE,"</a></td>";\r
-                       break;\r
-       }\r
-}\r
-\r
+// can take either an array of objects, or an SQL query
+function showlist($query, $type, $template) {
+
+       if (is_array($query)) {
+               if (sizeof($query) == 0)
+                       return 0;
+
+               call_user_func('listplug_' . $type, $template, 'HEAD');
+
+               foreach ($query as $currentObj) {
+                       $template['current'] = $currentObj;
+                       call_user_func('listplug_' . $type, $template, 'BODY');
+               }
+
+               call_user_func('listplug_' . $type, $template, 'FOOT');
+
+               return sizeof($query);
+
+       } else {
+               $res = sql_query($query);
+
+               // don't do anything if there are no results
+               $numrows = mysql_num_rows($res);
+               if ($numrows == 0)
+                       return 0;
+
+               call_user_func('listplug_' . $type, $template, 'HEAD');
+
+               while($template['current'] = mysql_fetch_object($res))
+                       call_user_func('listplug_' . $type, $template, 'BODY');
+
+               call_user_func('listplug_' . $type, $template, 'FOOT');
+
+               mysql_free_result($res);
+
+               // return amount of results
+               return $numrows;
+       }
+}
+
+function listplug_select($template, $type) {
+       switch($type) {
+               case 'HEAD':
+                       echo '<select name="' . ifset($template['name']) . '" tabindex="' . ifset($template['tabindex']) . '" ' . ifset($template['javascript']) . '>';
+
+                       // add extra row if needed
+                       if (ifset($template['extra'])) {
+                               echo '<option value="', ifset($template['extraval']), '">', $template['extra'], '</option>';
+                       }
+
+                       break;
+               case 'BODY':
+                       $current = $template['current'];
+
+                       echo '<option value="' . htmlspecialchars($current->value) . '"';
+                       if ($template['selected'] == $current->value)
+                               echo ' selected="selected" ';
+                       if (isset($template['shorten']) && $template['shorten'] > 0) {
+                               echo ' title="'. htmlspecialchars($current->text).'"';
+                               $current->text = shorten($current->text, $template['shorten'], $template['shortenel']);
+                       }
+                       echo '>' . htmlspecialchars($current->text) . '</option>';
+                       break;
+               case 'FOOT':
+                       echo '</select>';
+                       break;
+       }
+}
+
+function listplug_table($template, $type) {
+       switch($type) {
+               case 'HEAD':
+                       echo "<table>";
+                       echo "<thead><tr>";
+                       // print head
+                       call_user_func("listplug_table_" . $template['content'] , $template, 'HEAD');
+                       echo "</tr></thead><tbody>";
+                       break;
+               case 'BODY':
+                       // print tabletype specific thingies
+                       echo "<tr onmouseover='focusRow(this);' onmouseout='blurRow(this);'>";
+                       call_user_func("listplug_table_" . $template['content'] , $template,  'BODY');
+                       echo "</tr>";
+                       break;
+               case 'FOOT':
+                       call_user_func("listplug_table_" . $template['content'] , $template,  'FOOT');
+                       echo "</tbody></table>";
+                       break;
+       }
+}
+
+function listplug_table_memberlist($template, $type) {
+       switch($type) {
+               case 'HEAD':
+                       echo '<th>' . _LIST_MEMBER_NAME . '</th><th>' . _LIST_MEMBER_RNAME . '</th><th>' . _LIST_MEMBER_URL . '</th><th>' . _LIST_MEMBER_ADMIN;
+                       help('superadmin');
+                       echo "</th><th>" . _LIST_MEMBER_LOGIN;
+                       help('canlogin');
+                       echo "</th><th colspan='2'>" . _LISTS_ACTIONS. "</th>";
+                       break;
+               case 'BODY':
+                       $current = $template['current'];
+
+                       echo '<td>';
+                       $id = listplug_nextBatchId();
+                       echo '<input type="checkbox" id="batch',$id,'" name="batch[',$id,']" value="',$current->mnumber,'" />';
+                       echo '<label for="batch',$id,'">';
+                       echo "<a href='mailto:", htmlspecialchars($current->memail), "' tabindex='".$template['tabindex']."'>", htmlspecialchars($current->mname), "</a>";
+                       echo '</label>';
+                       echo '</td>';
+                       echo '<td>', htmlspecialchars($current->mrealname), '</td>';
+                       echo "<td><a href='", htmlspecialchars($current->murl), "' tabindex='", $template['tabindex'] , "'>", htmlspecialchars($current->murl), "</a></td>";
+                       echo '<td>', ($current->madmin ? _YES : _NO),'</td>';
+                       echo '<td>', ($current->mcanlogin ? _YES : _NO), '</td>';
+                       echo "<td><a href='index.php?action=memberedit&amp;memberid=$current->mnumber' tabindex='".$template['tabindex']."'>"._LISTS_EDIT."</a></td>";
+                       echo "<td><a href='index.php?action=memberdelete&amp;memberid=$current->mnumber' tabindex='".$template['tabindex']."'>"._LISTS_DELETE."</a></td>";
+                       break;
+       }
+}
+
+function listplug_table_teamlist($template, $type) {
+       global $manager;
+       switch($type) {
+               case 'HEAD':
+                       echo "<th>"._LIST_MEMBER_NAME."</th><th>"._LIST_MEMBER_RNAME."</th><th>"._LIST_TEAM_ADMIN;
+                       help('teamadmin');
+                       echo "</th><th colspan='2'>"._LISTS_ACTIONS."</th>";
+                       break;
+               case 'BODY':
+                       $current = $template['current'];
+
+                       echo '<td>';
+                       $id = listplug_nextBatchId();
+                       echo '<input type="checkbox" id="batch',$id,'" name="batch[',$id,']" value="',$current->tmember,'" />';
+                       echo '<label for="batch',$id,'">';
+                       echo "<a href='mailto:", htmlspecialchars($current->memail), "' tabindex='".$template['tabindex']."'>", htmlspecialchars($current->mname), "</a>";
+                       echo '</label>';
+                       echo '</td>';
+                       echo '<td>', htmlspecialchars($current->mrealname), '</td>';
+                       echo '<td>', ($current->tadmin ? _YES : _NO) , '</td>';
+                       echo "<td><a href='index.php?action=teamdelete&amp;memberid=$current->tmember&amp;blogid=$current->tblog' tabindex='".$template['tabindex']."'>"._LISTS_DELETE."</a></td>";
+
+                       $url = 'index.php?action=teamchangeadmin&memberid=' . intval($current->tmember) . '&blogid=' . intval($current->tblog);
+                       $url = $manager->addTicketToUrl($url);
+                       echo "<td><a href='",htmlspecialchars($url),"' tabindex='".$template['tabindex']."'>"._LIST_TEAM_CHADMIN."</a></td>";
+                       break;
+       }
+}
+
+function listplug_table_pluginlist($template, $type) {
+       global $manager;
+       switch($type) {
+               case 'HEAD':
+                       echo '<th>'._LISTS_INFO.'</th><th>'._LISTS_DESC.'</th>';
+                       echo '<th style="white-space:nowrap">'._LISTS_ACTIONS.'</th>';
+                       break;
+               case 'BODY':
+                       $current = $template['current'];
+
+                       $plug =& $manager->getPlugin($current->pfile);
+                       if ($plug) {
+                               echo '<td>';
+                                       echo '<strong>' , htmlspecialchars($plug->getName()) , '</strong><br />';
+                                       echo _LIST_PLUGS_AUTHOR, ' ' , htmlspecialchars($plug->getAuthor()) , '<br />';
+                                       echo _LIST_PLUGS_VER, ' ' , htmlspecialchars($plug->getVersion()) , '<br />';
+                                       if ($plug->getURL())
+                                       echo '<a href="',htmlspecialchars($plug->getURL()),'" tabindex="'.$template['tabindex'].'">',_LIST_PLUGS_SITE,'</a><br />';
+                                       echo '<a href="',htmlspecialchars($plug->getURL()),'" tabindex="'.$template['tabindex'].'">'.htmlspecialchars($plug->getURL()),'</a><br />';
+                               echo '</td>';
+                               echo '<td>';
+                                       echo _LIST_PLUGS_DESC .'<br/>'. encode_desc($plug->getDescription());
+                                       if (sizeof($plug->getEventList()) > 0) {
+                                               echo '<br /><br />',_LIST_PLUGS_SUBS,'<br />',htmlspecialchars(implode($plug->getEventList(),', '));
+                                               // check the database to see if it is up-to-date and notice the user if not
+                                       }
+                                       if (!$plug->subscribtionListIsUptodate()) {
+                                               echo '<br /><br /><strong>',_LIST_PLUG_SUBS_NEEDUPDATE,'</strong>';
+                                       }
+                                       if (sizeof($plug->getPluginDep()) > 0) {
+                                               echo '<br /><br />',_LIST_PLUGS_DEP,'<br />',htmlspecialchars(implode($plug->getPluginDep(),', '));
+                                       }
+// <add by shizuki>
+                               // check dependency require
+                               $req = array();
+                               $res = sql_query('SELECT pfile FROM ' . sql_table('plugin'));
+                               while($o = mysql_fetch_object($res)) {
+                                       $preq =& $manager->getPlugin($o->pfile);
+                                       if ($plug) {
+                                               $depList = $preq->getPluginDep();
+                                               foreach ($depList as $depName) {
+                                                       if ($current->pfile == $depName) {
+                                                               $req[] = $o->pfile;
+                                                       }
+                                               }
+                                       }
+                               }
+                               if (count($req) > 0) {
+                                       echo '<h4 class="plugin_dependreq_title">' . _LIST_PLUGS_DEPREQ . "</h4>\n";
+                                       echo '<p class="plugin_dependreq_text">';
+                                       echo htmlspecialchars(implode(', ', $req), ENT_QUOTES);
+                                       echo "</p>\n";
+                               }
+// </add by shizuki>
+                               echo '</td>';
+                       } else {
+                               echo '<td colspan="2">' . sprintf(_PLUGINFILE_COULDNT_BELOADED, htmlspecialchars($current->pfile, ENT_QUOTES)) . '</td>';
+                       }
+                       echo '<td>';
+
+                               $baseUrl = 'index.php?plugid=' . intval($current->pid) . '&action=';
+                               $url = $manager->addTicketToUrl($baseUrl . 'pluginup');
+                               echo "<a href='",htmlspecialchars($url),"' tabindex='".$template['tabindex']."'>",_LIST_PLUGS_UP,"</a>";
+                               $url = $manager->addTicketToUrl($baseUrl . 'plugindown');
+                               echo "<br /><a href='",htmlspecialchars($url),"' tabindex='".$template['tabindex']."'>",_LIST_PLUGS_DOWN,"</a>";
+                               echo "<br /><a href='index.php?action=plugindelete&amp;plugid=$current->pid' tabindex='".$template['tabindex']."'>",_LIST_PLUGS_UNINSTALL,"</a>";
+                               if ($plug && ($plug->hasAdminArea() > 0))
+                                       echo "<br /><a href='".htmlspecialchars($plug->getAdminURL())."'  tabindex='".$template['tabindex']."'>",_LIST_PLUGS_ADMIN,"</a>";
+                               if ($plug && ($plug->supportsFeature('HelpPage') > 0))
+                                       echo "<br /><a href='index.php?action=pluginhelp&amp;plugid=$current->pid'  tabindex='".$template['tabindex']."'>",_LIST_PLUGS_HELP,"</a>";
+                               if (quickQuery('SELECT COUNT(*) AS result FROM '.sql_table('plugin_option_desc').' WHERE ocontext=\'global\' and opid='.$current->pid) > 0)
+                                       echo "<br /><a href='index.php?action=pluginoptions&amp;plugid=$current->pid'  tabindex='".$template['tabindex']."'>",_LIST_PLUGS_OPTIONS,"</a>";
+                       echo '</td>';
+                       break;
+       }
+}
+
+function listplug_table_plugoptionlist($template, $type) {
+       global $manager;
+       switch($type) {
+               case 'HEAD':
+                       echo '<th>'._LISTS_INFO.'</th><th>'._LISTS_VALUE.'</th>';
+                       break;
+               case 'BODY':
+                       $current = $template['current'];
+                       listplug_plugOptionRow($current);
+                       break;
+               case 'FOOT':
+                       ?>
+                       <tr>
+                               <th colspan="2"><?php echo _PLUGS_SAVE?></th>
+                       </tr><tr>
+                               <td><?php echo _PLUGS_SAVE?></td>
+                               <td><input type="submit" value="<?php echo _PLUGS_SAVE?>" /></td>
+                       </tr>
+                       <?php                   break;
+       }
+}
+
+function listplug_plugOptionRow($current) {
+       $varname = 'plugoption['.$current['oid'].']['.$current['contextid'].']';
+       // retreive the optionmeta
+       $meta = NucleusPlugin::getOptionMeta($current['typeinfo']);
+
+       // only if it is not a hidden option write the controls to the page
+       if (@$meta['access'] != 'hidden') {
+               echo '<td>',htmlspecialchars($current['description']?$current['description']:$current['name']),'</td>';
+               echo '<td>';
+               switch($current['type']) {
+                       case 'yesno':
+                               ADMIN::input_yesno($varname, $current['value'], 0, 'yes', 'no');
+                               break;
+                       case 'password':
+                               echo '<input type="password" size="40" maxlength="128" name="',htmlspecialchars($varname),'" value="',htmlspecialchars($current['value']),'" />';
+                               break;
+                       case 'select':
+                               echo '<select name="'.htmlspecialchars($varname).'">';
+                               $aOptions = NucleusPlugin::getOptionSelectValues($current['typeinfo']);
+                               $aOptions = explode('|', $aOptions);
+                               for ($i=0; $i<(count($aOptions)-1); $i+=2) {
+                                       echo '<option value="'.htmlspecialchars($aOptions[$i+1]).'"';
+                                       if ($aOptions[$i+1] == $current['value'])
+                                               echo ' selected="selected"';
+                                       echo '>'.htmlspecialchars($aOptions[$i]).'</option>';
+                               }
+                               echo '</select>';
+                               break;
+                       case 'textarea':
+                               //$meta = NucleusPlugin::getOptionMeta($current['typeinfo']);
+                               echo '<textarea class="pluginoption" cols="30" rows="5" name="',htmlspecialchars($varname),'"';
+                               if (@$meta['access'] == 'readonly') {
+                                       echo ' readonly="readonly"';
+                               }
+                               echo '>',htmlspecialchars($current['value']),'</textarea>';
+                               break;
+                       case 'text':
+                       default:
+                               //$meta = NucleusPlugin::getOptionMeta($current['typeinfo']);
+
+                               echo '<input type="text" size="40" maxlength="128" name="',htmlspecialchars($varname),'" value="',htmlspecialchars($current['value']),'"';
+                               if (@$meta['datatype'] == 'numerical') {
+                                       echo ' onkeyup="checkNumeric(this)" onblur="checkNumeric(this)"';
+                               }
+                               if (@$meta['access'] == 'readonly') {
+                                       echo ' readonly="readonly"';
+                               }
+                               echo ' />';
+               }
+               echo @$current['extra'];
+               echo '</td>';
+       }
+}
+
+function listplug_table_itemlist($template, $type) {
+       $cssclass = null;
+
+       switch($type) {
+               case 'HEAD':
+                       echo "<th>"._LIST_ITEM_INFO."</th><th>"._LIST_ITEM_CONTENT."</th><th style=\"white-space:nowrap\" colspan='1'>"._LISTS_ACTIONS."</th>";
+                       break;
+               case 'BODY':
+                       $current = $template['current'];
+                       $current->itime = strtotime($current->itime);   // string -> unix timestamp
+
+                       if ($current->idraft == 1)
+                               $cssclass = "class='draft'";
+
+                       // (can't use offset time since offsets might vary between blogs)
+                       if ($current->itime > $template['now'])
+                               $cssclass = "class='future'";
+
+                       echo "<td $cssclass>",_LIST_ITEM_BLOG,' ', htmlspecialchars($current->bshortname);
+                       echo "    <br />",_LIST_ITEM_CAT,' ', htmlspecialchars($current->cname);
+                       echo "    <br />",_LIST_ITEM_AUTHOR, ' ', htmlspecialchars($current->mname);
+                       echo "    <br />",_LIST_ITEM_DATE," " . date("Y-m-d",$current->itime);
+                       echo "<br />",_LIST_ITEM_TIME," " . date("H:i",$current->itime);
+                       echo "</td>";
+                       echo "<td $cssclass>";
+
+                       $id = listplug_nextBatchId();
+
+                       echo '<input type="checkbox" id="batch',$id,'" name="batch[',$id,']" value="',$current->inumber,'" />';
+                       echo '<label for="batch',$id,'">';
+                       echo "<b>" . htmlspecialchars(strip_tags($current->ititle)) . "</b>";
+                       echo '</label>';
+                       echo "<br />";
+
+
+                       $current->ibody = strip_tags($current->ibody);
+                       $current->ibody = htmlspecialchars(shorten($current->ibody,300,'...'));
+
+                       $COMMENTS = new COMMENTS($current->inumber);
+                       echo "$current->ibody</td>";
+                       echo "<td  style=\"white-space:nowrap\" $cssclass>";
+                       echo    "<a href='index.php?action=itemedit&amp;itemid=$current->inumber'>"._LISTS_EDIT."</a>";
+                       // evaluate amount of comments for the item
+                       $camount = $COMMENTS->amountComments();
+                       if ($camount>0) {
+                               echo    "<br /><a href='index.php?action=itemcommentlist&amp;itemid=$current->inumber'>".sprintf(_LIST_ITEM_COMMENTS, $COMMENTS->amountComments())."</a>";
+                       }
+                       else {
+                               echo "<br />"._LIST_ITEM_NOCONTENT;
+                       }
+                       echo    "<br /><a href='index.php?action=itemmove&amp;itemid=$current->inumber'>"._LISTS_MOVE."</a>";
+                       echo    "<br /><a href='index.php?action=itemdelete&amp;itemid=$current->inumber'>"._LISTS_DELETE."</a>";
+                       echo "</td>";
+                       break;
+       }
+}
+
+// for batch operations: generates the index numbers for checkboxes
+function listplug_nextBatchId() {
+       static $id = 0;
+       return $id++;
+}
+
+function listplug_table_commentlist($template, $type) {
+       switch($type) {
+               case 'HEAD':
+                       echo "<th>"._LISTS_INFO."</th><th>"._LIST_COMMENT."</th><th colspan='3'>"._LISTS_ACTIONS."</th>";
+                       break;
+               case 'BODY':
+                       $current = $template['current'];
+                       $current->ctime = strtotime($current->ctime);   // string -> unix timestamp
+
+                       echo '<td>';
+                       echo date("Y-m-d@H:i",$current->ctime);
+                       echo '<br />';
+                       if ($current->mname)
+                               echo htmlspecialchars($current->mname) ,' ', _LIST_COMMENTS_MEMBER;
+                       else
+                               echo htmlspecialchars($current->cuser);
+                       if ($current->cmail != '') {
+                                echo '<br />';
+                                echo htmlspecialchars($current->cmail);
+                        }
+                       if ($current->cemail != '') {
+                                echo '<br />';
+                                echo htmlspecialchars($current->cemail);
+                        }
+                       echo '</td>';
+
+                       $current->cbody = strip_tags($current->cbody);
+                       $current->cbody = htmlspecialchars(shorten($current->cbody, 300, '...'));
+
+                       echo '<td>';
+                       $id = listplug_nextBatchId();
+                       echo '<input type="checkbox" id="batch',$id,'" name="batch[',$id,']" value="',$current->cnumber,'" />';
+                       echo '<label for="batch',$id,'">';
+                       echo $current->cbody;
+                       echo '</label>';
+                       echo '</td>';
+
+                       echo "<td style=\"white-space:nowrap\"><a href='index.php?action=commentedit&amp;commentid=$current->cnumber'>"._LISTS_EDIT."</a></td>";
+                       echo "<td style=\"white-space:nowrap\"><a href='index.php?action=commentdelete&amp;commentid=$current->cnumber'>"._LISTS_DELETE."</a></td>";
+                       if ($template['canAddBan'])
+                               echo "<td style=\"white-space:nowrap\"><a href='index.php?action=banlistnewfromitem&amp;itemid=$current->citem&amp;ip=", htmlspecialchars($current->cip), "' title='", htmlspecialchars($current->chost), "'>"._LIST_COMMENT_BANIP."</a></td>";
+                       break;
+       }
+}
+
+
+function listplug_table_bloglist($template, $type) {
+       switch($type) {
+               case 'HEAD':
+                       echo "<th>" . _NAME . "</th><th colspan='7'>" ._LISTS_ACTIONS. "</th>";
+                       break;
+               case 'BODY':
+                       $current = $template['current'];
+
+                       echo "<td title='blogid:$current->bnumber shortname:$current->bshortname'><a href='$current->burl'><img src='images/globe.gif' width='13' height='13' alt='". _BLOGLIST_TT_VISIT."' /></a> " . htmlspecialchars($current->bname) . "</td>";
+                       echo "<td><a href='index.php?action=createitem&amp;blogid=$current->bnumber' title='" . _BLOGLIST_TT_ADD ."'>" . _BLOGLIST_ADD . "</a></td>";
+                       echo "<td><a href='index.php?action=itemlist&amp;blogid=$current->bnumber' title='". _BLOGLIST_TT_EDIT."'>". _BLOGLIST_EDIT."</a></td>";
+                       echo "<td><a href='index.php?action=blogcommentlist&amp;blogid=$current->bnumber' title='". _BLOGLIST_TT_COMMENTS."'>". _BLOGLIST_COMMENTS."</a></td>";
+                       echo "<td><a href='index.php?action=bookmarklet&amp;blogid=$current->bnumber' title='". _BLOGLIST_TT_BMLET."'>". _BLOGLIST_BMLET . "</a></td>";
+
+                       if ($current->tadmin == 1) {
+                               echo "<td><a href='index.php?action=blogsettings&amp;blogid=$current->bnumber' title='" . _BLOGLIST_TT_SETTINGS . "'>" ._BLOGLIST_SETTINGS. "</a></td>";
+                               echo "<td><a href='index.php?action=banlist&amp;blogid=$current->bnumber' title='" . _BLOGLIST_TT_BANS. "'>". _BLOGLIST_BANS."</a></td>";
+                       }
+
+                       if ($template['superadmin']) {
+                               echo "<td><a href='index.php?action=deleteblog&amp;blogid=$current->bnumber' title='". _BLOGLIST_TT_DELETE."'>" ._BLOGLIST_DELETE. "</a></td>";
+                       }
+
+
+
+                       break;
+       }
+}
+
+function listplug_table_shortblognames($template, $type) {
+       switch($type) {
+               case 'HEAD':
+                       echo "<th>" . _EBLOG_SHORTNAME . "</th><th>" . _EBLOG_NAME. "</th>";
+                       break;
+               case 'BODY':
+                       $current = $template['current'];
+
+                       echo '<td>' , htmlspecialchars($current->bshortname) , '</td>';
+                       echo '<td>' , htmlspecialchars($current->bname) , '</td>';
+
+                       break;
+       }
+}
+
+function listplug_table_shortnames($template, $type) {
+       switch($type) {
+               case 'HEAD':
+                       echo "<th>" . _NAME . "</th><th>" . _LISTS_DESC. "</th>";
+                       break;
+               case 'BODY':
+                       $current = $template['current'];
+
+                       echo '<td>' , htmlspecialchars($current->name) , '</td>';
+                       echo '<td>' , htmlspecialchars($current->description) , '</td>';
+
+                       break;
+       }
+}
+
+
+function listplug_table_categorylist($template, $type) {
+       switch($type) {
+               case 'HEAD':
+                       echo "<th>"._LISTS_NAME."</th><th>"._LISTS_DESC."</th><th colspan='2'>"._LISTS_ACTIONS."</th>";
+                       break;
+               case 'BODY':
+                       $current = $template['current'];
+
+                       echo '<td>';
+                       $id = listplug_nextBatchId();
+                       echo '<input type="checkbox" id="batch',$id,'" name="batch[',$id,']" value="',$current->catid,'" />';
+                       echo '<label for="batch',$id,'">';
+                       echo htmlspecialchars($current->cname);
+                       echo '</label>';
+                       echo '</td>';
+
+                       echo '<td>', htmlspecialchars($current->cdesc), '</td>';
+                       echo "<td><a href='index.php?action=categorydelete&amp;blogid=$current->cblog&amp;catid=$current->catid' tabindex='".$template['tabindex']."'>"._LISTS_DELETE."</a></td>";
+                       echo "<td><a href='index.php?action=categoryedit&amp;blogid=$current->cblog&amp;catid=$current->catid' tabindex='".$template['tabindex']."'>"._LISTS_EDIT."</a></td>";
+
+                       break;
+       }
+}
+
+
+function listplug_table_templatelist($template, $type) {
+       global $manager;
+       switch($type) {
+               case 'HEAD':
+                       echo "<th>"._LISTS_NAME."</th><th>"._LISTS_DESC."</th><th colspan='3'>"._LISTS_ACTIONS."</th>";
+                       break;
+               case 'BODY':
+                       $current = $template['current'];
+
+                       echo "<td>" , htmlspecialchars($current->tdname), "</td>";
+                       echo "<td>" , htmlspecialchars($current->tddesc), "</td>";
+                       echo "<td style=\"white-space:nowrap\"><a href='index.php?action=templateedit&amp;templateid=$current->tdnumber' tabindex='".$template['tabindex']."'>"._LISTS_EDIT."</a></td>";
+
+                       $url = $manager->addTicketToUrl('index.php?action=templateclone&templateid=' . intval($current->tdnumber));
+                       echo "<td style=\"white-space:nowrap\"><a href='",htmlspecialchars($url),"' tabindex='".$template['tabindex']."'>"._LISTS_CLONE."</a></td>";
+                       echo "<td style=\"white-space:nowrap\"><a href='index.php?action=templatedelete&amp;templateid=$current->tdnumber' tabindex='".$template['tabindex']."'>"._LISTS_DELETE."</a></td>";
+
+                       break;
+       }
+}
+
+function listplug_table_skinlist($template, $type) {
+       global $CONF, $DIR_SKINS, $manager;
+       switch($type) {
+               case 'HEAD':
+                       echo "<th>"._LISTS_NAME."</th><th>"._LISTS_DESC."</th><th colspan='3'>"._LISTS_ACTIONS."</th>";
+                       break;
+               case 'BODY':
+                       $current = $template['current'];
+
+                       echo '<td>';
+
+                       // use a special style for the default skin
+                       if ($current->sdnumber == $CONF['BaseSkin']) {
+                               echo '<strong>',htmlspecialchars($current->sdname),'</strong>';
+                       } else {
+                               echo htmlspecialchars($current->sdname);
+                       }
+
+                       echo '<br /><br />';
+                       echo _LISTS_TYPE ,': ' , htmlspecialchars($current->sdtype);
+                       echo '<br />', _LIST_SKINS_INCMODE , ' ' , (($current->sdincmode=='skindir') ?_PARSER_INCMODE_SKINDIR:_PARSER_INCMODE_NORMAL);
+                       if ($current->sdincpref) echo '<br />' , _LIST_SKINS_INCPREFIX , ' ', htmlspecialchars($current->sdincpref);
+
+                       // add preview image when present
+                       if ($current->sdincpref && @file_exists($DIR_SKINS . $current->sdincpref . 'preview.png'))
+                       {
+                               echo '<br /><br />';
+
+                               $hasEnlargement = @file_exists($DIR_SKINS . $current->sdincpref . 'preview-large.png');
+                               if ($hasEnlargement)
+                                       echo '<a href="',$CONF['SkinsURL'], htmlspecialchars($current->sdincpref),'preview-large.png" title="' . _LIST_SKIN_PREVIEW_VIEWLARGER . '">';
+
+                               $imgAlt = sprintf(_LIST_SKIN_PREVIEW, htmlspecialchars($current->sdname, ENT_QUOTES));
+                               echo '<img class="skinpreview" src="',$CONF['SkinsURL'], htmlspecialchars($current->sdincpref),'preview.png" width="100" height="75" alt="' . $imgAlt . '" />';
+
+                               if ($hasEnlargement)
+                                       echo '</a>';
+
+                               if (@file_exists($DIR_SKINS . $current->sdincpref . 'readme.html'))
+                               {
+                                       $url         = $CONF['SkinsURL'] . htmlspecialchars($current->sdincpref, ENT_QUOTES) . 'readme.html';
+                                       $readmeTitle = sprintf(_LIST_SKIN_README, htmlspecialchars($current->sdname, ENT_QUOTES));
+                                       echo '<br /><a href="' . $url . '" title="' . $readmeTitle . '">' . _LIST_SKIN_README_TXT . '</a>';
+                               }
+
+
+                       }
+
+                       echo "</td>";
+
+
+                       echo '<td class="availableSkinTypes">' . htmlspecialchars($current->sddesc);
+                               // show list of defined parts
+                               $r = sql_query('SELECT stype FROM '.sql_table('skin').' WHERE sdesc='.$current->sdnumber . ' ORDER BY stype');
+                               $types = array();
+                               while ($o = mysql_fetch_object($r))
+                                       array_push($types,$o->stype);
+                               if (sizeof($types) > 0) {
+                                       $friendlyNames = SKIN::getFriendlyNames();
+                                       for ($i=0;$i<sizeof($types);$i++) {
+                                               $type = $types[$i];
+                                               if (in_array($type, array('index', 'item', 'archivelist', 'archive', 'search', 'error', 'member', 'imagepopup'))) {
+                                                       $types[$i] = '<li> <a href="index.php?action=skinedittype&amp;skinid='.$current->sdnumber.'&amp;type='.$type.'" tabindex="'.$template['tabindex'].'">' . htmlspecialchars($friendlyNames[$type]) . helpHtml('skinpart'.$type) . "</a></li>";
+                                               } else {
+                                                       $types[$i] = '<li> <a href="index.php?action=skinedittype&amp;skinid='.$current->sdnumber.'&amp;type='.$type.'" tabindex="'.$template['tabindex'].'">' . htmlspecialchars($friendlyNames[$type]) . helpHtml('skinpartspecial') . "</a></li>";
+                                               }
+                                       }
+                                       echo '<br /><br />',_LIST_SKINS_DEFINED,' <ul>',implode($types,'') ,'</ul>';
+                               }
+                       echo "</td>";
+                       echo "<td style=\"white-space:nowrap\"><a href='index.php?action=skinedit&amp;skinid=$current->sdnumber' tabindex='".$template['tabindex']."'>"._LISTS_EDIT."</a></td>";
+
+                       $url = $manager->addTicketToUrl('index.php?action=skinclone&skinid=' . intval($current->sdnumber));
+                       echo "<td style=\"white-space:nowrap\"><a href='",htmlspecialchars($url),"' tabindex='".$template['tabindex']."'>"._LISTS_CLONE."</a></td>";
+                       echo "<td style=\"white-space:nowrap\"><a href='index.php?action=skindelete&amp;skinid=$current->sdnumber' tabindex='".$template['tabindex']."'>"._LISTS_DELETE."</a></td>";
+
+                       break;
+       }
+}
+
+function listplug_table_draftlist($template, $type) {
+       switch($type) {
+               case 'HEAD':
+                       echo "<th>"._LISTS_BLOG."</th><th>"._LISTS_TITLE."</th><th colspan='2'>"._LISTS_ACTIONS."</th>";
+                       break;
+               case 'BODY':
+                       $current = $template['current'];
+
+                       echo '<td>', htmlspecialchars($current->bshortname) , '</td>';
+                       echo '<td>', htmlspecialchars(strip_tags($current->ititle)) , '</td>';
+                       echo "<td><a href='index.php?action=itemedit&amp;itemid=$current->inumber'>"._LISTS_EDIT."</a></td>";
+                       echo "<td><a href='index.php?action=itemdelete&amp;itemid=$current->inumber'>"._LISTS_DELETE."</a></td>";
+
+                       break;
+       }
+}
+
+
+function listplug_table_actionlist($template, $type) {
+       switch($type) {
+               case 'HEAD':
+                       echo '<th>'._LISTS_TIME.'</th><th>'._LIST_ACTION_MSG.'</th>';
+                       break;
+               case 'BODY':
+                       $current = $template['current'];
+
+                       echo '<td>' , htmlspecialchars($current->timestamp), '</td>';
+                       echo '<td>' , htmlspecialchars($current->message), '</td>';
+
+                       break;
+       }
+}
+
+function listplug_table_banlist($template, $type) {
+       switch($type) {
+               case 'HEAD':
+                       echo '<th>'._LIST_BAN_IPRANGE.'</th><th>'. _LIST_BAN_REASON.'</th><th>'._LISTS_ACTIONS.'</th>';
+                       break;
+               case 'BODY':
+                       $current = $template['current'];
+
+                       echo '<td>' , htmlspecialchars($current->iprange) , '</td>';
+                       echo '<td>' , htmlspecialchars($current->reason) , '</td>';
+                       echo "<td><a href='index.php?action=banlistdelete&amp;blogid=", intval($current->blogid) , "&amp;iprange=" , htmlspecialchars($current->iprange) , "'>",_LISTS_DELETE,"</a></td>";
+                       break;
+       }
+}
+
 ?>