OSDN Git Service

「メンバーの編集(editmembersettings)」画面でスキン変数<%pluginextras%>がパースされていなかった不具合を修正
[nucleus-jp/nucleus-next.git] / nucleus / libs / AdminActions.php
index 6ac045c..15e62ad 100644 (file)
 <?php
-if ( !class_exists('BaseActions') )
-{
-       include $DIR_LIBS . 'BaseActions.php';
-}
-
+/**
+ * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
+ * Copyright (C) 2002-2012 The Nucleus Group
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * (see nucleus/documentation/index.html#license for more info)
+ */
+/**
+ * @license http://nucleuscms.org/license.txt GNU General Public License
+ * @copyright Copyright (C) 2002-2012 The Nucleus Group
+ * @version $Id: AdminActions.php 1661 2012-02-12 11:55:39Z sakamocchi $
+ */
 
 class AdminActions extends BaseActions
 {
-       // reference to the skin object for which a part is being parsed
-       private $skin;
-       
        private $skintype;
        
-       /* NOTE: list of whole available action names for tags
-               'actionloglist',
-               'activationmessage',
+       /**
+        * AdminActions::$default_actions
+        * list of whole action names with which this class can deal
+        */
+       static private $default_actions = array(
+               'actionurl',
                'addtickettourl',
-               'adminbanlist',
-               'adminbatchaction',
-               'adminbatchlist',
-               'adminbloglink',
-               'adminerrormesg',
-               'adminskineditallowedlist',
-               'adminskinielist',
-               'adminskinoverview',
-               'adminskinselectoptions',
-               'adminspecialskinlist',
-               'admintemplateoverview',
-               'allowedadminskinactions',
-               'allowedskinactions',
-               'banlistdeletedlist',
-               'batchdeletelist',
-               'batchdeletetype',
-               'batchmovebtn',
-               'batchmovelist',
-               'batchmovetitle',
-               'batchmovetype',
-               'blogcatlist',
-               'blognotifysetting',
-               'blogselectbox',
-               'blogsetting',
-               'blogsettingyesno',
-               'blogteamlist',
-               'blogteammembers',
-               'blogtime',
-               'bookmarkletadmin',
-               'category',
-               'categorysetting',
+               'adminurl',
                'codename',
-               'commentnavlist',
-               'configsettingsedit',
-               'configsettingsyesno',
                'customhelplink',
                'date',
-               'defaultadminskintypes',
-               'defblogselect',
-               'defcatselect',
-               'defskinselect',
-               'deletecomment',
-               'deleteitembody',
-               'deleteitemid',
-               'deleteitemtitle',
-               'editadminskin',
-               'editadminskintype',
-               'editadmintemplateinfo',
-               'editcomment',
-               'editdesturl',
-               'editmember',
-               'editmemberlist',
-               'editpluginfo',
-               'editplugoptionslist',
-               'editskin',
-               'editskintype',
-               'edittemplateinfo',
-               'eventformextra',
                'extrahead',
-               'getblogsetting',
-               'geteditpluginfo',
-               'getmember',
                'headmessage',
                'helplink',
-               'helpplugname',
-               'ilistaddnew',
-               'importskininfo',
-               'inputyesno',
-               'insertpluginfo',
-               'insertpluginoptions',
-               'insplugoptcontent',
-               'iprangeinput',
-               'itemnavlist',
-               'jstoolbaroptions',
-               'listplugplugoptionrow',
-               'localeselectoptions',
-               'mediadirwarning',
-               'movedistselect',
-               'moveitemid',
+               'member',
                'newestcompare',
-               'newmemberselect',
-               'newpluginlist',
-               'outputspecialdirs',
-               'passrequestvars',
-               'pluginextras',
-               'pluginhelp',
-               'pluginlistlist',
-               'pluginoptions',
+               'pagehead',
+               'pagefoot',
                'qmenuaddselect',
                'quickmenu',
-               'requestblogid',
-               'requestiprange',
-               'selectlocaladminskinfiles',
-               'selectlocalskinfiles',
-               'skineditallowedlist',
-               'skinfile',
-               'skinielist',
-               'skinoverview',
-               'skintypehelp',
-               'specialskinlist',
+               'sitevar',
                'sprinttext',
-               'systemsettings',
-               'templateoverview',
-               'text',
                'ticket',
-               'versioncheckurl',
-               'yrbloglist'
-       );
-        */
-       
-       /**
-        * AdminActions::$default_actions
-        * list of whole action names with which this class can deal
-        */
-       static private $default_actions = array(
-               'addtickettourl',
-               'adminurl',
-               'customhelplink',
-               'headmessage',
-               'helplink',
-               'sprinttext',
-               'ticket'
+               'version',
+               'versioncheckurl'
        );
        
        /**
-        * AdminActions::$skin_type_friendly_names
+        * AdminActions::$normal_skin_types
         * friendly name for wrapped page types
         */
-       static private $default_skin_types = array(
+       static private $normal_skin_types = array(
                'actionlog'                             => _ADM_SKPRT_ACTIONLOG,
                'activate'                              => _ADM_SKPRT_ACTIVATE,
                'activatesetpwd'                => _ADM_SKPRT_ACTIVATESETPWD,
@@ -176,7 +82,6 @@ class AdminActions extends BaseActions
                'batchmovecat'                  => _ADM_SKPRT_BATCHMOVECAT,
                'batchteam'                             => _ADM_SKPRT_BATCHTEAM,
                'blogcommentlist'               => _ADM_SKPRT_BLOGCOMMENTLIST,
-               'blogselectbox'                 => _ADM_SKPRT_BLOGSELECTBOX,
                'blogsettings'                  => _ADM_SKPRT_BLOGSETTINGS,
                'bookmarklet'                   => _ADM_SKPRT_BOOKMARKLET,
                'browseowncomments'             => _ADM_SKPRT_BROWSEOWNCOMMENTS,
@@ -187,19 +92,20 @@ class AdminActions extends BaseActions
                'commentedit'                   => _ADM_SKPRT_COMMENTEDIT,
                'createitem'                    => _ADM_SKPRT_CREATEITEM,
                'createnewlog'                  => _ADM_SKPRT_CREATENEWLOG,
+               'createaccountinput'    => _ADM_SKPRT_CREATEACCOUNTINPUT,
+               'createaccountsuccess'  => _ADM_SKPRT_CREATEACCOUNTSUCCESS,
+               'createaccountdisable'  => _ADM_SKPRT_CREATEACCOUNTDISALLOWED,
                'deleteblog'                    => _ADM_SKPRT_DELETEBLOG,
                'editmembersettings'    => _ADM_SKPRT_EDITMEMBERSETTINGS,
-               'insertpluginoptions'   => _ADM_SKPRT_INSERTPLUGINO,
+               'forgotpassword'                => _ADM_SKPRT_FORGOTPASSWORD,
                'itemcommentlist'               => _ADM_SKPRT_ITEMCOMMENTLIST,
                'itemdelete'                    => _ADM_SKPRT_ITEMDELETE,
                'itemedit'                              => _ADM_SKPRT_ITEMEDIT,
                'itemlist'                              => _ADM_SKPRT_ITEMLIST,
                'itemmove'                              => _ADM_SKPRT_ITEMMOVE,
-               'login'                                 => FALSE,       //missing
                'manage'                                => _ADM_SKPRT_MANAGE,
                'manageteam'                    => _ADM_SKPRT_MANAGETEAM,
                'memberdelete'                  => _ADM_SKPRT_MEMBERDELETE,
-               'memberedit'                    => FALSE,       //missing
                'overview'                              => _ADM_SKPRT_OVERVIEW,
                'pagefoot'                              => _ADM_SKPRT_PAGEFOOT,
                'pagehead'                              => _ADM_SKPRT_PAGEHEAD,
@@ -222,37 +128,25 @@ class AdminActions extends BaseActions
                'templatedelete'                => _ADM_SKPRT_TEMPLATEDELETE,
                'templateedit'                  => _ADM_SKPRT_TEMPLATEEDIT,
                'templateoverview'              => _ADM_SKPRT_TEMPLATEOVERVIEW,
-               'usermanagement'                => _ADM_SKPRT_USERMANAGEMENT,
+               'usermanagement'                => _ADM_SKPRT_USERMANAGEMENT
        );
        
        /**
-        * AdminActions::getAvailableSkinTypes()
-        * 
-        * @static
-        * @param       void
-        * @return      array   list of friendly names for page actions
-        */
-       static public function getAvailableSkinTypes()
-       {
-               return self::$default_skin_types;
-       }
-       
-       /**
-        * AdminActions::getDefaultTypes()
+        * AdminActions::getNormalSkinTypes()
         *
         * @static
         * @param       void
         * @return      array   list of friendly names for page actions
         */
-       static public function getDefaultTypes()
+       static public function getNormalSkinTypes()
        {
-               return self::$default_skin_types;
+               return self::$normal_skin_types;
        }
        
        /**
         * AdminActions::__construct()
         * Constructor for a new Actions object
-        * 
+        *
         * @param       string  $type
         * @return      void
         */
@@ -260,18 +154,23 @@ class AdminActions extends BaseActions
        {
                // call constructor of superclass first
                parent::__construct();
-               $this->skintype = $type;
-               if ( !class_exists('Navlist') || !class_exists('Batch') )
+               
+               /* alias */
+               if ( $type == 'admntemplateoverview' )
+               {
+                       $this->skintype = 'admintemplateoverview';
+               }
+               else
                {
-                       global $DIR_LIBS;
-                       include $DIR_LIBS . 'ENCAPSULATE.php';
+                       $this->skintype = $type;
                }
+       
                return;
        }
        
        /**
         * AdminActions::getAvailableActions()
-        * 
+        *
         * @param       void
         * @return      array   allowed actions for the page type
         */
@@ -283,498 +182,498 @@ class AdminActions extends BaseActions
                {
                        case 'actionlog':
                                $extra_actions = array(
-                                       'actionloglist',
+                               'actionloglist',
                                );
                                break;
                        case 'activate':
                                $extra_actions = array(
-                                       'activationmessage',
-                                       'eventformextra',
+                               'activationmessage',
+                               'eventformextra',
                                );
                                break;
                        case 'activatesetpwd':
                                $extra_actions = array(
+                               /* nothing special */
                                );
                                break;
                        case 'addnewlog':
                                $extra_actions = array(
-                                       'getblogsetting',
-                                       'blogsetting',
-                                       'requestblogid',
-                                       );
+                               'getblogsetting',
+                               'blogsetting',
+                               'requestblogid',
+                               );
                                break;
                        case 'adminerrorpage':
                                $extra_actions = array(
+                               /* nothing special */
                                );
                                break;
                        case 'adminskindelete':
                                $extra_actions = array(
-                                       'editadminskintype',
+                               'editskintype',
                                );
                                break;
                        case 'adminskinedit':
                                $extra_actions = array(
-                                       'editadminskin',
-                                       'defaultadminskintypes',
-                                       'adminspecialskinlist',
+                               'editskin',
+                               'normalskinlist',
+                               'specialskinlist',
                                );
                                break;
                        case 'adminskinedittype':
                                $extra_actions = array(
-                                       'editadminskintype',
-                                       'skintypehelp',
-                                       'allowedadminskinactions',
-                                       'adminskineditallowedlist',
+                               'editskintype',
+                               'skintypehelp',
+                               'allowedskinactions',
+                               'skineditallowedlist',
                                );
                                break;
                        case 'adminskiniedoimport':
                                $extra_actions = array(
-                                       'importskininfo',
+                               'importskininfo',
                                );
                                break;
                        case 'adminskinieimport':
                                $extra_actions = array(
-                                       'importskininfo',
+                               'importskininfo',
                                );
                                break;
                        case 'adminskinieoverview':
                                $extra_actions = array(
-                                       'selectlocaladminskinfiles',
-                                       'adminskinielist',
+                               'selectlocalskinfiles',
+                               'skinielist',
                                );
                                break;
                        case 'adminskinoverview':
                                $extra_actions = array(
-                                       'adminskinoverview',
+                               'skinoverview',
                                );
                                break;
                        case 'adminskinremovetype':
                                $extra_actions = array(
-                                       'editadminskintype',
+                               'editskintype',
                                );
                                break;
                        case 'admintemplatedelete':
                                $extra_actions = array(
-                                       'editadmintemplateinfo',
+                               'editadmintemplateinfo',
                                );
                        case 'admintemplateedit':
                                $extra_actions = array(
-                                       'editadmintemplateinfo',
+                               'edittemplateinfo',
                                );
                                break;
-                       case 'admntemplateoverview':
+                       case 'admintemplateoverview':
                                $extra_actions = array(
-                                       'admintemplateoverview',
+                               'templateoverview',
                                );
                                break;
                        case 'backupoverview':
                                $extra_actions = array(
+                               /* nothing special */
                                );
                                break;
                        case 'backuprestore':
                                $extra_actions = array(
+                               /* nothing special */
                                );
                                break;
                        case 'banlist':
                                $extra_actions = array(
-                                       'adminbloglink',
-                                       'adminbanlist',
-                                       'requestblogid',
+                               'adminbloglink',
+                               'adminbanlist',
+                               'requestblogid',
                                );
                                break;
                        case 'banlistdelete':
                                $extra_actions = array(
-                                       'requestiprange',
-                                       'requestblogid',
+                               'requestiprange',
+                               'requestblogid',
                                );
                                break;
                        case 'banlistdeleteconfirm':
                                $extra_actions = array(
-                                       'banlistdeletedlist',
-                                       'requestblogid',
+                               'banlistdeletedlist',
+                               'requestblogid',
                                );
                                break;
                        case 'banlistnew':
                                $extra_actions = array(
-                                       'iprangeinput',
-                                       'requestblogid',
-                                       'blogsetting',
+                               'iprangeinput',
+                               'requestblogid',
+                               'blogsetting',
                                );
                                break;
                        case 'batchcategory':
                                $extra_actions = array(
-                                       'adminbatchaction',
-                                       'adminbatchlist',
+                               'adminbatchaction',
+                               'adminbatchlist',
                                );
                                break;
                        case 'batchcomment':
                                $extra_actions = array(
-                                       'adminbatchaction',
-                                       'adminbatchlist',
+                               'adminbatchaction',
+                               'adminbatchlist',
                                );
                                break;
                        case 'batchdelete':
                                $extra_actions = array(
-                                       'batchdeletetype',
-                                       'batchdeletelist',
+                               'batchdeletetype',
+                               'batchdeletelist',
                                );
                                break;
                        case 'batchitem':
                                $extra_actions = array(
-                                       'adminbatchaction',
-                                       'adminbatchlist',
+                               'adminbatchaction',
+                               'adminbatchlist',
                                );
                                break;
                        case 'batchmember':
                                $extra_actions = array(
-                                       'adminbatchaction',
-                                       'adminbatchlist',
+                               'adminbatchaction',
+                               'adminbatchlist',
                                );
                                break;
                        case 'batchmove':
                                $extra_actions = array(
-                                       'batchmovetitle',
-                                       'batchmovetype',
-                                       'batchmovelist',
-                                       'movedistselect',
-                                       'batchmovebtn',
+                               'batchmovetitle',
+                               'batchmovetype',
+                               'batchmovelist',
+                               'movedistselect',
+                               'batchmovebtn',
                                );
                                break;
                        case 'batchmovecat':
                                $extra_actions = array(
-                                       'batchmovetitle',
-                                       'batchmovetype',
-                                       'batchmovelist',
-                                       'movedistselect',
-                                       'batchmovebtn',
+                               'batchmovetitle',
+                               'batchmovetype',
+                               'batchmovelist',
+                               'movedistselect',
+                               'batchmovebtn',
                                );
                                break;
                        case 'batchteam':
                                $extra_actions = array(
-                                       'requestblogid',
-                                       'adminbatchaction',
-                                       'adminbatchlist',
+                               'requestblogid',
+                               'adminbatchaction',
+                               'adminbatchlist',
                                );
                                break;
                        case 'blogcommentlist':
                                $extra_actions = array(
-                                       'adminbloglink',
-                                       'commentnavlist',
-                                       'adminbatchlist',
-                               );
-                               break;
-                       case 'blogselectbox':
-                               $extra_actions = array(
-                                       'blogselectbox',
+                               'adminbloglink',
+                               'commentnavlist',
+                               'adminbatchlist',
                                );
                                break;
                        case 'blogsettings':
                                $extra_actions = array(
-                                       'adminbloglink',
-                                       'blogcatlist',
-                                       'blognotifysetting',
-                                       'blogsetting',
-                                       'blogsettingyesno',
-                                       'blogteammembers',
-                                       'blogtime',
-                                       'defcatselect',
-                                       'defskinselect',
-                                       'pluginextras',
-                                       'pluginoptions',
-                                       'requestblogid',
+                               'adminbloglink',
+                               'blogcatlist',
+                               'blognotifysetting',
+                               'blogsetting',
+                               'blogsettingyesno',
+                               'blogteammembers',
+                               'blogtime',
+                               'defcatselect',
+                               'defskinselect',
+                               'pluginextras',
+                               'pluginoptions',
+                               'requestblogid',
                                );
                                break;
                        case 'bookmarklet':
                                $extra_actions = array(
-                                       'bookmarkletadmin',
+                               'bookmarkletadmin',
                                );
                                break;
                        case 'browseowncomments':
                                $extra_actions = array(
-                                       'commentnavlist',
+                               'commentnavlist',
                                );
                                break;
                        case 'browseownitems':
                                $extra_actions = array(
-                                       'itemnavlist',
+                               'itemnavlist',
                                );
                                break;
                        case 'categorydelete':
                                $extra_actions = array(
-                                       'categorysetting',
-                                       'requestblogid',
+                               'categorysetting',
+                               'requestblogid',
                                );
                                break;
                        case 'categoryedit':
                                $extra_actions = array(
-                                       'requestblogid',
-                                       'categorysetting',
-                                       'editdesturl',
-                                       'pluginoptions'
+                               'requestblogid',
+                               'categorysetting',
+                               'editdesturl',
+                               'pluginoptions'
                                );
                                break;
                        case 'commentdelete':
                                $extra_actions = array(
-                                       'deletecomment',
+                               'deletecomment',
                                );
                                break;
                        case 'commentedit':
                                $extra_actions = array(
-                                       'editcomment',
+                               'editcomment',
+                               );
+                               break;
+                       case 'createaccountinput':
+                               $extra_actions = array(
+                               'contents',
+                               'pluginextras',
+                               'eventformextra',
+                               );
+                               break;
+                       case 'createaccountsuccess':
+                               $extra_actions = array(
+                               'contents',
+                               );
+                               break;
+                       case 'createaccountdisable':
+                               $extra_actions = array(
+                               /* nothing special */
                                );
                                break;
                        case 'createitem':
                                $extra_actions = array(
-                                       'adminbloglink',
-                                       'blogid',
-                                       'contents',
-                                       'categories',
-                                       'currenttime',
-                                       'init',
-                                       'itemoptions',
-                                       'pluginextras'
+                               'adminbloglink',
+                               'blogid',
+                               'contents',
+                               'categories',
+                               'currenttime',
+                               'init',
+                               'pluginoptions',
+                               'pluginextras'
                                );
                                break;
                        case 'createnewlog':
                                $extra_actions = array(
-                                       'defskinselect',
-                                       'blogtime',
+                               'defskinselect',
+                               'blogtime',
                                );
                                break;
                        case 'deleteblog':
                                $extra_actions = array(
-                                       'blogsetting',
-                                       'requestblogid',
+                               'blogsetting',
+                               'requestblogid',
                                );
                                break;
                        case 'editmembersettings':
                                $extra_actions = array(
-                                       'adminskinselectoptions',
-                                       'editmember',
-                                       'localeselectoptions',
-                                       'pluginoptions',
+                               'defskinselect',
+                               'editmember',
+                               'localeselectoptions',
+                               'pluginoptions',
+                               'defadminskinselect',
+                               'defbookmarkletselect',
+                               'pluginextras',
                                );
                                break;
-                       case 'insertpluginoptions':
+                       case 'forgotpassword':
                                $extra_actions = array(
-                                       'insertpluginoptions',
+                               /* nothing special */
                                );
                                break;
                        case 'itemcommentlist':
                                $extra_actions = array(
-                                       'requestblogid',
-                                       'commentnavlist',
+                               'requestblogid',
+                               'commentnavlist',
                                );
                                break;
                        case 'itemdelete':
                                $extra_actions = array(
-                                       'deleteitemtitle',
-                                       'deleteitembody',
-                                       'deleteitemid',
+                               'deleteitemtitle',
+                               'deleteitembody',
+                               'deleteitemid',
                                );
                                break;
                        case 'itemedit':
                                $extra_actions = array(
-                                       'init',
-                                       'contents',
-                                       'checkedonval',
-                                       'categories',
-                                       'currenttime',
-                                       'itemtime',
-                                       'pluginextras',
-                                       'itemoptions'
+                               'init',
+                               'contents',
+                               'checkedonval',
+                               'categories',
+                               'currenttime',
+                               'itemtime',
+                               'pluginoptions',
+                               'pluginextras'
                                );
                                break;
                        case 'itemlist':
                                $extra_actions = array(
-                                       'adminbloglink',
-                                       'ilistaddnew',
-                                       'itemnavlist',
+                               'adminbloglink',
+                               'ilistaddnew',
+                               'itemnavlist',
                                );
                                break;
                        case 'itemmove':
                                $extra_actions = array(
-                                       'moveitemid',
-                                       'movedistselect',
+                               'moveitemid',
+                               'movedistselect',
                                );
                                break;
                        case 'manage':
                                $extra_actions = array(
+                               /* nothing special */
                                );
                                break;
                        case 'manageteam':
                                $extra_actions = array(
-                                       'requestblogid',
-                                       'blogsetting',
-                                       'blogteamlist',
-                                       'newmemberselect',
-                                       'inputyesno',
+                               'requestblogid',
+                               'blogsetting',
+                               'blogteamlist',
+                               'newmemberselect',
+                               'inputyesno',
                                );
                                break;
                        case 'memberdelete':
                                $extra_actions = array(
-                                       'editmember',
+                               'editmember',
                                );
                                break;
                        case 'overview':
                                $extra_actions = array(
-                                       'yrbloglist',
-                               );
-                               break;
-                       case 'pagefoot':
-                               $extra_actions = array(
-                                       'date',
-                                       'qmenuaddselect',
-                                       'member',
-                                       'quickmenu',
-                               );
-                               break;
-                       case 'pagehead':
-                               $extra_actions = array(
-                                       'charset',
-                                       'sitevar',
-                                       'adminurl',
-                                       'extrahead',
-                                       'member',
-                                       'versioncheckurl',
-                                       'version',
-                                       'codename',
-                                       'newestcompare',
+                               'yrbloglist',
                                );
                                break;
                        case 'plugindelete':
                                $extra_actions = array(
-                                       'editpluginfo',
+                               'editpluginfo',
                                );
                                break;
                        case 'pluginhelp':
                                $extra_actions = array(
-                                       'helpplugname',
-                                       'pluginhelp',
+                               'helpplugname',
+                               'pluginhelp',
                                );
                                break;
                        case 'pluginlist':
                                $extra_actions = array(
-                                       'pluginlistlist',
-                                       'newpluginlist',
+                               'pluginlistlist',
+                               'newpluginlist',
                                );
                                break;
                        case 'pluginoptions':
                                $extra_actions = array(
-                                       'editpluginfo',
-                                       'editplugoptionslist',
+                               'editpluginfo',
+                               'editplugoptionslist',
                                );
                                break;
                        case 'settingsedit':
                                $extra_actions = array(
-                                       'defblogselect',
-                                       'defskinselect',
-                                       'configsettingsedit',
-                                       'configsettingsyesno',
-                                       'outputspecialdirs',
-                                       'jstoolbaroptions',
-                                       'localeselectoptions',
-                                       'mediadirwarning',
-                                       'pluginextras',
+                               'defblogselect',
+                               'defskinselect',
+                               'configsettingsedit',
+                               'configsettingsyesno',
+                               'outputspecialdirs',
+                               'jstoolbaroptions',
+                               'localeselectoptions',
+                               'mediadirwarning',
+                               'pluginextras',
+                               'defadminskinselect',
+                               'defbookmarkletselect',
                                );
                                break;
                        case 'showlogin':
                                $extra_actions = array(
-                                       'passrequestvars',
+                               'passrequestvars',
                                );
                                break;
                        case 'skindelete':
                                $extra_actions = array(
-                                       'editskintype',
+                               'editskintype',
                                );
                                break;
                        case 'skinedit':
                                $extra_actions = array(
-                                       'editskin',
-                                       'specialskinlist',
+                               'editskin',
+                               'normalskinlist',
+                               'specialskinlist'
                                );
                                break;
                        case 'skinedittype':
                                $extra_actions = array(
-                                       'editskintype',
-                                       'skintypehelp',
-                                       'allowedskinactions',
-                                       'skineditallowedlist',
-                                       'skineditallowedlist',
+                               'editskintype',
+                               'skintypehelp',
+                               'allowedskinactions',
+                               'skineditallowedlist'
                                );
                                break;
                        case 'skiniedoimport':
                                $extra_actions = array(
-                                       'importskininfo',
+                               'importskininfo',
                                );
                                break;
                        case 'skinieimport':
                                $extra_actions = array(
-                                       'importskininfo',
+                               'importskininfo',
                                );
                                break;
                        case 'skinieoverview':
                                $extra_actions = array(
-                                       'selectlocalskinfiles',
-                                       'skinielist',
+                               'selectlocalskinfiles',
+                               'skinielist',
                                );
                                break;
                        case 'skinoverview':
                                $extra_actions = array(
-                                       'skinoverview',
+                               'skinoverview',
                                );
                                break;
                        case 'skinremovetype':
                                $extra_actions = array(
-                                       'editskintype',
+                               'editskintype',
                                );
                                break;
                        case 'systemoverview':
                                $extra_actions = array(
-                                       'systemsettings',
+                               'systemsettings',
                                );
                                break;
                        case 'teamdelete':
                                $extra_actions = array(
-                                       'editmember',
-                                       'blogsetting',
-                                       'requestblogid',
+                               'editmember',
+                               'blogsetting',
+                               'requestblogid',
                                );
                                break;
                        case 'templatedelete':
                                $extra_actions = array(
-                                       'edittemplateinfo',
+                               'edittemplateinfo',
                                );
                                break;
                        case 'templateedit':
                                $extra_actions = array(
-                                       'edittemplateinfo',
+                               'edittemplateinfo',
                                );
                                break;
                        case 'templateoverview':
                                $extra_actions = array(
-                                       'templateoverview',
+                               'templateoverview',
                                );
                                break;
                        case 'usermanagement':
                                $extra_actions = array(
-                                       'editmemberlist',
-                                       'inputyesno',
+                               'editmemberlist',
+                               'inputyesno',
                                );
                                break;
                        case 'importAdmin':
                                $extra_actions = array(
-                                       'charset',
-                                       'sitevar',
-                                       'adminurl',
-                                       'extrahead',
-                                       'member',
-                                       'versioncheckurl',
-                                       'version',
-                                       'codename',
-                                       'newestcompare',
-                                       'selectlocaladminskinfiles',
-                                       'adminskinielist',
+                               'charset',
+                               'adminurl',
+                               'extrahead',
+                               'member',
+                               'versioncheckurl',
+                               'version',
+                               'codename',
+                               'newestcompare',
+                               'selectlocalskinfiles',
+                               'skinielist',
                                );
                                break;
                        default:
@@ -787,52 +686,48 @@ class AdminActions extends BaseActions
        }
        
        /**
-        * AdminActions::setSkin()
-        * Set the skin
-        * @param       object  $skin   an instance of Skin class
-        * @return      void
-        */
-       public function setSkin(&$skin)
-       {
-               $this->skin =& $skin;
-               return;
-       }
-       
-       /**
         * AdminActions::parse_actionloglist()
         * Parse skinvar actionloglist
-        * 
-        * @param       string  $templateName   name of template to use
+        *
+        * @param       string  $template_name  name of template to use
         * @return      void
         */
-       public function parse_actionloglist($templateName = '')
+       public function parse_actionloglist($template_name = '')
        {
-               $query = "SELECT * FROM %s ORDER BY timestamp DESC";
-               $query = sprintf($query, sql_table('actionlog'));       
+               $query = "SELECT * FROM %s ORDER BY timestamp DESC;";
+               $query = sprintf($query, sql_table('actionlog'));
                
-               $template['content'] = 'actionlist';
-               $amount = showlist($query, 'table', $template, $templateName);
+               $resource = DB::getResult($query);
+               if ( $resource->rowCount() > 0 )
+               {
+                       $template['content'] = 'actionlist';
+                       $action_list = showlist($resource, 'table', $template, $template_name);
+                       $this->parser->parse($action_list);
+               }
+               else
+               {
+                       /* TODO: nothing to be shown */
+               }
                return;
        }
        
-       
        /**
         * AdminActions::parse_activationmessage()
         * Parse skinvar activationmessage
-        * 
+        *
         * @param       string  $type                   type of message
-        * @param       string  $templateName   name of template to use
+        * @param       string  $template_name  name of template to use
         * @return      void
         */
-       public function parse_activationmessage($type, $templateName = '')
+       public function parse_activationmessage($type, $template_name = '')
        {
                global $CONF, $manager;
                
                $template = array();
                
-               if ( !empty($templateName))
+               if ( !empty($template_name))
                {
-                       $template = Template::read($templateName);
+                       $template =& $manager->getTemplate($template_name);
                }
                
                $key = postVar('ackey');
@@ -847,7 +742,7 @@ class AdminActions extends BaseActions
                        Admin::error(_ERROR_ACTIVATE);
                }
                
-               $mem  = MEMBER::createFromId($info->vmember);
+               $mem =& $manager->getMember($info->vmember);
                if ( !$mem )
                {
                        Admin::error(_ERROR_ACTIVATE);
@@ -931,7 +826,7 @@ class AdminActions extends BaseActions
        /**
         * AdminActions::parse_addtickettourl()
         * Parse skinvar addtickettourl
-        * 
+        *
         * @param       string  $url    URI for ticket
         * @return      void
         */
@@ -946,22 +841,25 @@ class AdminActions extends BaseActions
        /**
         * AdminActions::parse_adminbanlist()
         * Parse skinvar adminbanlist
-        * 
-        * @param       string  $templateName   name of template to use
+        *
+        * @param       string  $template_name  name of template to use
         * @return      void
         */
-       public function parse_adminbanlist($templateName = '')
+       public function parse_adminbanlist($template_name = '')
        {
                $blogid = intRequestVar('blogid');
                
                $query = "SELECT * FROM %s WHERE blogid=%d ORDER BY iprange;";
                $query = sprintf($query, sql_table('ban'), (integer) $blogid);
                
-               $template['content'] = 'banlist';
-               
-               $amount = Showlist($query, 'table', $template, $templateName);
-               
-               if ( $amount == 0 )
+               $resource = DB::getResult($query);
+               if ( $resource->rowCount() > 0 )
+               {
+                       $template['content'] = 'banlist';
+                       $ban_list = showlist($resource, 'table', $template, $template_name);
+                       $this->parser-parse($ban_list);
+               }
+               else
                {
                        echo _BAN_NONE;
                }
@@ -971,7 +869,7 @@ class AdminActions extends BaseActions
        /**
         * AdminActions::parse_adminbatchaction()
         * Parse skinvar adminbatchaction
-        * 
+        *
         * @param       void
         * @return      void
         */
@@ -984,28 +882,28 @@ class AdminActions extends BaseActions
        /**
         * AdminActions::parse_adminbatchlist()
         * Parse skinvar adminbatchlist
-        * 
-        * @param       string  $templateName   name of template to use
+        *
+        * @param       string  $template_name  name of template to use
         * @return      void
         */
-       public function parse_adminbatchlist($templateName = '')
+       public function parse_adminbatchlist($template_name = '')
        {
                global $manager;
                $templates = array();
                
-               if ( !empty($templateName) )
+               if ( !empty($template_name) )
                {
-                       $templates = Template::read($templateName);
+                       $templates =& $manager->getTemplate($template_name);
                }
                
                if ( !array_key_exists('ADMIN_BATCHLIST', $templates) || empty($templates['ADMIN_BATCHLIST']) )
                {
-                       $template = '<li><%text(_BATCH_EXECUTING)%>'
-                                 . '<b><%adminbatchaction%></b>'
-                                 . '<%batchlisttype%>'
-                                 . '<b><%batchid%></b>...'
-                                 . '<b><%batchlistmsg%></b>'
-                                 . '</li>' . "\n";
+                       $template = '<li><%text(_BATCH_EXECUTING)%>&nbsp;'
+                       . '<b><%adminbatchaction%></b>&nbsp;'
+                       . '<%batchlisttype%>&nbsp;'
+                       . '<b><%batchid%></b>...&nbsp;'
+                       . '<b><%batchlistmsg%></b>'
+                       . "</li>\n";
                }
                else
                {
@@ -1013,7 +911,7 @@ class AdminActions extends BaseActions
                }
                
                $selected = requestIntArray('batch');
-               $action   = requestVar('batchaction');
+               $action = requestVar('batchaction');
                
                switch ( $this->skintype )
                {
@@ -1057,80 +955,72 @@ class AdminActions extends BaseActions
                {
                        $error = '';
                        $selectedid = intval($selectedid);
-                       
                        switch ( $action )
                        {
                                case 'delete':
                                        if ( $this->skintype != 'batchteam' )
                                        {
-                                               $error = Admin::deleteaction($selectedid);
+                                               $error = call_user_func_array(array('Admin', $deleteaction), array($selectedid));
                                        }
                                        else
                                        {
-                                               $error  = Admin::deleteOneTeamMember($blogid, $selectedid);
+                                               $error = Admin::deleteOneTeamMember($blogid, $selectedid);
                                        }
                                        break;
                                case 'move':
-                                       $error = Admin::moveaction($selectedid, $destid);
+                                       $error = call_user_func_array(array('Admin', $moveaction), array($selectedid, $destid));
                                        break;
                                case 'setadmin':
                                        // always succeeds
-                                       sql_query("UPDATE {$setadminsql} {$selectedid};");
+                                       DB::execute("UPDATE {$setadminsql} {$selectedid};");
                                        $error = '';
                                        break;
                                case 'unsetadmin':
                                        // there should always remain at least one super-admin
-                                       $r = sql_query($unsetchksql);
-                                       if ( sql_num_rows($r) < 2 )
+                                       $r = DB::getResult($unsetchksql);
+                                       if ( $r->rowCount() < 2 )
                                        {
                                                $error = $unseterrmsg;
                                        }
                                        else
                                        {
-                                               sql_query("UPDATE {$setadminsql} {$selectedid};");
+                                               DB::execute("UPDATE {$unsetupsql} {$selectedid};");
                                        }
                                        break;
                                default:
                                        $error = _BATCH_UNKNOWN . Entity::hsc($action);
                        }
-                       
+                               
                        $data = array(
                                'batchid'                       => $selectedid,
                                'batchlisttype'         => Entity::hsc($batchlisttype),
                                'adminbatchaction'      => Entity::hsc($action),
                                'batchlistmsg'          => $error ? $error : _BATCH_SUCCESS,
                        );
-                       
-                       $handler = new AdminActions('template');
-                       $parser = new Parser($handler);
-                       
-                       ob_start();
-                       $parser->parse($template);
-                       $template = ob_get_contents();
-                       ob_end_clean();
-                       
-                       echo Template::fill($template, $data);
-                       return;
+                               
+                       $this->parser->parse(Template::fill($template, $data));
+                       echo '<br />';
                }
+               return;
        }
        
        /**
         * AdminActions::parse_adminbloglink()
         * Parse skinvar adminbloglink
-        * 
-        * @param       string  $templateName   name of template to use
+        *
+        * @param       string  $template_name  name of template to use
         * @return      void
         */
-       public function parse_adminbloglink($templateName = '')
+       public function parse_adminbloglink($template_name = '')
        {
                global $manager;
                $blogid =  intRequestVar('blogid');
                $blog   =& $manager->getBlog($blogid);
                $templates = array();
                
-               if ( !empty($templateName) )
+               if ( !empty($template_name) )
                {
-                       $templates = Template::read($templateName);
+                       $templates =& $manager->getTemplate($template_name);
                }
                
                if ( !array_key_exists('ADMIN_BLOGLINK', $templates) || empty($templates['ADMIN_BLOGLINK']) )
@@ -1155,7 +1045,7 @@ class AdminActions extends BaseActions
        /**
         * AdminActions::parse_adminerrormesg()
         * Parse skinvar adminerrormesg
-        * 
+        *
         * @param       void
         * @return      void
         */
@@ -1181,391 +1071,218 @@ class AdminActions extends BaseActions
        }
        
        /**
-        * AdminActions::parse_adminskineditallowedlist()
-        * Parse skinvar adminskineditallowedlist
-        * 
-        * @param       string  $type                   template/blog
-        * @param       string  $templateName   name of template to use
+        * AdminActions::parse_allowedskinactions()
+        * Parse skinvar allowedskinactions
+        *
+        * @param       void
         * @return      void
         */
-       public function parse_adminskineditallowedlist($type = 'template', $templateName = '')
+       public function parse_allowedskinactions()
        {
-               switch ( $type )
+               global $manager;
+               
+               $type = strtolower(trim(requestVar('type')));
+               $skinid = intRequestVar('skinid');
+               
+               if ( !in_array($this->skintype, Admin::$adminskin_actions) )
                {
-                       /* TODO: blog seems not to be used */
-                       case 'blog':
-                               $query = "SELECT bshortname, bname FROM %s";
-                               $query = sprintf($query, sql_table('blog'));
-                               $show  = array(
-                                       'content' => 'shortblognames'
-                               );
-                               Showlist($query, 'table', $show, $templateName);
-                               break;
-                       case 'template':
-                               $query = "SELECT tdname as name, tddesc as description FROM %s WHERE tdname LIKE 'admin/%%'";
-                               $query = sprintf($query, sql_table('template_desc'));
-                               $show  = array(
-                                       'content' => 'shortnames'
-                               );
-                               Showlist($query, 'table', $show, $templateName);
-                               break;
+                       $skin =& $manager->getSkin($skinid);
+                       $tag = 'skinvar';
+               }
+               else
+               {
+                       $skin =& $manager->getSkin($skinid, 'AdminActions');
+                       $tag = 'adminskinvar';
+               }
+               
+               $actions = $skin->getAllowedActionsForType($type);
+               sort($actions);
+               
+               while ( $current = array_shift($actions) )
+               {
+                       echo helplink("{$tag}-{$current}") . "$current</a>\n";
+                       
+                       if ( count($actions) != 0 )
+                       {
+                               echo ", ";
+                       }
                }
                return;
        }
        
        /**
-        * AdminActions::parse_adminskinielist()
-        * Parse skinvar adminskinielist
-        * 
-        * @param       string  $type                   skin/template
-        * @param       string  $templateName   name of template to use
+        * AdminActions::parse_banlistdeletedlist()
+        * Parse skinvar banlistdeletedlist
+        *
+        * @param       string  $template_name  name of template to use
         * @return      void
         */
-       public function parse_adminskinielist($type, $templateName = '')
+       public function parse_banlistdeletedlist($template_name = '')
        {
+               global $manager;
+               
                $templates = array();
-               if ( $templateName )
+               if ( $template_name )
                {
-                       $templates = Template::read($templateName);
+                       $templates =& $manager->getTemplate($template_name);
                }
                
-               if ( !array_key_exists('SKINIE_EXPORT_LIST', $templates) || empty($templates['SKINIE_EXPORT_LIST']) )
+               if ( !array_key_exists('BANLIST_DELETED_LIST', $templates) || empty($templates['BANLIST_DELETED_LIST']) )
                {
-                       $template = "<td>"
-                                 . "<input type=\"checkbox\" name=\"<%typeid%>\"  id=\"<%expid%>\" />\n"
-                                 . "<label for=\"<%expid%>\"><%expname%></label>"
-                                 . "</td>\n"
-                                 . "<td><%expdesc%></td>\n"
-                                 . "</tr>\n"
-                                 . "<tr>\n";
+                       $template = "<li><%blogname%></li>\n";
                }
                else
                {
-                       $template = $templates['SKINIE_EXPORT_LIST'];
+                       $template = $templates['BANLIST_DELETED_LIST'];
                }
                
-               switch ( $type )
+               $deleted = requestArray('delblogs');
+               foreach ( $deleted as $delblog )
                {
-                       case 'skin':
-                               $query = "SELECT * FROM %s WHERE sdname LIKE 'admin/%%';";
-                               $query = sprintf($query, sql_table('skin_desc'));
-                               $res = sql_query($query);
-                               
-                               while ( $skinObj = sql_fetch_object($res) )
-                               {
-                                       $data = array(
-                                               'typeid'        => 'skin[' . $skinObj->sdnumber . ']',
-                                               'expid'         => 'skinexp' . $skinObj->sdnumber,
-                                               'expname'       => Entity::hsc($skinObj->sdname),
-                                               'expdesc'       => Entity::hsc($skinObj->sddesc),
-                                       );
-                                       echo Template::fill($template, $data);
-                               }
-                               break;
-                       case 'template':
-                               $query = "SELECT * FROM %s WHERE tdname LIKE 'admin/%%';";
-                               $query = sprintf($query, sql_table('template_desc'));
-                               $res = sql_query($query);
-                               while ( $templateObj = sql_fetch_object($res) )
-                               {
-                                       $data = array(
-                                               'typeid'        => 'template[' . $templateObj->tdnumber . ']',
-                                               'expid'         => 'templateexp' . $templateObj->tdnumber,
-                                               'expname'       => Entity::hsc($templateObj->tdname),
-                                               'expdesc'       => Entity::hsc($templateObj->tddesc),
-                                       );
-                                       echo Template::fill($template, $data);
-                               }
-                               break;
+                       $blog =& $manager->getBlog($delblog);
+                       $data =  array(
+                               'blogname' => Entity::hsc($blog->getName())
+                       );
+                       echo Template::fill($template, $data);
                }
+               
                return;
        }
        
        /**
-        * AdminActions::parse_adminskinoverview()
-        * Parse skinvar adminskinoverview
-        * 
-        * @param       string  $templateName   name of template to use
+        * AdminActions::parse_batchdeletelist()
+        * Parse skinvar batchdeletelist
+        *
+        * @param       void
         * @return      void
         */
-       public function parse_adminskinoverview($templateName = '')
+       public function parse_batchdeletelist()
        {
-               $query = "SELECT * FROM %s WHERE sdname LIKE 'admin/%%' ORDER BY sdname;";
-               $query = sprintf($query, sql_table('skin_desc'));
+               $selected = requestIntArray('batch');
+               $index  = 0;
                
-               $template['content'] = 'adminskinlist';
-               $template['tabindex'] = 10;
-               $template['friendly_names'] = $this->skin->getAvailableTypes();
-               Showlist($query, 'table', $template, $templateName);
+               foreach ( $selected as $select )
+               {
+                       echo '<input type="hidden" name="batch[' . ($index++) . ']" value="' . intval($select) . "\" />\n";
+               }
+               // add hidden vars for team & comment
+               if ( requestVar('action') == 'batchteam' )
+               {
+                       echo '<input type="hidden" name="blogid" value="' . intRequestVar('blogid') . "\" />\n";
+               }
+               if ( requestVar('action') == 'batchcomment' )
+               {
+                       echo '<input type="hidden" name="itemid" value="' . intRequestVar('itemid') . "\" />\n";
+               }
                return;
        }
-       
+
        /**
-        * AdminActions::parse_adminskinselectoptions()
-        * Parse skinvar adminskinselectoptions
-        * 
-        * @param       void
+        * AdminActions::parse_defadminskinselect()
+        * Parse skinvar defadminskinselect
+        *
+        * @param       string  $template_name  name of template to use
         * @return      void
-        */     
-       public function parse_adminskinselectoptions()
+        */
+       public function parse_defadminskinselect($template_name)
        {
-               global $CONF;
-               $query = "SELECT sdname as text, sdnumber as value FROM %s WHERE sdname LIKE 'admin/%%';";
+               global $CONF, $action, $manager;
+               
+               if ( $action == 'editmembersettings' )
+               {
+                       global $member;
+                       $default = $member->adminskin;
+               }
+               elseif ( $action == 'memberedit' )
+               {
+                       $mem = $manager->getMember(intRequestVar('memberid'));
+                       $default = $mem->adminskin;
+               }
+               else
+               {
+                       $default = $CONF['AdminSkin'];
+               }
+               
+               $query  = "SELECT sdname as text, sdnumber as value FROM %s WHERE sdname LIKE 'admin/%%'";
                $query = sprintf($query, sql_table('skin_desc'));
+               $template = array(
+                               'name'          => 'adminskin',
+                               'tabindex'      => 10080,
+                               'selected'      => $default
+               );
                
-               $template['name'] = 'adminskin';
-               $template['selected'] = $CONF['DefaultAdminSkin'];
-               $template['tabindex'] = 110;
-               Showlist($query, 'select', $template, '');
+               if ( $this->skintype != 'settingsedit' )
+               {
+                       $template['extra'] = Entity::hsc(_MEMBERS_USESITELANG);
+               }
+               
+               $skin_select = showlist($query, 'select', $template, $template_name);
+               $this->parser->parse($skin_select);
                return;
        }
        
        /**
-        * AdminActions::parse_adminspecialskinlist()
-        * Parse skinvar adminspecialskinlist
-        * 
-        * @param       string  $templateName   name of template to use
+        * AdminActions::parse_defbookmarkletselect()
+        * Parse skinvar defbookmarkletselect
+        *
+        * @param       string  $template_name  name of template to use
+        * @return      void
         */
-       public function parse_adminspecialskinlist($templateName = '')
+       public function parse_defbookmarkletselect($template_name)
        {
-               $templates = array();
-               if ( $templateName )
+               global $CONF, $action, $manager;
+               
+               if ( $action == 'editmembersettings' )
                {
-                       $templates = Template::read($templateName);
+                       global $member;
+                       $default = $member->bookmarklet;
+               }
+               elseif ( $action == 'memberedit' )
+               {
+                       $mem = $manager->getMember(intRequestVar('memberid'));
+                       $default = $mem->bookmarklet;
+               }
+               else
+               {
+                       $default = $CONF['BookmarkletSkin'];
                }
                
-               $nType  = $this->skin->getAvailableTypes();
-               $skinid = intRequestVar('skinid');
-               
-               $query = "SELECT stype FROM  %s WHERE stype NOT IN (%s) AND sdesc=%d;";
-               $query = sprintf($query, sql_table('skin'), "'" . implode("', '", $nType) . "'", (integer) $skinid);
+               $query  = "SELECT sdname as text, sdnumber as value FROM %s WHERE sdname LIKE 'admin/%%'";
+               $query = sprintf($query, sql_table('skin_desc'));
+       
+               $template = array(
+                               'name'          => 'bookmarklet',
+                               'tabindex'      => 10085,
+                               'selected'      => $default
+               );
                
-               $res    = sql_query($query);
-               if ( $res && sql_num_rows($res) > 0 )
+               if ( $this->skintype != 'settingsedit' )
                {
-                       /* NOTE: set templates for HEAD/BODY/FOOT */
-                       if ( !array_key_exists('ADMIN_SPECIALSKINLIST_HEAD', $templates) || empty($templates['ADMIN_SPECIALSKINLIST_HEAD']) )
-                       {
-                               $template['head'] = "<ul>\n";
-                       }
-                       else
-                       {
-                               $template['head'] = $templates['ADMIN_SPECIALSKINLIST_HEAD'];
-                       }
-                       if ( !array_key_exists('ADMIN_SPECIALSKINLIST_BODY', $templates) || empty($templates['ADMIN_SPECIALSKINLIST_BODY']) )
-                       {
-                               $template['body'] = '<li>'
-                                                 . '<a tabindex="<%tabindex%>" href="index.php?action=adminskinedittype&amp;skinid=<%skinid%>&amp;type=<%skintype%>">'
-                                                 . '<%skintype%>'
-                                                 . '</a>'
-                                                 . '(<a tabindex="<%tabindex%>" href="index.php?action=adminskinremovetype&amp;skinid=<%skinid%>&amp;type=<%skintype%>">'
-                                                 . 'remove'
-                                                 . '</a>)'
-                                                 . "</li>\n";
-                       }
-                       else
-                       {
-                               $template['body'] = $templates['ADMIN_SPECIALSKINLIST_BODY'];
-                       }
-                       if ( !array_key_exists('ADMIN_SPECIALSKINLIST_FOOT', $templates) || empty($templates['ADMIN_SPECIALSKINLIST_FOOT']) )
-                       {
-                               $template['foot'] = "</ul>\n";
-                       }
-                       else
-                       {
-                               $template['foot'] = $templates['ADMIN_SPECIALSKINLIST_FOOT'];
-                       }
-                       
-                       $tabstart = 120;
-                       
-                       /* NOTE: do echo */
-                       $data = array();
-                       echo $template['head'];
-                       while ( $row = sql_fetch_assoc($res) )
-                       {
-                               $data = array(
-                                       'tabindex'      => $tabstart++,
-                                       'skinid'        => $skinid,
-                                       'skintype'      => Entity::hsc(strtolower($row['stype']))
-                               );
-                               echo Template::fill($template['body'], $data);
-                       }
-                       $data = array();
-                       echo $template['foot'];
+                       $template['extra'] = Entity::hsc(_MEMBERS_USESITELANG);
                }
+               
+               $bookmarklet_select = showlist($query, 'select', $template, $template_name);
+               $this->parser->parse($bookmarklet_select);
                return;
        }
        
        /**
-        * AdminActions::parse_admintemplateoverview()
-        * Parse skinvar admintemplateoverview
-        * 
-        * @param       string  $templateName   name of template to use
+        * AdminActions::parse_batchdeletetype()
+        * Parse skinvar batchdeletetype
+        *
+        * @param       void
         * @return      void
         */
-       public function parse_admintemplateoverview($templateName = '')
-       {
-               $query = "SELECT * FROM %s WHERE tdname LIKE 'admin/%%' ORDER BY tdname;";
-               $query = sprintf($query, sql_table('template_desc'));
-               
-               $template['content'] = 'admintemplatelist';
-               $template['tabindex'] = 10;
-               
-               Showlist($query, 'table', $template, $templateName);
-               return;
-       }
-       
-       /**
-        * AdminActions::parse_allowedadminskinactions()
-        * Parse skinvar allowedadminskinactions
-        * 
-        * @param       void
-        * @return      void
-        */
-       public function parse_allowedadminskinactions()
-       {
-               global $DIR_ADMINSKINS;
-               $skinType = strtolower(trim(requestVar('type')));
-               $actions  = $this->skin->getAllowedActionsForType($skinType);
-               sort($actions);
-               
-               while ( $current = array_shift($actions) )
-               {
-                       // TODO: remove this
-                       // skip deprecated vars
-                       if ($current == 'ifcat' || $current == 'imagetext' || $current == 'vars')
-                       {
-                               continue;
-                       }
-                       
-                       echo helplink("adminskinvar-{$current}") . "$current</a>\n";
-                       
-                       if ( count($actions) != 0 )
-                       {
-                               echo ", ";
-                       }
-               }
-               return;
-       }
-       
-       /**
-        * AdminActions::parse_allowedskinactions()
-        * Parse skinvar allowedskinactions
-        * 
-        * @param       void
-        * @return      void
-        */
-       public function parse_allowedskinactions()
-       {
-               $skinType = strtolower(trim(requestVar('type')));
-               $skinid = intRequestVar('skinid');
-               
-               $skin = new Skin($skinid);
-               $actions = $skin->getAllowedActionsForType($skinType);
-               sort($actions);
-               
-               while ( $current = array_shift($actions) )
-               {
-                       // TODO: remove this
-                       // skip deprecated vars
-                       if ( $current == 'ifcat' || $current == 'imagetext' || $current == 'vars' )
-                       {
-                               continue;
-                       }
-                       
-                       /* TODO: alternative function should be used or not?  */
-                       echo helplink("skinvar-{$current}") . "$current</a>\n";
-                       
-                       if ( count($actions) != 0 )
-                       {
-                               echo ", ";
-                       }
-               }
-               return;
-       }
-       
-       /**
-        * AdminActions::parse_banlistdeletedlist()
-        * Parse skinvar banlistdeletedlist
-        * 
-        * @param       string  $templateName   name of template to use
-        * @return      void
-        */
-       public function parse_banlistdeletedlist($templateName = '')
-       {
-               global $manager;
-               $templates = array();
-               
-               if ( $templateName )
-               {
-                       $templates = Template::read($templateName);
-               }
-               if ( !array_key_exists('BANLIST_DELETED_LIST', $templates) || empty($templates['BANLIST_DELETED_LIST']) )
-               {
-                       $template = "<li><%blogname%></li>\n";
-               }
-               else
-               {
-                       $template = $templates['BANLIST_DELETED_LIST'];
-               }
-               
-               $deleted = requestArray('delblogs');
-               foreach ( $deleted as $delblog )
-               {
-                       $blog =& $manager->getBlog($delblog);
-                       $data =  array(
-                               Entity::hsc($blog->getName())
-                       );
-                       Template::fill($template, $data);
-               }
-               return;
-       }
-       
-       /**
-        * AdminActions::parse_batchdeletelist()
-        * Parse skinvar batchdeletelist
-        * 
-        * @param       void
-        * @return      void
-        */
-       public function parse_batchdeletelist()
-       {
-               $selected = requestIntArray('batch');
-               $index  = 0;
-               
-               foreach ( $selected as $select )
-               {
-                       echo '<input type="hidden" name="batch[' . ($index++) . ']" value="' . intval($select) . "\" />\n";
-               }
-               // add hidden vars for team & comment
-               if ( requestVar('action') == 'batchteam' )
-               {
-                       echo '<input type="hidden" name="blogid" value="' . intRequestVar('blogid') . "\" />\n";
-               }
-               if ( requestVar('action') == 'batchcomment' )
-               {
-                       echo '<input type="hidden" name="itemid" value="' . intRequestVar('itemid') . "\" />\n";
-               }
-               return;
-       }
-       
-       /**
-        * AdminActions::parse_batchdeletetype()
-        * Parse skinvar batchdeletetype
-        * 
-        * @param       void
-        * @return      void
-        */
-       public function parse_batchdeletetype()
+       public function parse_batchdeletetype()
        {
                echo Entity::hsc(requestVar('action'));
                return;
        }
-
+       
        /**
         * AdminActions::parse_batchmovebtn()
         * Parse skinvar batchmovebtn
-        * 
+        *
         * @param       void
         * @return      void
         */
@@ -1587,16 +1304,18 @@ class AdminActions extends BaseActions
        /**
         * AdminActions::parse_batchmovelist()
         * Parse skinvar batchmovelist
-        * 
+        *
         * @param       void
         * @param       void
         */
        public function parse_batchmovelist()
        {
                $selected = requestIntArray('batch');
+               $count    = 0;
                foreach ( $selected as $select )
                {
-                       echo '<input type="hidden" name="batch[' . ($select++) . ']" value="' . intval($select) . "\" />\n";
+                       echo '<input type="hidden" name="batch[' . ($count) . ']" value="' . intval($select) . "\" />\n";
+                       $count++;
                }
                return;
        }
@@ -1604,7 +1323,7 @@ class AdminActions extends BaseActions
        /**
         * AdminActions::parse_batchmovetitle()
         * Parse skinvar batchmovetitle
-        * 
+        *
         * @param       void
         * @return      void
         */
@@ -1626,7 +1345,7 @@ class AdminActions extends BaseActions
        /**
         * AdminActions::parse_batchmovetype()
         * Parse skinvar batchmovetype
-        * 
+        *
         * @param       void
         * @return      void
         */
@@ -1639,33 +1358,42 @@ class AdminActions extends BaseActions
        /**
         * AdminActions::parse_blogcatlist()
         * Parse skinvar blogcatlist
-        * 
+        *
         * @param       void
         * @return      void
         */
-       public function parse_blogcatlist()
+       public function parse_blogcatlist($template_name = '')
        {
                global $manager;
                $blogid = intRequestVar('blogid');
-               $query  = "SELECT * FROM %s WHERE cblog = %d ORDER BY cname;";
+               $query = "SELECT * FROM %s WHERE cblog = %d ORDER BY cname;";
                $query = sprintf($query, sql_table('category'), (integer) $blogid);
                
-               $template['content']  = 'categorylist';
-               $template['tabindex'] = 200;
+               $resource = DB::getResult($query);
+               if ( $resource->rowCount() > 0 )
+               {
+                       $template['content']  = 'categorylist';
+                       $template['tabindex'] = 200;
+                       $category_list = listplug_batchlist('category', $resource, 'table', $template, $template_name);
+                       $this->parser->parse($category_list);
+               }
+               else
+               {
+                       /* TODO: nothing to be shown */
+               }
+               $resource->closeCursor();
                
-               $batch = new Batch('category');
-               $batch->showlist($query, 'table', $template);
                return;
        }
        
        /**
         * AdminActions::parse_blogid()
         * Parse skinvar blogid
-        * 
+        *
         * @param       void
         * @return      void
         */
-       function parse_blogid()
+       public function parse_blogid()
        {
                echo intRequestVar('blogid');
                return;
@@ -1674,15 +1402,15 @@ class AdminActions extends BaseActions
        /**
         * AdminActions::parse_blognotifysetting()
         * Parse skinvar blognotifysetting
-        * 
+        *
         * @param       void
         * @return      void
         */
        public function parse_blognotifysetting($type)
        {
                global $manager;
-               $blogid = intRequestVar('blogid');
-               $blog   = $manager->getBlog($blogid);
+               $blogid =  intRequestVar('blogid');
+               $blog   =& $manager->getBlog($blogid);
                
                switch ( $type )
                {
@@ -1710,102 +1438,9 @@ class AdminActions extends BaseActions
        }
        
        /**
-        * AdminActions::parse_blogselectbox()
-        * Parse skinvar blogselectbox
-        * 
-        * @param       void
-        * @return      void
-        */
-       public function parse_blogselectbox()
-       {
-               global $member;
-               
-               $selectData     = requestVar('selectData');
-               $mode           = $selectData['mode'];
-               $name           = Entity::hsc($selectData['name']);
-               $tabindex       = Entity::hsc($selectData['tabindex']);
-               $aBlogIds       = array_map('intval', $selectData['aBlogIds']);
-               $showNewCat     = intval($selectData['showNewCat']);
-               $selected       = intval($selectData['selected']);
-               
-               echo "<select name=\"{$name}\" tabindex=\"{$tabindex}\">\n";
-               
-               // 1. select blogs (we'll create optiongroups)
-               // (only select those blogs that have the user on the team)
-               $queryBlogs = "SELECT bnumber, bname FROM %s WHERE bnumber in (%s) ORDER BY bname;";
-               $queryBlogs = sprintf($queryBlogs, sql_table('blog'), implode(',', $aBlogIds));
-               $blogs = sql_query($queryBlogs);
-               
-               if ( $mode == 'category' )
-               {
-                       if ( sql_num_rows($blogs) > 1 )
-                       {
-                               $multipleBlogs = 1;
-                       }
-                       while ( $oBlog = sql_fetch_object($blogs) )
-                       {
-                               if ( isset($multipleBlogs) && !empty($multipleBlogs) )
-                               {
-                                       echo '<optgroup label="' . Entity::hsc($oBlog->bname) . "\">\n";
-                               }
-                               
-                               // show selection to create new category when allowed/wanted
-                               if ( $showNewCat )
-                               {
-                                       // check if allowed to do so
-                                       if ( $member->blogAdminRights($oBlog->bnumber) )
-                                       {
-                                               echo '<option value="newcat-' . $oBlog->bnumber . '">' . _ADD_NEWCAT . "</option>\n";
-                                       }
-                               }
-                               
-                               // 2. for each category in that blog
-                               $catQuery = "SELECT cname, catid FROM %s WHERE cblog=%d ORDER BY cname ASC;";
-                               $catQuery = sprintf($catQuery, sql_table('category'), (integer) $oBlog->bnumber);
-                               $categories = sql_query($catQuery);
-                               while ( $oCat = sql_fetch_object($categories) )
-                               {
-                                       if ( $oCat->catid == $selected )
-                                       {
-                                               $selectText = ' selected="selected" ';
-                                       }
-                                       else
-                                       {
-                                               $selectText = '';
-                                       }
-                                       echo '<option value="' . $oCat->catid . '" ' . $selectText . '>' . Entity::hsc($oCat->cname) . "</option>\n";
-                               }
-                               
-                               if ( isset($multipleBlogs) && !empty($multipleBlogs) )
-                               {
-                                       echo '</optgroup>';
-                               }
-                       }
-               }
-               else
-               {
-                       // blog mode
-                       while ( $oBlog = sql_fetch_object($blogs) )
-                       {
-                               echo '<option value="' . $oBlog->bnumber . '"';
-                               if ( $oBlog->bnumber == $selected )
-                               {
-                                       echo '<option value="' . $oBlog->bnumber . '" selected="selected">' . Entity::hsc($oBlog->bname) . "</option>\n";
-                               }
-                               else
-                               {
-                                       echo '<option value="' . $oBlog->bnumber . '">' . Entity::hsc($oBlog->bname) . "</option>\n";
-                               }
-                       }
-               }
-               echo "</select>\n";
-               return;
-       }
-       
-       /**
         * AdminActions::parse_blogsetting()
         * Parse skinvar blogsetting
-        * 
+        *
         * @param       string  $which  name of weblog setting
         * @return      void
         */
@@ -1818,18 +1453,18 @@ class AdminActions extends BaseActions
        /**
         * AdminActions::parse_blogsettingyesno()
         * Parse skinvar blogsettingyesno
-        * 
+        *
         * @param       string  $type                   type of weblog setting
-        * @param       string  $templateName   name of template to use
+        * @param       string  $template_name  name of template to use
         * @return      void
         */
-       public function parse_blogsettingyesno($type, $templateName = '')
+       public function parse_blogsettingyesno($type, $template_name = '')
        {
                global $manager;
-               
-               $blogid = intRequestVar('blogid');
-               $blog   = $manager->getBlog($blogid);
-               
+
+               $blogid =  intRequestVar('blogid');
+               $blog   =& $manager->getBlog($blogid);
+
                switch ( $type )
                {
                        case 'convertbreaks':
@@ -1857,38 +1492,48 @@ class AdminActions extends BaseActions
                                $tabindex   = 122;
                                break;
                }
-               $this->parse_inputyesno($type, $checkedval, $tabindex, 1, 0, _YES, _NO, 0, $templateName);
+               $this->parse_inputyesno($type, $checkedval, $tabindex, 1, 0, _YES, _NO, 0, $template_name);
                return;
        }
        
        /**
         * AdminActions::parse_blogteamlist()
         * Parse skinvar blogteamlist
-        * 
-        * @param       string  $templateName   name of template to use
+        *
+        * @param       string  $template_name  name of template to use
         * @return      void
         */
-       public function parse_blogteamlist($templateName = '')
+       public function parse_blogteamlist($template_name = '')
        {
                global $manager;
                $blogid = intRequestVar('blogid');
-               $query  = "SELECT tblog, tmember, mname, mrealname, memail, tadmin "
-                       . "FROM %s, %s "
-                       . "WHERE tmember=mnumber AND tblog= %d";
+               $query = "SELECT tblog, tmember, mname, mrealname, memail, tadmin "
+               . "FROM %s, %s "
+               . "WHERE tmember=mnumber AND tblog= %d";
                $query = sprintf($query, sql_table('member'), sql_table('team'), (integer) $blogid);
                
-               $template['content']  = 'teamlist';
-               $template['tabindex'] = 10;
-
-               $batch = new Batch('team');
-               $batch->showlist($query, 'table', $template, _LISTS_NOMORE, $templateName);
+               $resource = DB::getResult($query);
+               if ( $resource->rowCount() > 0 )
+               {
+                       $template['content']  = 'teamlist';
+                       $template['tabindex'] = 10;
+                       
+                       $team_list = listplug_batchlist('team', $resource, 'table', $template, $template_name);
+                       $this->parser->parse($team_list);
+               }
+               else
+               {
+                       echo _LISTS_NOMORE;
+               }
+               $resource->closeCursor();
+               
                return;
        }
        
        /**
         * AdminActions::parse_blogteammembers()
         * Parse skinvar blogteammembers
-        * 
+        *
         * @param       void
         * @return      void
         */
@@ -1896,14 +1541,14 @@ class AdminActions extends BaseActions
        {
                $blogid = intRequestVar('blogid');
                $query  = "SELECT mname, mrealname "
-                               . "FROM %s, %s "
-                               . "WHERE mnumber=tmember AND tblog=%d;";
+               . "FROM %s, %s "
+               . "WHERE mnumber=tmember AND tblog=%d;";
                $query = sprintf($query, sql_table('member'), sql_table('team'), (integer) $blogid);
-               $res = sql_query($query);
+               $res = DB::getResult($query);
                $memberNames = array();
-               while ( $o = sql_fetch_object($res) )
+               foreach ( $res as $row )
                {
-                       $memberNames[] = Entity::hsc($o->mname) . ' (' . Entity::hsc($o->mrealname). ')';
+                       $memberNames[] = Entity::hsc($row['mname']) . ' (' . Entity::hsc($row['mrealname']). ')';
                }
                echo implode(',', $memberNames);
        }
@@ -1911,7 +1556,7 @@ class AdminActions extends BaseActions
        /**
         * AdminActions::parse_blogtime()
         * Parse skinvar blogtime
-        * 
+        *
         * @param       string  $type   type of time
         * @param       string  $format format for time expression
         * @param       integer $offset offset of time
@@ -1929,7 +1574,7 @@ class AdminActions extends BaseActions
                else
                {
                        $bid = intRequestVar('blogid');
-                       $b = $manager->getBlog($bid);
+                       $b =& $manager->getBlog($bid);
                        $timestamp = $b->getCorrectTime() + $offset;
                }
                
@@ -1940,7 +1585,7 @@ class AdminActions extends BaseActions
        /**
         * AdminActions::parse_bookmarkletadmin()
         * Parse skinvar bookmarkletadmin
-        * 
+        *
         * @param       void
         * @return      void
         */
@@ -1953,66 +1598,38 @@ class AdminActions extends BaseActions
                echo Entity::hsc('javascript:' . getBookmarklet($blogid));
                return;
        }
-
+       
        /**
         * AdminActions::parse_categories()
         * Parse skinvar categories
-        * 
+        *
         * create category dropdown box
-        * 
+        *
         * @param       string  $type   name of setting for category
         * @return      void
         */
-       function parse_categories($startidx = 0)
+       public function parse_categories($startidx = 0)
        {
                global $manager;
                
-               $item = false;
-               $itemid = intRequestVar('itemid');
-               
-               $item =& $manager->getItem($itemid, 1, 1);
-               $blog =& $manager->getBlog(getBlogIDFromItemID($itemid));
-               
-               if ( $item && $blog->convertBreaks() && requestVar('action') == 'itemedit' )
+               if ( !array_key_exists('catid', Admin::$contents) || empty(Admin::$contents['catid']) )
                {
-                       $item['body'] = removeBreaks($item['body']);
-                       $item['more'] = removeBreaks($item['more']);
-               }
-               
-               $contents = array();
-               if ( requestVar('action') == 'itemedit' )
-               {
-                       $contents = $item;
-               }
-               if ( isset($contents['catid']) && $contents['catid'] )
-               {
-                       $catid = $contents['catid'];    // on edit item
+                       $catid = Admin::$blog->getDefaultCategory();
                }
                else
                {
-                       $catid = $blog->getDefaultCategory();   // on add item
+                       $catid = Admin::$contents['catid'];
                }
-               Admin::selectBlogCategory('catid', $catid, $startidx, 1, $blog->getID());
-               return;
-       }
-       
-       /**
-        * AdminActions::parse_category()
-        * Parse skinvar category
-        * 
-        * @param       string  $type   name of setting for category
-        * @return      void
-        */
-       public function parse_category($type = 'name')
-       {
-               echo $this->parse_getcategory($type);
+               
+               $this->selectBlog('catid', 'category', $catid, $startidx, 1, Admin::$blog->getID());
+               
                return;
        }
-       
+
        /**
         * AdminActions::parse_categorysetting()
         * Parse skinvar categorysetting
-        * 
+        *
         * @param       string  $type   type in category setting
         * @return      void
         */
@@ -2027,16 +1644,15 @@ class AdminActions extends BaseActions
                $blogid = intRequestVar('blogid');
                $query  = "SELECT * FROM %s WHERE cblog = %d AND catid = %d;";
                $query  = sprintf($query, sql_table('category'), (integer) $blogid, (integer) $catid);
-               $res    = sql_query($query);
-               $obj    = sql_fetch_object($res);
+               $row    = DB::getRow($query);
                
                if ( $type != 'name' )
                {
-                       echo Entity::hsc($obj->cdesc);
+                       echo Entity::hsc($row['cdesc']);
                }
                else
                {
-                       echo Entity::hsc($obj->cname);
+                       echo Entity::hsc($row['cname']);
                }
                
                return;
@@ -2045,12 +1661,12 @@ class AdminActions extends BaseActions
        /**
         * AdminActions::parse_codename()
         * Parse templatevar codename
-        * 
+        *
         * @param       $value
         * @param       $name
-        * 
+        *
         */
-       function parse_checkedonval($value, $name)
+       public function parse_checkedonval($value, $name)
        {
                global $manager;
                
@@ -2058,12 +1674,15 @@ class AdminActions extends BaseActions
                $itemid = intRequestVar('itemid');
                $item =& $manager->getItem($itemid, 1, 1);
                
-               $blog =& $manager->getBlog(getBlogIDFromItemID($itemid));
-               
-               if ( $item && $blog->convertBreaks() && requestVar('action') == 'itemedit' )
+               if ( $item )
                {
-                       $item['body'] = removeBreaks($item['body']);
-                       $item['more'] = removeBreaks($item['more']);
+                       $blog =& $manager->getBlog($item['blogid']);
+                       
+                       if ( $blog->convertBreaks() && requestVar('action') == 'itemedit' )
+                       {
+                               $item['body'] = removeBreaks($item['body']);
+                               $item['more'] = removeBreaks($item['more']);
+                       }
                }
                
                $contents = array();
@@ -2085,10 +1704,10 @@ class AdminActions extends BaseActions
        /**
         * AdminActions::parse_codename()
         * Parse templatevar codename
-        * 
+        *
         * @param       void
         * @return      void
-        * 
+        *
         * TODO: is this need???
         */
        public function parse_codename()
@@ -2101,11 +1720,11 @@ class AdminActions extends BaseActions
        /**
         * AdminActions::parse_commentnavlist()
         * Parse skinvar commentnavlist
-        * 
-        * @param       void
+        *
+        * @param       string  $template_name  name of template to use
         * @return      void
         */
-       public function parse_commentnavlist()
+       public function parse_commentnavlist($template_name = '')
        {
                global $CONF, $manager, $member;
                
@@ -2166,22 +1785,41 @@ class AdminActions extends BaseActions
                $search = postVar('search');
                if ( !empty($search) )
                {
-                       $query .= ' and cbody LIKE "%' . sql_real_escape_string($search) . '%"';
+                       $query .= ' and cbody LIKE ' . DB::quoteValue('%'.$search.'%');
                }
                
                $query .= " ORDER BY ctime ASC LIMIT {$start},{$amount}";
                
-               $template['content'] = 'commentlist';
+               $resource = DB::getResult($query);
+               if ( $resource->rowCount() > 0 )
+               {
+                       $template['action'] = $this->skintype;
+                       $template['start'] = $start;
+                       $template['amount'] = $amount;
+                       $template['minamount'] = 0;
+                       $template['maxamount'] = 1000;
+                       $template['blogid'] = $bid;
+                       $template['search'] = $search;
+                       $template['itemid'] = $itemid;
+                               
+                       $template['content'] = 'commentlist';
+                               
+                       $navlist = listplug_navlist('comment', $resource, 'table', $template, $template_name);
+                       $this->parser->parse($navlist);
+               }
+               else
+               {
+                       /* TODO: nothing to be shown */
+               }
+               $resource->closeCursor();
                
-               $navList = new Navlist($this->skintype, $start, $amount, 0, 1000, $bid, $search, $itemid);
-               $navList->showBatchList('comment', $query, 'table', $template, $nonComments);
                return;
        }
        
        /**
         * AdminActions::parse_configsettingsedit()
         * Parse skinvar configsettingsedit
-        * 
+        *
         * @param       string  $type   type of global configuration
         * @return      void
         */
@@ -2195,7 +1833,7 @@ class AdminActions extends BaseActions
                                {
                                        $query = "INSERT INTO %s VALUES (DefaultListSize, 10);";
                                        $query = sprintf($query, sql_table('config'));
-                                       sql_query($query);
+                                       DB::execute($query);
                                        $CONF['DefaultListSize'] = 10;
                                }
                                elseif ( intval($CONF['DefaultListSize']) < 1 )
@@ -2229,7 +1867,7 @@ class AdminActions extends BaseActions
        /**
         * AdminActions::parse_configsettingsyesno()
         * Parse skinvar configsettingsyesno
-        * 
+        *
         * @param       string  $type           type of global setting
         * @param       integer $tabindex       tabindex attribute of input element
         * @return      void
@@ -2247,78 +1885,36 @@ class AdminActions extends BaseActions
        /**
         * AdminActions::parse_contents()
         * Parse skinvar contents
-        * 
+        *
         * @param       string  $which          part for item
         * @return      void
         */
-       function parse_contents($which)
+       public function parse_contents($which)
        {
-               global $manager;
-               
-               $item = false;
-               $contents = array();
-               
-               if ( requestVar('action') == 'itemedit' )
-               {
-                       $itemid = intRequestVar('itemid');
-                       $item =& $manager->getItem($itemid, 1, 1);
-                       
-                       $blog =& $manager->getBlog(getBlogIDFromItemID($itemid));
-                       
-                       if ( $item && $blog->convertBreaks() )
-                       {
-                               $item['body'] = removeBreaks($item['body']);
-                               $item['more'] = removeBreaks($item['more']);
-                       }
-                       $contents = $item;
-               }
-               elseif ( requestVar('action') == 'createitem' )
-               {
-                       $blogid = intRequestVar('blogid');
-                       $blog =& $manager->getBlog($blogid);
-                       $manager->notify(
-                               'PreAddItemForm',
-                               array(
-                                       'contents' => &$contents,
-                                       'blog'     => &$blog
-                               )
-                       );
-               }
-               
-               if ( !array_key_exists($which, $contents) )
+               if ( !array_key_exists($which, Admin::$contents) )
                {
-                       $contents[$which] = '';
+                       Admin::$contents[$which] = '';
                }
-               echo Entity::hsc($contents[$which],ENT_QUOTES);
+               echo Entity::hsc(Admin::$contents[$which]);
        }
        
        /**
         * AdminActions::parse_currenttime()
         * Parse skinvar currenttime
-        * 
+        *
         * @param       string  $what
         */
        // for future items
-       function parse_currenttime($what)
+       public function parse_currenttime($what)
        {
-               global $manager;
-               if ( requestVar('action') == 'itemedit' )
-               {
-                       $itemid = intRequestVar('itemid');
-                       $blog =& $manager->getBlog(getBlogIDFromItemID($itemid));
-               } 
-               elseif ( requestVar('action') == 'createitem' )
-               {
-                       $blog =& $manager->getBlog(intRequestVar('blogid'));
-               }
-               $nu = getdate($blog->getCorrectTime());
+               $nu = getdate(Admin::$blog->getCorrectTime());
                echo $nu[$what];
        }
        
        /**
         * AdminActions::parse_customhelplink()
         * Parse skinvar customhelplink
-        * 
+        *
         * @param       string  $topic          name of topic
         * @param       string  $tplName        name of template
         * @param       string  $url            string as URI
@@ -2340,77 +1936,50 @@ class AdminActions extends BaseActions
        public function parse_date($format = 'c')
        {
                global $CONF, $manager;
-               echo i18n::formatted_datetime($format, time(), 'iso8601', $manager->getBlog((integer) $CONF['DefaultBlog']));
+               /* TODO: offset is based on i18n::get_current_locale()? */
+               echo i18n::formatted_datetime($format, time());
                return;
        }
        
        /**
-        * AdminActions::parse_defaultadminskintypes()
+        * AdminActions::parse_normalskinlist()
         * Parse skinvar defaultadminskintypes
-        * 
-        * @param       string  $tabindex               index number for tabindex attribute of input element
-        * @param       string  $templateName   name of template
+        *
+        * @param       string  $template_name  name of template
         * @return      void
         */
-       public function parse_defaultadminskintypes($tabindex, $templateName = '')
+       public function parse_normalskinlist($template_name = '')
        {
-               $templates = array();
-               
-               if ( $templateName )
-               {
-                       $templates = Template::read($templateName);
-               }
-               
-               $types = $this->skin->getAvailableTypes();
-               ksort($types);
+               global $CONF, $manager;
                
-               /* NOTE: set templates for HEAD/BODY/FOOT */
-               if ( !array_key_exists('ADMINSKINTYPELIST_HEAD', $templates) || empty($templates['ADMINSKINTYPELIST_HEAD']) )
-               {
-                       $template['head'] = "<ul>\n";
-               }
-               else
-               {
-                       $template['head'] = $templates['ADMINSKINTYPELIST_HEAD'];
-               }
-               if ( !array_key_exists('ADMINSKINTYPELIST_BODY', $templates) || empty($templates['ADMINSKINTYPELIST_BODY']) )
+               if ( !in_array($this->skintype, Admin::$adminskin_actions) )
                {
-                       $template['body'] = "<li>"
-                                         . "<a tabindex=\"<%tabindex%>\" href=\"index.php?action=adminskinedittype&amp;skinid=<%skinid%>&amp;type=<%skintype%>\"><%name%></a> <%help%>"
-                                         . "</li>\n";
+                       $skin =& $manager->getSkin($CONF['BaseSkin']);
+                       /* TODO: removeaction? */
+                       $template['editaction'] = 'skinedittype';
                }
                else
                {
-                       $template['body'] = $templates['ADMINSKINTYPELIST_BODY'];
+                       $skin =& $manager->getSkin($CONF['AdminSkin'], 'AdminActions');
+                       $template['editaction'] = 'adminskinedittype';
+                       /* TODO: removeaction? */
                }
-               if ( !array_key_exists('ADMINSKINTYPELIST_FOOT', $templates) || empty($templates['ADMINSKINTYPELIST_FOOT']) )
-               {
-                       $template['foot'] = "</ul>\n";
-               }
-               else
-               {
-                       $template['foot'] = $templates['ADMINSKINTYPELIST_FOOT'];
-               }
-               
-               $handler = new AdminActions('template');
-               $parser = new PARSER($handler);
                
-               /* NOTE: do output */
-               echo $template['head'];
-               foreach ( $types as $type => $fName )
+               $temporary = $skin->getNormalTypes();
+               $normal_skintype = array();
+               foreach ( $temporary as $type => $label )
                {
-                       $helplink = $this->customHelpHtml("skinpart{$type}{$templateName}");
-                       $data = array(
-                               'tabindex'      => $tabindex,
-                               'skintype'      => $type,
-                               'name'          => $fName,
-                               'help'          => $helplink,
-                               'skinid'        => intrequestVar('skinid'),
+                       $normal_skintype[] = array(
+                               'skintype'              => $type,
+                               'skintypename'  => $label
                        );
-                       $parser->parse(Template::fill($template['body'], $data));
-                       $tabindex++;
                }
-               echo $template['foot'];
+               
+               $template['tabindex'] = 10;
+               $template['skinid'] = intRequestVar('skinid');
+               $template['skinname'] = $skin->getName();
+               $skin_list = showlist($normal_skintype, 'list_normalskinlist', $template, $template_name);
+               $this->parser->parse($skin_list);
                
                return;
        }
@@ -2418,11 +1987,11 @@ class AdminActions extends BaseActions
        /**
         * AdminActions::parse_defblogselect()
         * Parse skinvar defblogselect
-        * 
-        * @param       string  $templateName   name of template
+        *
+        * @param       string  $template_name  name of template
         * @return      void
         */
-       public function parse_defblogselect($templateName = '')
+       public function parse_defblogselect($template_name = '')
        {
                global $CONF;
                
@@ -2432,8 +2001,8 @@ class AdminActions extends BaseActions
                $template['name'] = 'DefaultBlog';
                $template['selected'] = $CONF['DefaultBlog'];
                $template['tabindex'] = 10;
-               
-               Showlist($query, 'select', $template, $templateName);
+               $blog_select = showlist($query, 'select', $template, $template_name);
+               $this->parser->parse($blog_select);
                
                return;
        }
@@ -2441,16 +2010,16 @@ class AdminActions extends BaseActions
        /**
         * AdminActions::parse_defcatselect()
         * Parse skinvar defcatselect
-        * 
-        * @param       string  $templateName   name of template
+        *
+        * @param       string  $template_name  name of template
         * @return      void
         */
-       public function parse_defcatselect($templateName = '')
+       public function parse_defcatselect($template_name = '')
        {
                global $manager;
                
                $blogid = intRequestVar('blogid');
-               $blog = $manager->getBlog($blogid);
+               $blog =& $manager->getBlog($blogid);
                
                $query = "SELECT cname as text, catid as value FROM %s WHERE cblog=%d;";
                $query = sprintf($query, sql_table('category'), (integer) $blog->getID());
@@ -2459,7 +2028,8 @@ class AdminActions extends BaseActions
                $template['selected'] = $blog->getDefaultCategory();
                $template['tabindex'] = 110;
                
-               Showlist($query, 'select', $template, $templateName);
+               $category_select = showlist($query, 'select', $template, $template_name);
+               $this->parser->parse($category_select);
                
                return;
        }
@@ -2467,43 +2037,52 @@ class AdminActions extends BaseActions
        /**
         * AdminActions::parse_defskinselect()
         * Parse skinvar defskinselect
-        * 
+        *
         * @param       string  $type                   type of skin
-        * @param       string  $templateName   name of template
+        * @param       string  $template_name  name of template
         * @return      void
         */
-       public function parse_defskinselect($type = 'blog', $templateName = '')
+       public function parse_defskinselect($type = 'blog', $template_name = '')
        {
-               global $CONF, $manager;
-               
-               $query  = "SELECT sdname as text, sdnumber as value FROM %s WHERE sdname NOT LIKE 'admin/%%';";
-               $query = sprintf($query, sql_table('skin_desc'));
-               
-               $blogid = intRequestVar('blogid');
-               
-               if ( !$blogid )
-               {
-                       $template['selected'] = $CONF['BaseSkin'];
-               }
-               else
-               {
-                       $blog = $manager->getBlog($blogid);
-                       $template['selected'] = $blog->getDefaultSkin();
-               }
+               global $CONF, $manager, $member;
                
-               if ( $type != 'blog' )
+               if ( !in_array($this->skintype, Admin::$adminskin_actions) )
                {
-                       $nname = 'BaseSkin';
+                       $blogid = intRequestVar('blogid');
+                       if ( !$blogid )
+                       {
+                               $template['selected'] = $CONF['BaseSkin'];
+                       }
+                       else
+                       {
+                               $blog =& $manager->getBlog($blogid);
+                               $template['selected'] = $blog->getDefaultSkin();
+                       }
+                               
+                       if ( $type != 'blog' )
+                       {
+                               $template['name'] = 'BaseSkin';
+                       }
+                       else
+                       {
+                               $template['name'] = 'defskin';
+                       }
+                               
+                       $query = "SELECT sdname as text, sdnumber as value FROM %s WHERE sdname NOT LIKE 'admin/%%';";
                }
                else
                {
-                       $nname = 'defskin';
+                       /* TODO: member object will have its own adminskin id */
+                       $template['selected'] = $CONF['AdminSkin'];
+                       $template['name'] = 'AdminSkin';
+                       $query = "SELECT sdname as text, sdnumber as value FROM %s WHERE sdname LIKE 'admin/%%';";
                }
                
-               $template['name']        = $nname;
+               $query = sprintf($query, sql_table('skin_desc'));
                $template['tabindex'] = 50;
                
-               Showlist($query, 'select', $template, $templateName);
+               $skin_select = showlist($query, 'select', $template, $template_name);
+               $this->parser->parse($skin_select);
                
                return;
        }
@@ -2511,7 +2090,7 @@ class AdminActions extends BaseActions
        /**
         * AdminActions::parse_deletecomment()
         * Parse skinvar deletecomment
-        * 
+        *
         * @param       string  $type   type of infomation for comment
         * @return      void
         */
@@ -2545,7 +2124,7 @@ class AdminActions extends BaseActions
        /**
         * AdminActions::parse_deleteitembody()
         * Parse skinvar deleteitembody
-        * 
+        *
         * @param       void
         * @return      void
         */
@@ -2566,7 +2145,7 @@ class AdminActions extends BaseActions
        /**
         * AdminActions::parse_deleteitemid()
         * Parse skinvar deleteitemid
-        * 
+        *
         * @param       void
         * @return      void
         */
@@ -2579,7 +2158,7 @@ class AdminActions extends BaseActions
        /**
         * AdminActions::parse_deleteitemtitle()
         * Parse skinvar deleteitemtitle
-        * 
+        *
         * @param       void
         * @return      void
         */
@@ -2591,101 +2170,14 @@ class AdminActions extends BaseActions
                $item =& $manager->getItem($itemid, 1, 1);
                
                echo Entity::hsc(strip_tags($item['title']));
-               
-               return;
-       }
-       
-       /**
-        * AdminActions::parse_editadminskin()
-        * Parse skinvar editadminskin
-        * 
-        * @param       string  $type   type of skin setting
-        * @return      void
-        */
-       public function parse_editadminskin($type = 'id')
-       {
-               $skinid = intRequestVar('skinid');
-               $skin   = new Skin($skinid);
-               switch ( $type )
-               {
-                       case 'id':
-                               echo intRequestVar('skinid');
-                               break;
-                       case 'name':
-                               echo Entity::hsc($skin->getName());
-                               break;
-                       case 'desc':
-                               echo Entity::hsc($skin->getDescription());
-                               break;
-                       case 'type':
-                               echo Entity::hsc($skin->getContentType());
-                               break;
-                       case 'prefix':
-                               echo Entity::hsc($skin->getIncludePrefix());
-                               break;
-                       case 'mode':
-                               $this->parse_inputyesno('inc_mode', $skin->getIncludeMode(), 120, 'skindir', 'normal', _PARSER_INCMODE_SKINDIR, _PARSER_INCMODE_NORMAL);
-                       default:
-                               break;
-               }
-               return;
-       }
-       
-       /**
-        * AdminActions::parse_editadminskintype()
-        * Parse skinvar editadminskintype
-        * 
-        * @param       string  $type   name of skin type
-        * @return      void
-        */
-       public function parse_editadminskintype($type = 'id')
-       {
-               global $CONF, $manager, $member;
-               
-               $fNames = $this->skin->getAvailableTypes();
-               $sType  = strtolower(trim(requestVar('type')));
-               
-               switch ( $type )
-               {
-                       case 'id':
-                               echo intRequestVar('skinid');
-                               break;
-                       case 'name':
-                               echo Entity::hsc($this->skin->getName());
-                               break;
-                       case 'desc':
-                               echo Entity::hsc($this->skin->getDescription());
-                               break;
-                       case 'type':
-                               echo Entity::hsc($this->skin->getContentType());
-                               break;
-                       case 'content':
-                               echo Entity::hsc($this->skin->getContentFromDB($sType));
-                               break;
-                       case 'skintype':
-                               $skinType = !array_key_exists($sType, $fNames) ? ucfirst($sType) : $fNames[$sType];
-                               echo Entity::hsc($skinType);
-                               break;
-                       case 'skintyperaw':
-                               echo Entity::hsc($sType);
-                               break;
-                       case 'prefix':
-                               echo Entity::hsc($this->skin->getIncludePrefix());
-                               break;
-                       case 'mode':
-                               $incMode = $skin->getIncludeMode() ? _PARSER_INCMODE_SKINDIR : _PARSER_INCMODE_NORMAL;
-                               echo Entity::hsc($incMode);
-                               break;
-                       default:
-                               break;
-               }
+               
                return;
        }
        
        /**
         * AdminActions::parse_editcomment()
         * Parse skinvar editcomment
-        * 
+        *
         * @param       string  $type   type of comment setting
         * @return      void
         */
@@ -2693,10 +2185,7 @@ class AdminActions extends BaseActions
        {
                global $manager;
                
-               $commentid      = intRequestVar('commentid');
-               $comment        = COMMENT::getComment($commentid);
-               
-               $manager->notify('PrepareCommentForEdit', array('comment' => &$comment));
+               $comment = Admin::$contents;
                
                switch ( $type )
                {
@@ -2720,8 +2209,18 @@ class AdminActions extends BaseActions
                                $comment['body'] = str_replace('<br />', '', $comment['body']);
                                $comment['body'] = preg_replace("#<a href=['\"]([^'\"]+)['\"]( rel=\"nofollow\")?>[^<]*</a>#", "\\1", $comment['body']);
                                echo $comment['body'];
+                               break;
+                       case 'cmail':
+                               echo $comment['userid'];
+                               break;
+                       case 'url':
+                               echo $comment['userid'];
+                               break;
                        default:
-                               echo $comment[$type];
+                               if ( array_key_exists($type, $comment) && !empty($comment[$type]) )
+                               {
+                                       echo $comment[$type];
+                               }
                                break;
                }
                return;
@@ -2743,37 +2242,49 @@ class AdminActions extends BaseActions
        /**
         * AdminActions::parse_editmemberlist()
         * Parse skinvar editmemberlist
-        * 
-        * @param       string  $templateName   name of template
+        *
+        * @param       string  $template_name  name of template
         * @return      void
         */
-       public function parse_editmemberlist($templateName = '')
+       public function parse_editmemberlist($template_name = '')
        {
                global $manager;
                // show list of members with actions
-               $query =  'SELECT * FROM '.sql_table('member');
-               $template['content'] = 'memberlist';
-               $template['tabindex'] = 10;
+               $query = 'SELECT * FROM %s;';
+               $query =  sprintf($query, sql_table('member'));
+               
+               $resource = DB::getResult($query);
+               if ( $resource->rowCount() > 0 )
+               {
+                       $template['content'] = 'memberlist';
+                       $template['tabindex'] = 10;
+                       
+                       $member_list = listplug_batchlist('member', $resource, 'table', $template, $template_name);
+                       $this->parser->parse($member_list);
+               }
+               else
+               {
+                       echo _LISTS_NOMORE;
+               }
+               $resource->closeCursor();
                
-               $batch = new Batch('member');
-               $batch->showlist($query, 'table', $template, _LISTS_NOMORE, $templateName);
                return;
        }
        
        /**
         * AdminActions::parse_editmember()
         * Parse skinvar editmember
-        * 
+        *
         * @param       string  $type                   type of information for member
         * @return      string  $tempateName    name of template to use
         * @return      void
         */
-       public function parse_editmember($type = 'id', $templateName = '')
+       public function parse_editmember($type = 'id', $template_name = '')
        {
                global $CONF, $manager, $member;
                
                $memberid = intRequestVar('memberid');
-               $mem = MEMBER::createFromID($memberid);
+               $mem =& $manager->getMember($memberid);
                
                switch ( $type )
                {
@@ -2808,16 +2319,16 @@ class AdminActions extends BaseActions
                                echo Entity::hsc($mem->getURL());
                                break;
                        case 'admin':
-                               $this->parse_inputyesno('admin', $mem->isAdmin(), 60, 1, 0, _YES, _NO, 0, $templateName);
+                               $this->parse_inputyesno('admin', $mem->isAdmin(), 60, 1, 0, _YES, _NO, 0, $template_name);
                                break;
                        case 'canlogin':
-                               $this->parse_inputyesno('canlogin', $mem->canLogin(), 70, 1, 0, _YES, _NO, $mem->isAdmin(), $templateName);
+                               $this->parse_inputyesno('canlogin', $mem->canLogin(), 70, 1, 0, _YES, _NO, $mem->isAdmin(), $template_name);
                                break;
                        case 'notes':
                                echo Entity::hsc($mem->getNotes());
                                break;
                        case 'autosave':
-                               $this->parse_inputyesno('autosave', $mem->getAutosave(), 87, 1, 0, _YES, _NO, 0, $templateName);
+                               $this->parse_inputyesno('autosave', $mem->getAutosave(), 87, 1, 0, _YES, _NO, 0, $template_name);
                                break;
                        default:
                                break;
@@ -2828,12 +2339,14 @@ class AdminActions extends BaseActions
        /**
         * AdminActions::parse_editpluginfo()
         * Parse skinvar editpluginfo
-        * 
+        *
         * @param       string  $type   type of plugin info
         * @return      void
         */
        public function parse_editpluginfo($type)
        {
+               global $manager;
+               
                $pid = intRequestVar('plugid');
                switch ( $type )
                {
@@ -2841,7 +2354,7 @@ class AdminActions extends BaseActions
                                echo $pid;
                                break;
                        case 'name':
-                               echo Entity::hsc(getPluginNameFromPid($pid));
+                               echo Entity::hsc($manager->getPluginNameFromPid($pid));
                                break;
                }
                return;
@@ -2850,11 +2363,11 @@ class AdminActions extends BaseActions
        /**
         * AdminActions::parse_editplugoptionslist()
         * Parse skinvar editplugoptionslist
-        * 
-        * @param       string  $templateName   name of template
+        *
+        * @param       string  $template_name  name of template
         * @return      void
         */
-       public function parse_editplugoptionslist($templateName = '')
+       public function parse_editplugoptionslist($template_name = '')
        {
                global $manager;
                
@@ -2864,18 +2377,18 @@ class AdminActions extends BaseActions
                
                $query  = "SELECT * FROM %s WHERE ocontext='global' AND opid=%d ORDER BY oid ASC;";
                $query = sprintf($query, sql_table('plugin_option_desc'), (integer) $pid);
-               $resource = sql_query($query);
-               
-               while ( $o = sql_fetch_object($resource) )
-               {
-                       array_push($aOIDs, $o->oid);
-                       $aOptions[$o->oid] = array(
-                               'oid'                   => $o->oid,
-                               'value'                 => $o->odef,
-                               'name'                  => $o->oname,
-                               'description'   => $o->odesc,
-                               'type'                  => $o->otype,
-                               'typeinfo'              => $o->oextra,
+               $resource = DB::getResult($query);
+               
+               foreach ( $resource as $row )
+               {
+                       $aOIDs[] = $row['oid'];
+                       $aOptions[$row['oid']] = array(
+                               'oid'                   => $row['oid'],
+                               'value'                 => $row['odef'],
+                               'name'                  => $row['oname'],
+                               'description'   => $row['odesc'],
+                               'type'                  => $row['otype'],
+                               'typeinfo'              => $row['oextra'],
                                'contextid'             => 0
                        );
                }
@@ -2885,15 +2398,14 @@ class AdminActions extends BaseActions
                {
                        $query = 'SELECT oid, ovalue FROM %s WHERE oid in (%s)';
                        $query = sprintf($query, sql_table('plugin_option'), implode(',', $aOIDs));
-                       
-                       $result = sql_query($query);
-                       
-                       while ( $o = sql_fetch_object($result) )
+                               
+                       $result = DB::getResult($query);
+                       foreach ( $result as $row )
                        {
-                               $aOptions[$o->oid]['value'] = $o->ovalue;
+                               $aOptions[$row['oid']]['value'] = $row['ovalue'];
                        }
                }
-               
+       
                // call plugins
                $data = array(
                        'context'       =>  'global',
@@ -2902,11 +2414,13 @@ class AdminActions extends BaseActions
                );
                $manager->notify('PrePluginOptionsEdit', $data);
                
-               $template['content'] = 'plugoptionlist';
-               
-               $amount = Showlist($aOptions, 'table', $template, $templateName);
-               
-               if ( $amount == 0 )
+               if ( sizeof($aOptions) > 0 )
+               {
+                       $template['content'] = 'plugoptionlist';
+                       $option_list = showlist($aOptions, 'table', $template, $template_name);
+                       $this->parser->parse($option_list);
+               }
+               else
                {
                        echo '<p>' . _ERROR_NOPLUGOPTIONS . "</p>\n";
                }
@@ -2916,14 +2430,25 @@ class AdminActions extends BaseActions
        /**
         * AdminActions::parse_editskin()
         * Parse skinvar editskin
-        * 
+        *
         * @param       string  $type   type of skin
         * @return      void
         */
        public function parse_editskin($type = 'id')
        {
+               global $manager;
+               
                $skinid = intRequestVar('skinid');
-               $skin   = new SKIN($skinid);
+               
+               if ( !in_array($this->skintype, Admin::$adminskin_actions) )
+               {
+                       $skin =& $manager->getSKIN($skinid);
+               }
+               else
+               {
+                       $skin =& $manager->getSKIN($skinid, 'AdminActions');
+               }
+               
                switch ( $type )
                {
                        case 'id':
@@ -2952,22 +2477,39 @@ class AdminActions extends BaseActions
        /**
         * AdminActions::parse_editskintype()
         * Parse skinvar editskintype
-        * 
+        *
         * @param       string  $type   name of type for skin type
         * @return      void
         */
-       public function parse_editskintype($type = 'id')
+       public function parse_editskintype($stype = 'id')
        {
-               global $CONF, $manager, $member;
-               $skinid = intRequestVar('skinid');
-               $skin   = new SKIN($skinid);
-               $fNames = $skin->getAvailableTypes();
-               $sType  = strtolower(trim(requestVar('type')));
+               global $manager;
                
-               switch ( $type )
+               static $skin = NULL;
+               static $types = array();
+               
+               if ( $skin == NULL )
+               {
+                       $skinid = intRequestVar('skinid');
+                       
+                       if ( !in_array($this->skintype, Admin::$adminskin_actions) )
+                       {
+                               $skin =& $manager->getSkin($skinid);
+                       }
+                       else
+                       {
+                               $skin =& $manager->getSkin($skinid, 'AdminActions');
+                       }
+                       
+                       $types = $skin->getNormalTypes();
+               }
+               
+               $type = strtolower(trim(requestVar('type')));
+               
+               switch ( $stype )
                {
                        case 'id':
-                               echo intRequestVar('skinid');
+                               echo $skin->getID();
                                break;
                        case 'name':
                                echo Entity::hsc($skin->getName());
@@ -2979,20 +2521,34 @@ class AdminActions extends BaseActions
                                echo Entity::hsc($skin->getContentType());
                                break;
                        case 'content':
-                               echo Entity::hsc($skin->getContentFromDB($sType));
+                               echo Entity::hsc($skin->getContentFromDB($type));
                                break;
                        case 'skintype':
-                               $skinType = !array_key_exists($sType, $fNames) ? ucfirst($sType) : $fNames[$sType];
+                               if ( !array_key_exists($type, $types) )
+                               {
+                                       $skinType = ucfirst($type);
+                               }
+                               else
+                               {
+                                       $skinType = $types[$type];
+                               }
                                echo Entity::hsc($skinType);
                                break;
                        case 'skintyperaw':
-                               echo Entity::hsc($sType);
+                               echo Entity::hsc($type);
                                break;
                        case 'prefix':
                                echo Entity::hsc($skin->getIncludePrefix());
                                break;
                        case 'mode':
-                               $incMode = $skin->getIncludeMode() ? _PARSER_INCMODE_SKINDIR : _PARSER_INCMODE_NORMAL;
+                               if ( !$skin->getIncludeMode() != 'skindir' )
+                               {
+                                       $incMode = _PARSER_INCMODE_NORMAL;
+                               }
+                               else
+                               {
+                                       $incMode = _PARSER_INCMODE_SKINDIR;
+                               }
                                echo Entity::hsc($incMode);
                                break;
                        default:
@@ -3018,156 +2574,129 @@ class AdminActions extends BaseActions
        /**
         * AdminActions::parse_edittemplateinfo()
         * Parse skinvar edittemplateinfo
-        * 
-        * @param       string  $type                   name of type for skin
-        * @param       string  $description    description for skin
-        * @param       string  $name                   name of skin
-        * @param       string  $help                   
-        * @param       string  $tabindex               index value for tabindex attribute of input element
-        * @param       string  $big                    
-        * @param       string  $tplt                   name of template
-        * @return      boolean 
-        */
-       public function parse_edittemplateinfo($type, $desc = '', $name = '', $help = '', $tabindex = 0, $big = 0, $tplt = '')
+        *
+        * @param       string  $format         format to output
+        * @param       string  $typedesc       type of template
+        * @param       string  $typename       type name of template
+        * @param       string  $help           help text
+        * @param       string  $tabindex       index value for tabindex attribute of input element
+        * @param       string  $big            textarea size
+        * @param       string  $tplt           name of template to be filled
+        * @return      boolean
+        */
+       public function parse_edittemplateinfo($format, $typedesc = '', $typename = '', $help = '', $tabindex = 0, $big = 0, $template_name = '')
        {
                global $manager;
+               static $id = NULL;
+               static $name = NULL;
+               static $desc = NULL;
                
-               $t_id           =  intRequestVar('templateid');
-               $t_name         =  Template::getNameFromId($t_id);
-               $t_desc         =  Template::getDesc($t_id);
-               $template       = &Template::read($t_name);
+               if ( $id == NULL )
+               {
+                       $id = intRequestVar('templateid');
+               }
                
-               switch ( $type )
+               if ( $name == NULL )
+               {
+                       $name = Template::getNameFromId($id);
+               }
+               
+               if ( $desc == NULL )
+               {
+                       $desc = Template::getDesc($id);
+               }
+               
+               $template =& $manager->getTemplate($name);
+               
+               switch ( $format )
                {
                        case 'id':
-                               echo intval($t_id);
+                               echo (integer) $id;
                                break;
                        case 'name':
-                               echo Entity::hsc($t_name);
+                               echo Entity::hsc($name);
                                break;
                        case 'desc':
-                               echo Entity::hsc($t_desc);
+                               echo Entity::hsc($desc);
                                break;
                        case 'extratemplate':
                                $tabidx = 600;
                                $pluginfields = array();
-                               $manager->notify('TemplateExtraFields', array('fields' => &$pluginfields));
-                               
-                               $tmplt = array();
-                               if ( $desc )
-                               {
-                                       $tmplt = Template::read($desc);
-                               }
-                               if ( !array_key_exists('TEMPLATE_EDIT_EXPLUGNAME', $tmplt) || empty($tmplt['TEMPLATE_EDIT_EXPLUGNAME']) )
+                               if ( !in_array($this->skintype, Admin::$adminskin_actions) )
                                {
-                                       $base = "</tr>\n"
-                                             . "<tr>\n"
-                                             . '<th colspan="2"><%explugtplname%>' . "</th>\n";
+                                       $data = array('fields' => &$pluginfields);
+                                       $manager->notify('TemplateExtraFields', $data);
                                }
                                else
                                {
-                                       $base = $tmplt['TEMPLATE_EDIT_EXPLUGNAME'];
+                                       $data = array('fields' => &$pluginfields);
+                                       $manager->notify('AdminTemplateExtraFields', $data);
                                }
                                
-                               foreach ( $pluginfields as $pfkey => $pfvalue )
+                               foreach ( $pluginfields as $ptkey => $ptvalue )
                                {
-                                       $data = array('explugtplname' => Entity::hsc($pfkey));
-                                       
+                                       $tmplt = array();
+                                       if ( $desc )
+                                       {
+                                               $tmplt =& $manager->getTemplate($desc);
+                                       }
+                                               
+                                       /* extra plugin field */
+                                       if ( !array_key_exists('TEMPLATE_EDIT_EXPLUGNAME', $tmplt) || empty($tmplt['TEMPLATE_EDIT_EXPLUGNAME']) )
+                                       {
+                                               $base = "<tr>\n"
+                                                     . "<th colspan=\"2\"><%explugtplname%></th>\n"
+                                                     . "</tr>";
+                                       }
+                                       else
+                                       {
+                                               $base = $tmplt['TEMPLATE_EDIT_EXPLUGNAME'];
+                                       }
+                                       $data = array(
+                                               'explugtplname' => Entity::hsc($ptkey)
+                                       );
                                        echo Template::fill($base, $data);
-                                       
-                                       foreach ( $pfvalue as $pffield => $pfdesc )
+                                               
+                                       foreach ( $ptvalue as $ptname => $ptdesc )
                                        {
-                                               $this->templateEditRow($template, $pfdesc, $pffield, '', ++$tabidx, 0, $name);
+                                               if ( !array_key_exists($ptname, $template) )
+                                               {
+                                                       $content = '';
+                                               }
+                                               else
+                                               {
+                                                       $content = $template[$ptname];
+                                               }
+                                               $tempate_textarea = listplug_templateEditRow($content, $ptdesc, $ptname, $help, $tabidx++, $big, $template_name);
+                                               $this->parser->parse($tempate_textarea);
+                                               continue;
                                        }
                                }
                                break;
                        default:
-                               $desc = defined($desc) ? constant($desc) : $desc;
-                               $name = defined($name) ? constant($name) : $name;
-                               $this->templateEditRow($template, $desc, $name, $help, $tabindex, $big, $tplt);
-                               break;
-               }
-               
-               return;
-       }
-       
-       /**
-        * AdminActions::parse_editadmintemplateinfo()
-        * Parse skinvar editadmintemplateinfo
-        * 
-        * @param       string  $type                   type of skin template
-        * @param       string  $description    description of template
-        * @param       string  $name                   name of stemplate
-        * @param       string  $tabindex               index number for tabindex attribute of input element
-        * @param       string  $big                    
-        * @param       string  $tplt                   
-        */
-       public function parse_editadmintemplateinfo($type, $desc = '', $name = '', $help = '', $tabindex = 0, $big = 0, $tplt = '')
-       {
-               global $manager;
-               
-               $t_id           =  intRequestVar('templateid');
-               $t_name         =  Template::getNameFromId($t_id);
-               $t_desc         =  Template::getDesc($t_id);
-               $template       = &Template::read($t_name);
-               
-               switch ( $type )
-               {
-                       case 'id':
-                               echo intval($t_id);
-                               break;
-                       case 'name':
-                               echo Entity::hsc($t_name);
-                               break;
-                       case 'desc':
-                               echo Entity::hsc($t_desc);
-                               break;
-                       case 'extratemplate':
-                               $tabidx = 600;
-                               $pluginfields = array();
-                               $manager->notify('AdminTemplateExtraFields', array('fields' => &$pluginfields));
+                               $typedesc = defined($typedesc) ? constant($typedesc) : $typedesc;
+                               $typename = defined($typename) ? constant($typename) : $typename;
                                
-                               $tmplt = array();
-                               if ( $desc )
+                               if ( !array_key_exists($typename, $template) )
                                {
-                                       $tmplt = Template::read($desc);
-                               }
-                               if ( !array_key_exists('TEMPLATE_EDIT_EXPLUGNAME', $tmplt) || empty($tmplt['TEMPLATE_EDIT_EXPLUGNAME']) )
-                               {
-                                       $base = "</tr>\n"
-                                             . "<tr>\n"
-                                             . '<th colspan="2"><%explugtplname%>' . "</th>\n";
+                                       $content = '';
                                }
                                else
                                {
-                                       $base = $tmplt['TEMPLATE_EDIT_EXPLUGNAME'];
-                               }
-                               
-                               foreach ( $pluginfields as $pfkey => $pfvalue )
-                               {
-                                       $data = array('explugtplname' => Entity::hsc($pfkey));
-                                       
-                                       echo Template::fill($base, $data);
-                                       
-                                       foreach ( $pfvalue as $pffield => $pfdesc )
-                                       {
-                                               $this->templateEditRow($template, $pfdesc, $pffield, '', ++$tabidx, 0, $name);
-                                       }
+                                       $content = $template[$typename];
                                }
-                               break;
-                       default:
-                               $desc = defined($desc) ? constant($desc) : $desc;
-                               $name = defined($name) ? constant($name) : $name;
-                               $this->templateEditRow($template, $desc, $name, $help, $tabindex, $big, $tplt);
+                               $tempate_textarea = listplug_templateEditRow($content, $typedesc, $typename, $help, $tabindex, $big, $template_name);
+                               $this->parser->parse($tempate_textarea);
                                break;
                }
+               
                return;
        }
        
        /**
         * AdminActions::parse_eventformextra()
         * Parse skinvar eventformextra
-        * 
+        *
         * @param       string  $type   name of type for event form extra
         * @return      void
         */
@@ -3190,7 +2719,7 @@ class AdminActions extends BaseActions
                                {
                                        Admin::error(_ERROR_ACTIVATE);
                                }
-                               $mem  = MEMBER::createFromId($info->vmember);
+                               $mem  =& $manager->getMember($info->vmember);
                                if ( !$mem )
                                {
                                        Admin::error(_ERROR_ACTIVATE);
@@ -3216,15 +2745,14 @@ class AdminActions extends BaseActions
        {
                global $manager;
                
-               $extrahead = Admin::getAdminextrahead();
-               
                $data = array(
-                       'extrahead'     => &$extrahead,
-                       'action'        => Admin::getAdminAction()
+                       'extrahead'     => &Admin::$extrahead,
+                       'action'        => Admin::$action
                );
                
                $manager->notify('AdminPrePageHead', $data);
-               echo $extrahead;
+               
+               $this->parser->parse(Admin::$extrahead);
                return;
        }
        
@@ -3232,7 +2760,7 @@ class AdminActions extends BaseActions
         * AdminActions::parse_member()
         * Parse skinvar member
         * (includes a member info thingie)
-        * 
+        *
         * @param       string  $what   which memberdata is needed
         * @return      void
         */
@@ -3343,20 +2871,22 @@ class AdminActions extends BaseActions
                                break;
                        case 'adminurl':
                                echo $CONF['AdminURL'];
+                               break;
                }
                return;
        }
        
        /**
-        * AdminActions::parse_charset()
-        * Parse skinvar charset
+        * AdminActions::parse_actionurl()
+        * Parse $CONF;
         *
         * @param       void
         * @return      void
         */
-       public function parse_charset()
+       public function parse_actionurl()
        {
-               echo i18n::get_current_charset();
+               global $CONF;
+               echo Entity::hsc($CONF['ActionURL']);
                return;
        }
        
@@ -3366,7 +2896,7 @@ class AdminActions extends BaseActions
         */
        public function parse_getblogsetting($which)
        {
-               global $blog;
+               global $blog, $manager;
                
                if ( $blog )
                {
@@ -3374,14 +2904,13 @@ class AdminActions extends BaseActions
                }
                elseif ( $bid = intRequestVar('blogid') )
                {
-                       global $manager;
-                       $b = $manager->getBlog($bid);
+                       $b =& $manager->getBlog($bid);
                }
                else
                {
                        return;
                }
-               
+       
                switch ( $which )
                {
                        case 'id':
@@ -3418,12 +2947,13 @@ class AdminActions extends BaseActions
        /**
         * AdminActions::parse_geteditpluginfo()
         * Parse skinvar geteditpluginfo
-        * 
+        *
         * @param       string  $type   name of setting for edit plugin info
         * @return      void
         */
        public function parse_geteditpluginfo($type)
        {
+               global $manager;
                $pid = intRequestVar('plugid');
                switch ( $type )
                {
@@ -3431,7 +2961,7 @@ class AdminActions extends BaseActions
                                return $pid;
                                break;
                        case 'name':
-                               return Entity::hsc(getPluginNameFromPid($pid));
+                               return Entity::hsc($manager->getPluginNameFromPid($pid));
                                break;
                }
                return;
@@ -3441,7 +2971,7 @@ class AdminActions extends BaseActions
         * AdminActions::parse_getmember()
         * Parse skinvar getmember
         * (includes a member info thingie)
-        * 
+        *
         * @param       string  $what   name of setting for member
         * @return      void
         */
@@ -3504,7 +3034,7 @@ class AdminActions extends BaseActions
        /**
         * AdminActions::parse_headmessage()
         * Parse skinvar headmessage
-        * 
+        *
         * @param       void
         * @return      void
         */
@@ -3520,7 +3050,7 @@ class AdminActions extends BaseActions
        /**
         * AdminActions::parse_helplink()
         * Parse skinvar helplink
-        * 
+        *
         * @param       string  $topic  name of topic for help
         * @return      void
         */
@@ -3536,21 +3066,21 @@ class AdminActions extends BaseActions
        /**
         * AdminActions::parse_helpplugname()
         * Parse skinvar helpplugname
-        * 
+        *
         * @param       void
         * @return      void
         */
        public function parse_helpplugname()
        {
                $plugid = intGetVar('plugid');
-               Entity::hsc(getPluginNameFromPid($plugid));
+               Entity::hsc($manager->getPluginNameFromPid($plugid));
                return;
        }
        
        /**
         * AdminActions::parse_ilistaddnew()
         * Parse skinvar ilistaddnew
-        * 
+        *
         * @param       void
         * @return      void
         */
@@ -3567,7 +3097,7 @@ class AdminActions extends BaseActions
        /**
         * AdminActions::parse_importskininfo()
         * Parse skinvar importskininfo
-        * 
+        *
         * @param       string  $type   name of information for imported skin
         * @return      void
         */
@@ -3576,90 +3106,74 @@ class AdminActions extends BaseActions
                switch ( $type )
                {
                        case 'info':
-                               echo Entity::hsc(requestVar('skininfo'));
+                               echo Entity::hsc(Admin::$contents['skininfo']);
                                break;
                        case 'snames':
-                               $dataArr = requestArray('skinnames');
+                               $dataArr = Admin::$contents['skinnames'];
                                echo implode(' <em>' . _AND . '</em> ', $dataArr);
                                break;
                        case 'tnames':
-                               $dataArr = requestArray('tpltnames');
+                               $dataArr = Admin::$contents['tpltnames'];
                                echo implode(' <em>' . _AND . '</em> ', $dataArr);
                                break;
                        case 'sclashes':
-                               $dataArr = requestArray('skinclashes');
+                               $dataArr = Admin::$contents['skinclashes'];
                                echo implode(' <em>' . _AND . '</em> ', $dataArr);
                                break;
                        case 'tclashes':
-                               $dataArr = requestArray('tpltclashes');
+                               $dataArr = Admin::$contents['tpltclashes'];
                                echo implode(' <em>' . _AND . '</em> ', $dataArr);
                                break;
                        case 'skinfile':
-                               echo Entity::hsc(requestVar('skinfile'));
+                               echo Entity::hsc(Admin::$contents['skinfile']);
                                break;
                        case 'mode':
-                               echo Entity::hsc(requestVar('mode'));
+                               echo Entity::hsc(Admin::$contents['mode']);
                                break;
                }
                return;
        }
        
        /**
-        * AdminActions::parse_inputyesno()
-        * Parse skinvar inputyesno
-        * 
+        * AdminActions::parse_init()
         * some init stuff for all forms
-        * 
+        *
         * @param       void
         * @return      void
         */
-       function parse_init()
+       public function parse_init()
        {
                global $manager;
                
-               $item = false;
+               $authorid = '';
                if ( requestVar('action') == 'itemedit' )
                {
-                       $itemid = intRequestVar('itemid');
-                       $item =& $manager->getItem($itemid, 1, 1);
-                       
-                       $blog =& $manager->getBlog(getBlogIDFromItemID($itemid));
-                       if ( $item && $blog->convertBreaks() )
-                       {
-                               $item['body'] = removeBreaks($item['body']);
-                               $item['more'] = removeBreaks($item['more']);
-                       }
-                       $contents = $item;
-                       $authorid = $contents['authorid'];
-               }
-               elseif ( requestVar('action') == 'createitem' )
-               {
-                       $blogid = intRequestVar('blogid');
-                       $blog =& $manager->getBlog($blogid);
-                       $authorid = '';
+                       $authorid = Admin::$contents['authorid'];
                }
-               $blog->insertJavaScriptInfo($authorid);
+               
+               Admin::$blog->insertJavaScriptInfo($authorid);
                return;
        }
        
        /**
         * AdminActions::parse_inputyesno()
         * Parse skinvar inputyesno
-        * 
-        * @param       string  $name                   
-        * @param       string  $checkedval             
-        * @param       string  $tabindex               
-        * @param       string  $value1                 
-        * @param       string  $value2                 
-        * @param       string  $yesval                 
-        * @param       string  $noval                  
-        * @param       string  $isAdmin                
-        * @param       string  $templateName   
+        *
+        * @param       string  $name
+        * @param       string  $checkedval
+        * @param       string  $tabindex
+        * @param       string  $value1
+        * @param       string  $value2
+        * @param       string  $yesval
+        * @param       string  $noval
+        * @param       string  $isAdmin
+        * @param       string  $template_name
         * @return      void
         */
-       public function parse_inputyesno($name, $checkedval, $tabindex = 0, $value1 = 1, $value2 = 0, $yesval = _YES, $noval = _NO, $isAdmin = 0, $templateName = '')
+       public function parse_inputyesno($name, $checkedval, $tabindex = 0, $value1 = 1, $value2 = 0, $yesval = _YES, $noval = _NO, $isAdmin = 0, $template_name = '')
        {
-               self::input_yesno($name, $checkedval, $tabindex, $value1, $value2, $yesval, $noval, $isAdmin, $templateName );
+               $input_yesno = listplug_input_yesno($name, $checkedval, $tabindex, $value1, $value2, $yesval, $noval, $isAdmin, $template_name);
+               $this->parser->parse($input_yesno);
                return;
        }
        
@@ -3669,99 +3183,32 @@ class AdminActions extends BaseActions
         */
        public function parse_insertpluginfo($type)
        {
-               $option = Admin::$aOptions;
                switch ( $type )
                {
                        case 'id':
-                               return $option['pid'];
+                               return Admin::$aOptions['pid'];
                                break;
                        case 'name':
-                               return Entity::hsc($option['pfile']);
+                               return Entity::hsc(Admin::$aOptions['pfile']);
                                break;
                }
                return;
        }
        
        /**
-        * AdminActions::parse_insertpluginoptions()
-        * Parse skinvar insertpluginoptions
-        * 
-        * @param       string  $templateName   name of template
-        * @return      void
-        */
-       public function parse_insertpluginoptions($templateName = '')
-       {
-               $options        = Admin::getAdminaOption();
-               $template       = array();
-               $templats       = array();
-               
-               if ( $templateName )
-               {
-                       $templates = Template::read($templateName);
-               }
-               if ( !array_key_exists('INSERT_PLUGOPTION_TITLE', $templates) || empty($templates['INSERT_PLUGOPTION_TITLE']) )
-               {
-                       $template['title'] = "<tr>"
-                                          . "<th colspan=\"2\"><%sprinttext(_PLUGIN_OPTIONS_TITLE, <|%insertpluginfo(name)%|>)%></th>"
-                                          . "</tr>\n";
-               }
-               else
-               {
-                       $template['title'] = $templates['INSERT_PLUGOPTION_TITLE'];
-               }
-               if ( !array_key_exists('INSERT_PLUGOPTION_BODY', $templates) || empty($templates['INSERT_PLUGOPTION_BODY']) )
-               {
-                       $template['body'] = "<tr>"
-                                         . "<%listplugplugoptionrow%>"
-                                         . "</tr>\n";
-               }
-               else
-               {
-                       $template['body'] = $templates['INSERT_PLUGOPTION_BODY'];
-               }
-               
-               $prevPid = -1;
-               
-               include_libs('ACTIONS.php');
-               $handler = new Actions($this->skintype);
-               $parser = new PARSER($handler);
-                       
-               foreach ( $options as $option )
-               {
-                       
-                       // new plugin?
-                       if ( $prevPid != $option['pid'] )
-                       {
-                               $prevPid  = $option['pid'];
-                               $parser->parse($template['title']);
-                       }
-                       
-                       $meta = NucleusPlugin::getOptionMeta($option['typeinfo']);
-                       
-                       if ( @$meta['access'] != 'hidden' )
-                       {
-                               $parsed = $parser->parse($template['body']);
-                       }
-               }
-               return;
-       }
-       
-       /**
         * AdminActions::parse_insplugoptcontent()
         * Parse skinvar insplugoptcontent
-        * 
+        *
         * @param       void
         * @return      void
         */
        public function parse_insplugoptcontent()
        {
-               $option = Admin::$aOption;
-               
-               $meta = NucleusPlugin::getOptionMeta($option['typeinfo']);
+               $meta = NucleusPlugin::getOptionMeta(Admin::$aOptions['typeinfo']);
                if ( array_key_exists('access', $meta) && $meta['access'] != 'hidden' )
                {
                        echo '<tr>';
-                       listplug_plugOptionRow($option);
+                       listplug_plugOptionRow(Admin::$aOptions);
                        echo '</tr>';
                }
                return;
@@ -3770,7 +3217,7 @@ class AdminActions extends BaseActions
        /**
         * AdminActions::parse_iprangeinput()
         * Parse skinvar iprangeinput
-        * 
+        *
         * @param       void
         * @return      void
         */
@@ -3796,51 +3243,38 @@ class AdminActions extends BaseActions
        /**
         * AdminActions::parse_itemnavlist()
         * Parse skinvar itemnavlist
-        * 
-        * @param       void
+        *
+        * @param       string  $template_name  name of template to use
         * @return      void
         */
-       public function parse_itemnavlist()
+       public function parse_itemnavlist($template_name = '')
        {
                global $CONF, $manager, $member;
-               if ( $this->skintype == 'itemlist' )
-               {
-                       $blogid =  intRequestVar('blogid');
-                       $blog   =& $manager->getBlog($blogid);
-               }
-               if ( postVar('start') )
-               {
-                       $start = intPostVar('start');
-               }
-               else
-               {
-                       $start = 0;
-               }
                
-               // amount of items to show
-               if ( postVar('amount') )
-               {
-                       $amount = intPostVar('amount');
-               }
-               else
-               {
-                       $amount = intval($CONF['DefaultListSize']);
-                       if ( $amount < 1 )
-                       {
-                               $amount = 10;
-                       }
-               }
                $query  = "SELECT bshortname, cname, mname, ititle, ibody, inumber, idraft, itime"
-                       . " FROM %s, %s, %s, %s"
-                       . " WHERE iblog=bnumber AND iauthor=mnumber AND icat=catid";
+                     . " FROM %s, %s, %s, %s"
+                     . " WHERE iblog=bnumber AND iauthor=mnumber AND icat=catid";
                
                $query = sprintf($query, sql_table('item'), sql_table('blog'), sql_table('member'), sql_table('category'));
                
                if ( $this->skintype == 'itemlist' )
                {
-                       $query .= ' AND iblog   = ' . $blogid;
+                       $blog = FALSE;
+                       if ( array_key_exists('blogid', $_REQUEST) )
+                       {
+                               $blogid = intRequestVar('blogid');
+                       }
+                       else if ( array_key_exists('itemid', $_REQUEST) )
+                       {
+                               $itemid =  intRequestVar('itemid');
+                               $item   = &$manager->getItem($itemid, 1, 1);
+                               $blogid =  (integer) $item['blogid'];
+                       }
+                       $blog =& $manager->getBlog($blogid);
+                               
+                       $query .= " AND iblog={$blogid}";
                        $template['now'] = $blog->getCorrectTime(time());
-                       
+                               
                        // non-blog-admins can only edit/delete their own items
                        if ( !$member->blogAdminRights($blogid) )
                        {
@@ -3859,79 +3293,84 @@ class AdminActions extends BaseActions
                
                if ( !empty($search) )
                {
-                       $query .= ' AND ((ititle LIKE "%' . sql_real_escape_string($search) . '%") '
-                               . '  OR  (ibody LIKE "%' . sql_real_escape_string($search) . '%") '
-                               . '  OR  (imore LIKE "%' . sql_real_escape_string($search) . '%"))';
+                       $query .= ' AND ((ititle LIKE ' . DB::quoteValue('%'.$search.'%') . ') '
+                       . '  OR  (ibody LIKE ' . DB::quoteValue('%'.$search.'%') . ') '
+                       . '  OR  (imore LIKE ' . DB::quoteValue('%'.$search.'%') . '))';
+               }
+               
+               if ( postVar('start') )
+               {
+                       $start = intPostVar('start');
+               }
+               else
+               {
+                       $start = 0;
+               }
+               
+               // amount of items to show
+               if ( postVar('amount') )
+               {
+                       $amount = intPostVar('amount');
+               }
+               else
+               {
+                       $amount = (integer) $CONF['DefaultListSize'];
+                       if ( $amount < 1 )
+                       {
+                               $amount = 10;
+                       }
                }
+               
                $query .= ' ORDER BY itime DESC'
                        . " LIMIT {$start},{$amount}";
                
-               $template['content'] = 'itemlist';
-               
-               $navList = new Navlist($this->skintype, $start, $amount, 0, 1000, $blogid, $search, 0);
-               $navList->showBatchList('item', $query, 'table', $template);
-               return;
-       }
-       
-       /**
-        * AdminActions::parse_itemoptions()
-        * Parse skinvar itemoptions
-        * Adds the itemOptions of a plugin to a page
-        * @author TeRanEX
-        */
-       function parse_itemoptions()
-       {
-               $this->parse_pluginoptions('item');
+               $resource = DB::getResult($query);
+               if ( $resource->rowCount() > 0 )
+               {
+                       $template['action'] = $this->skintype;
+                       $template['start'] = $start;
+                       $template['amount'] = $amount;
+                       $template['minamount'] = 0;
+                       $template['maxamount'] = 1000;
+                       $template['blogid'] = $blogid;
+                       $template['search'] = $search;
+                       $template['itemid'] = 0;
+                               
+                       $template['content'] = 'itemlist';
+                               
+                       $navlist = listplug_navlist('item', $query, 'table', $template, $template_name);
+                       $this->parser->parse($navlist);
+               }
+               else
+               {
+                       /* TODO: nothing to be shown */
+               }
+               $resource->closeCursor();
+
                return;
        }
        
        /**
-        * AdminActions::parse_itemoptions()
-        * 
+        * AdminActions::parse_itemtime()
         * date change on edit item
-        * 
-        * Parse skinvar itemoptions
-        * Adds the itemOptions of a plugin to a page
-        * @author TeRanEX
+        *
+        * @param       string  $key    key of PHP's getDate()
+        * @return      void
         */
-       function parse_itemtime($what)
+       public function parse_itemtime($key)
        {
                global $manager;
                
-               $item = false;
-               $itemid = intRequestVar('itemid');
-               $item =& $manager->getItem($itemid, 1, 1);
-               
-               $blog   =& $manager->getBlog(getBlogIDFromItemID($itemid));
-               
-               if ( $item && $blog->convertBreaks() && requestVar('action') == 'itemedit' )
-               {
-                       $item['body'] = removeBreaks($item['body']);
-                       $item['more'] = removeBreaks($item['more']);
-               }
-               
-               $contents = array();
-               if ( requestVar('action') == 'itemedit' )
-               {
-                       $contents = $item;
-               } 
-               elseif ( requestVar('action') == 'createitem' )
-               {
-                       $data = array(
-                               'contents' => &$contents,
-                               'blog'     => &$this->blog
-                       );
-                       $manager->notify('PreAddItemForm', $data);
-               }
+               $contents = Admin::$contents;
                $itemtime = getdate($contents['timestamp']);
-               echo $itemtime[$what];
+               echo $itemtime[$key];
                return;
        }
        
        /**
         * AdminActions::parse_jstoolbaroptions()
         * Parse skinvar jstoolbaroptions
-        * 
+        *
         * @param       void
         * @return      void
         */
@@ -3957,19 +3396,20 @@ class AdminActions extends BaseActions
        /**
         * AdminActions::parse_localeselectoptions()
         * Parse skinvar localeselectoptions
-        * 
+        *
         * @param       void
         * @return      void
         */
        public function parse_localeselectoptions()
        {
+               global $CONF, $member;
+               
                $locales = i18n::get_available_locale_list();
                
-               $memid = intRequestVar('memberid');
-               if ( $memid )
+               /* default option */
+               if ( $this->skintype == 'editmembersettings' )
                {
-                       $mem = MEMBER::createFromID($memid);
-                       if ( !$mem->getLocale() || !in_array($mem->getLocale(), $locales) )
+                       if ( !$member->getLocale() )
                        {
                                echo "<option value=\"\" selected=\"selected\">" . Entity::hsc(_MEMBERS_USESITELANG) . "</option>\n";
                        }
@@ -3980,43 +3420,56 @@ class AdminActions extends BaseActions
                }
                else
                {
-                       if ( !i18n::get_current_locale() || !in_array(i18n::get_current_locale(), $locales) )
+                       if ( $CONF['Locale'] == 'en_Latn_US' )
                        {
-                               echo "<option value=\"\" selected=\"selected\">en_Latn_US</option>\n";
+                               echo "<option value=\"\" selected=\"selected\">" . Entity::hsc(_LOCALE_EN_LATN_US) . "</option>\n";
                        }
                        else
                        {
-                               echo "<option value=\"\">en_Latn_US</option>\n";
+                               echo "<option value=\"\">" . Entity::hsc(_LOCALE_EN_LATN_US) . "</option>\n";
                        }
                }
+               
+               /* optional options */
                foreach ( $locales as $locale )
                {
-                       if ( $locale == 'en_Latn_US' )
-                       {
-                               continue;
-                       }
-                       else if ($memid)
+                       if ( $this->skintype == 'editmembersettings' )
                        {
-                               if ( $locale == $mem->getLocale() )
+                               if ( $locale != $member->getLocale() )
                                {
-                                       echo "<option value=\"{$locale}\" selected=\"selected\">{$locale}</option>\n";
+                                       echo "<option value=\"{$locale}\">";
                                }
                                else
                                {
-                                       echo "<option value=\"{$locale}\">{$locale}</option>\n";
+                                       echo "<option value=\"{$locale}\" selected=\"selected\">";
                                }
                        }
                        else
                        {
-                               if ( $locale == i18n::get_current_locale() )
+                               if ( $locale == 'en_Latn_US' )
                                {
-                                       echo "<option value=\"{$locale}\" selected=\"selected\">{$locale}</option>\n";
+                                       /* already output */
+                                       continue;
+                               }
+                               else if ( $locale != $CONF['Locale'] )
+                               {
+                                       echo "<option value=\"{$locale}\">";
                                }
                                else
                                {
-                                       echo "<option value=\"{$locale}\">{$locale}</option>\n";
+                                       echo "<option value=\"{$locale}\" selected=\"selected\">";
                                }
                        }
+                       $label = '_LOCALE_' . strtoupper($locale);
+                       if ( !defined($label) )
+                       {
+                               echo $locale;
+                       }
+                       else
+                       {
+                               echo constant($label);
+                       }
+                       echo "</option>\n";
                }
                return;
        }
@@ -4024,20 +3477,20 @@ class AdminActions extends BaseActions
        /**
         * AdminActions::parse_listplugplugoptionrow()
         * Parse templatevar listplugplugoptionrow
-        * 
-        * @param       string  $templateName   name of template
+        *
+        * @param       string  $template_name  name of template
         * @return      void
         */
-       public function parse_listplugplugoptionrow($templateName = '')
+       public function parse_listplugplugoptionrow($template_name = '')
        {
-               echo listplug_plugOptionRow(Admin::$aOptions, $templateName);
+               echo listplug_plugOptionRow(Admin::$aOptions, $template_name);
                return;
        }
        
        /**
         * AdminActions::parse_mediadirwarning()
         * Parse skinvar mediadirwarning
-        * 
+        *
         * @param       void
         * @return      void
         */
@@ -4069,18 +3522,18 @@ class AdminActions extends BaseActions
                switch ( $actionType )
                {
                        case 'batchitem':
-                               Admin::selectBlogCategory('destcatid');
+                               $this->selectBlog('destcatid', 'category');
                                break;
                        case 'batchcategory':
-                               Admin::selectBlog('destblogid');
+                               $this->selectBlog('destblogid');
                                break;
                        default:
                                if ( $this->skintype == 'itemmove' )
                                {
                                        $query  = "SELECT icat as result FROM %s WHERE inumber=%d;";
                                        $query = sprintf($query, sql_table('item'), intRequestVar('itemid'));
-                                       $catid  = quickQuery(sprintf($query, intRequestVar('itemid')));
-                                       Admin::selectBlogCategory('catid', $catid, 10, 1);
+                                       $catid  = DB::getValue(sprintf($query, intRequestVar('itemid')));
+                                       $this->selectBlog('catid', 'category', $catid, 10, 1);
                                }
                                break;
                }
@@ -4090,7 +3543,7 @@ class AdminActions extends BaseActions
        /**
         * AdminActions::parse_moveitemid()
         * Parse skinvar moveitemid
-        * 
+        *
         * @param       void
         * @return      void
         */
@@ -4103,7 +3556,7 @@ class AdminActions extends BaseActions
        /**
         * AdminActions::parse_newestcompare()
         * Parse skinvar newestcompare
-        * 
+        *
         * @param       void
         * @return      void
         */
@@ -4120,43 +3573,51 @@ class AdminActions extends BaseActions
                        echo '<br /><a style="color:red" href="http://nucleuscms.org/upgrade.php" title="' . _ADMIN_SYSTEMOVERVIEW_LATESTVERSION_TITLE . '">';
                        echo _ADMIN_SYSTEMOVERVIEW_LATESTVERSION_TEXT . $newestVersion . '</a>';
                }
+               else
+               {
+                       echo _ADMIN_SYSTEMOVERVIEW_VERSION_LATEST;
+               }
                return;
        }
        
        /**
         * AdminActions::parse_newmemberselect()
         * Parse skinvar newmemberselect
-        * 
-        * @param       string  $templateName   name of template to use
+        *
+        * @param       string  $template_name  name of template to use
         * @return      void
         */
-       public function parse_newmemberselect($templateName = '')
+       public function parse_newmemberselect($template_name = '')
        {
                $blogid = intRequestVar('blogid');
                
                $query = "SELECT tmember FROM %s WHERE tblog=%d;";
                $query = sprintf($query, sql_table('team'), (integer) $blogid);
-               $res = sql_query($query);
+               $res = DB::getResult($query);
                
                $tmem = array();
-               while ( $tmember = sql_fetch_object($res) ) 
+               foreach ( $res as $row )
                {
-                       $tmem[] = intval($tmember->tmember);
+                       $tmem[] = intval($row['tmember']);
                }
                
                $query  = "SELECT mname as text, mnumber as value FROM %s WHERE mnumber NOT IN (%s);";
                $query = sprintf($query, sql_table('member'), implode(', ', $tmem));
                
-               $template['name']        = 'memberid';
-               $template['tabindex'] = 10000;
-               Showlist($query, 'select', $template, $templateName);
+               $template = array(
+                       'name'          => 'memberid',
+                       'tabindex'      => 10000,
+                       'selected'      => 0
+               );
+               $member_select = showlist($query, 'select', $template, $template_name);
+               $this->parser->parse($member_select);
                return;
        }
        
        /**
         * AdminActions::parse_newpluginlist()
         * Parse skinvar newpluginlist
-        * 
+        *
         * @param       void
         * @return      void
         */
@@ -4173,7 +3634,7 @@ class AdminActions extends BaseActions
        /**
         * AdminActions::parse_outputspecialdirs()
         * Parse skinvar outputspecialdirs
-        * 
+        *
         * @param       string  $type   type of setting for directory
         * @return      void
         */
@@ -4196,19 +3657,19 @@ class AdminActions extends BaseActions
        /**
         * AdminActions::parse_passrequestvars()
         * Parse skinvar passrequestvars
-        * 
+        *
         * @param       void
         * @return      void
         */
        public function parse_passrequestvars()
        {
-               $passvar   = Admin::getAdminpassvar();
+               $passvar   = Admin::$passvar;
                $oldaction = postVar('oldaction');
                
                if ( ($oldaction != 'logout')
-                 && ($oldaction != 'login')
-                 && $passvar
-                 && !postVar('customaction') )
+               && ($oldaction != 'login')
+               && $passvar
+               && !postVar('customaction') )
                {
                        passRequestVars();
                }
@@ -4218,31 +3679,41 @@ class AdminActions extends BaseActions
        /**
         * AdminActions::parse_pluginextras()
         * Parse skinvar pluginextras
-        * 
+        *
         * @param       string  $type   type of plugin context
         * @return      void
         */
        public function parse_pluginextras($type = 'global')
        {
                global $manager;
+               
                switch ( $type )
                {
                        case 'member':
                                $id  = intRequestVar('memberid');
-                               $mem = MEMBER::createFromID($id);
-                               $manager->notify('MemberSettingsFormExtras', array('member' => &$mem));
+                               $mem =& $manager->getMember($id);
+                               $data = array('member' => &$mem);
+                               $manager->notify('MemberSettingsFormExtras', $data);
                                break;
                        case 'blog':
                                $id  = intRequestVar('blogid');
-                               $blg = $manager->getBlog($id);
-                               $manager->notify('BlogSettingsFormExtras', array('member' => &$blg));
+                               $blg =& $manager->getBlog($id);
+                               $data = array('member' => &$blg);
+                               $manager->notify('BlogSettingsFormExtras', $data);
                                break;
-                       default:
-                               $manager->notify(
-                                       'GeneralSettingsFormExtras',
-                                       array(
-                                       )
+                       case 'createaccount':
+                               $data = array(
+                                       'type'          => 'createaccount.php',
+                                       'prelabel'      => '',
+                                       'postlabel'     => '<br />',
+                                       'prefield'      => '',
+                                       'postfield'     => '<br /><br />'
                                );
+                               $manager->notify('RegistrationFormExtraFields', $data);
+                               break;
+                       default:
+                       $data = array();
+                               $manager->notify('GeneralSettingsFormExtras', $data);
                                break;
                }
                return;
@@ -4251,7 +3722,7 @@ class AdminActions extends BaseActions
        /**
         * AdminActions::parse_pluginhelp()
         * Parse skinvar pluginhelp
-        * 
+        *
         * @param       void
         * @return      void
         */
@@ -4260,7 +3731,7 @@ class AdminActions extends BaseActions
                global $manager, $DIR_PLUGINS;
                
                $plugid = intGetVar('plugid');
-               $plugName =  getPluginNameFromPid($plugid);
+               $plugName = $manager->getPluginNameFromPid($plugid);
                $plug =& $manager->getPlugin($plugName);
                
                if ( $plug->supportsFeature('HelpPage') > 0 )
@@ -4285,11 +3756,11 @@ class AdminActions extends BaseActions
        /**
         * AdminActions::parse_pluginlistlist()
         * Parse skinvar pluginlistlist
-        * 
-        * @param       string  $templateName   name of template to use
+        *
+        * @param       string  $template_name  name of template to use
         * @return      void
         */
-       public function parse_pluginlistlist($templateName = '')
+       public function parse_pluginlistlist($template_name = '')
        {
                $query = "SELECT * FROM %s ORDER BY porder ASC;";
                $query = sprintf($query, sql_table('plugin'));
@@ -4297,7 +3768,8 @@ class AdminActions extends BaseActions
                $template['content']  = 'pluginlist';
                $template['tabindex'] = 10;
                
-               Showlist($query, 'table', $template, $templateName);
+               $plugin_list = showlist($query, 'table', $template, $template_name);
+               $this->parser->parse($plugin_list);
                
                return;
        }
@@ -4305,113 +3777,197 @@ class AdminActions extends BaseActions
        /**
         * AdminActions::parse_pluginoptions()
         * Parse skinvar pluginoptions
-        * 
+        *
         * @param       string  $type   type of plugin option
         * @return      void
         */
-       public function parse_pluginoptions($type = 'global')
+       public function parse_pluginoptions($context='global', $template_name='')
        {
-               global $itemid;
+               global $itemid, $manager;
                
-               switch ( $type )
+               switch ( $context )
                {
                        case 'member':
-                               $id = intRequestVar('memberid');
+                               $contextid = intRequestVar('memberid');
                                break;
                        case 'blog':
-                               $id = intRequestVar('blogid');
+                               $contextid = intRequestVar('blogid');
                                break;
                        case 'category':
-                               $id = intRequestVar('catid');
+                               $contextid = intRequestVar('catid');
                                break;
                        case 'item':
-                               $id = $itemid;
+                               $contextid = $itemid;
                                break;
                }
-               Admin::insertPluginOptions($type, $id);
+               
+               /* Actually registererd plugin options */
+               $aIdToValue = array();
+               $query = "SELECT oid, ovalue FROM %s WHERE ocontextid=%d;";
+               $query = sprintf($query, sql_table('plugin_option'), (integer) $contextid);
+               $res = DB::getResult($query);
+               foreach ( $res as $row )
+               {
+                       $aIdToValue[$row['oid']] = $row['ovalue'];
+               }
+               
+               /* Currently available plugin options */
+               $query  = "SELECT * FROM %s, %s WHERE opid=pid and ocontext= %s ORDER BY porder, oid ASC;";
+               $query  = sprintf($query, sql_table('plugin_option_desc'), sql_table('plugin'), DB::quoteValue($context));
+               $res    = DB::getResult($query);
+               
+               $options = array();
+               foreach ($res as $row )
+               {
+                       if ( !array_key_exists($row['oid'], $aIdToValue) )
+                       {
+                               $value = $row['odef'];
+                       }
+                       else
+                       {
+                               $value = $aIdToValue[$row['oid']];
+                       }
+                       
+                       $options[] = array(
+                               'pid'                   => $row['pid'],
+                               'pfile'                 => $row['pfile'],
+                               'oid'                   => $row['oid'],
+                               'value'                 => $value,
+                               'name'                  => $row['oname'],
+                               'description'   => $row['odesc'],
+                               'type'                  => $row['otype'],
+                               'typeinfo'              => $row['oextra'],
+                               'contextid'             => $contextid,
+                               'extra'                 => ''
+                       );
+               }
+               
+               $data = array(
+                       'context'       =>  $context,
+                       'contextid'     =>  $contextid,
+                       'options'       => &$options
+               );
+               $manager->notify('PrePluginOptionsEdit', $data);
+               
+               $template = array();
+               if ( $template_name )
+               {
+                       $templates =& $manager->getTemplate($template_name);
+                       if ( !array_key_exists('INSERT_PLUGOPTION_TITLE', $templates) || empty($templates['INSERT_PLUGOPTION_TITLE']) )
+                       {
+                               $template['title'] = "<tr>"
+                               . "<th colspan=\"2\"><%sprinttext(_PLUGIN_OPTIONS_TITLE, <|%insertpluginfo(name)%|>)%></th>"
+                               . "</tr>\n";
+                       }
+                       else
+                       {
+                               $template['title'] = $templates['INSERT_PLUGOPTION_TITLE'];
+                       }
+                       
+                       if ( !array_key_exists('INSERT_PLUGOPTION_BODY', $templates) || empty($templates['INSERT_PLUGOPTION_BODY']) )
+                       {
+                               $template['body'] = "<tr>"
+                               . "<%listplugplugoptionrow%>"
+                               . "</tr>\n";
+                       }
+                       else
+                       {
+                               $template['body'] = $templates['INSERT_PLUGOPTION_BODY'];
+                       }
+               }
+               
+               $prevPid = -1;
+               
+               foreach ( $options as $option )
+               {
+                       // new plugin?
+                       if ( $prevPid != $option['pid'] )
+                       {
+                               $prevPid  = $option['pid'];
+                               $this->parser->parse($template['title']);
+                       }
+                       
+                       $meta = NucleusPlugin::getOptionMeta($option['typeinfo']);
+                       
+                       if ( @$meta['access'] != 'hidden' )
+                       {
+                               $parsed = $this->parser->parse($template['body']);
+                       }
+               }
+       
                return;
        }
        
        /**
         * AdminActions::parse_qmenuaddselect()
         * Parse skinvar qmanuaddselect
-        * 
-        * @param       string  $templateName   name of template to use
+        *
+        * @param       string  $template_name  name of template to use
         * @return      void
         */
-       public function parse_qmenuaddselect($templateName = '')
+       public function parse_qmenuaddselect($template_name = '')
        {
-               global $member;
+               global $member, $blogid;
                $showAll = requestVar('showall');
                if ( $member->isAdmin() && ($showAll == 'yes') )
                {
                        // Super-Admins have access to all blogs! (no add item support though)
-                       $query =  'SELECT bnumber as value, bname as text'
-                              . ' FROM ' . sql_table('blog')
-                              . ' ORDER BY bname';
+                       $query =  'SELECT bnumber as value, bname as text FROM %s ORDER BY bname;';
+                       $query = sprintf($query, sql_table('blog'));
                }
                else
                {
-                       $query =  'SELECT bnumber as value, bname as text'
-                              . ' FROM ' . sql_table('blog') . ', ' . sql_table('team')
-                              . ' WHERE tblog=bnumber and tmember=' . $member->getID()
-                              . ' ORDER BY bname';
+                       $query =  'SELECT bnumber as value, bname as text FROM %s, %s WHERE tblog=bnumber and tmember=%d ORDER BY bname;';
+                       $query = sprintf($query, sql_table('blog'), sql_table('team'), (integer) $member->getID());
                }
                
                $template['name']               = 'blogid';
                $template['tabindex']   = 15000;
                $template['extra']              = _QMENU_ADD_SELECT;
-               $template['selected']   = -1;
+               $template['selected']   = 0;
                $template['shorten']    = 10;
                $template['shortenel']  = '';
                $template['javascript'] = 'onchange="return form.submit()"';
                
-               Showlist($query, 'select', $template, $templateName);
+               $selectlist = showlist($query, 'select', $template, $template_name);
+               $this->parser->parse($selectlist);
                
                return;
        }
-
+       
        /**
         * AdminActions::parse_quickmenu()
         * Parse skinvar quickmenu
-        * 
-        * @param       string  $templateName   name of template to use
+        *
+        * @param       string  $template_name  name of template to use
         * @return      void
         */
-       public function parse_quickmenu($templateName = '')
+       public function parse_quickmenu($template_name = '')
        {
                global $manager;
                $templates = array();
-               $template  = array();
-               if ( !empty($templateName) )
+               
+               if ( !empty($template_name) )
                {
-                       $templates = Template::read($templateName);
+                       $templates = & $manager->getTemplate($template_name);
                }
                $pluginExtras = array();
-               $manager->notify(
-                       'QuickMenu',
-                       array(
-                               'options' => &$pluginExtras
-                       )
-               );
+               $data = array('options' => &$pluginExtras);
+               $manager->notify('QuickMenu', $data);
+               
+               $template  = array();
                if ( count($pluginExtras) > 0 )
                {
-                       if ( !array_key_exists('PLUGIN_QUICKMENU_TITLE', $templates) || empty($templates['PLUGIN_QUICKMENU_TITLE']) )
-                       {
-                               $template['title'] = "<h2><%text(_QMENU_PLUGINS)%></h2>\n";
-                       }
-                       else
-                       {
-                               $template['title'] = $templates['PLUGIN_QUICKMENU_TITLE'];
-                       }
                        if ( !array_key_exists('PLUGIN_QUICKMENU_HEAD', $templates) || empty($templates['PLUGIN_QUICKMENU_HEAD']) )
                        {
-                               $template['head'] = "<ul>\n";
+                               $template['head'] = "<h2><%text(_QMENU_PLUGINS)%></h2>\n"
+                               . "<ul>\n";
                        }
                        else
                        {
                                $template['head'] = $templates['PLUGIN_QUICKMENU_HEAD'];
                        }
+                       
                        if ( !array_key_exists('PLUGIN_QUICKMENU_BODY', $templates) && empty($templates['PLUGIN_QUICKMENU_BODY']) )
                        {
                                $template['body'] = "<li><a href=\"<%plugadminurl%>\" title=\"<%plugadmintooltip%>\"><%plugadmintitle%></a></li>\n";
@@ -4420,6 +3976,7 @@ class AdminActions extends BaseActions
                        {
                                $template['body'] = $templates['PLUGIN_QUICKMENU_BODY'];
                        }
+                       
                        if ( !array_key_exists('PLUGIN_QUICKMENU_FOOT', $templates) || empty($templates['PLUGIN_QUICKMENU_FOOT']) )
                        {
                                $template['foot'] = "</ul>\n";
@@ -4429,11 +3986,7 @@ class AdminActions extends BaseActions
                                $template['foot'] = $templates['PLUGIN_QUICKMENU_FOOT'];
                        }
                        
-                       $handler = new Actions($this->skintype);
-                       $parser = new PARSER($handler);
-                       
-                       $parser->parse($template['title']);
-                       echo $template['head'];
+                       $this->parser->parse($template['head']);
                        foreach ( $pluginExtras as $aInfo )
                        {
                                $data = array(
@@ -4441,9 +3994,10 @@ class AdminActions extends BaseActions
                                        'plugadmintooltip'      => Entity::hsc($aInfo['tooltip']),
                                        'plugadmintitle'        => Entity::hsc($aInfo['title']),
                                );
-                               echo Template::fill($template['body'], $data);
+                               $body = Template::fill($template['body'], $data);
+                               $this->parser->parse($body);
                        }
-                       echo $template['foot'];
+                       $this->parser->parse($template['foot']);
                }
                return;
        }
@@ -4451,7 +4005,7 @@ class AdminActions extends BaseActions
        /**
         * AdminActions::parse_requestblogid()
         * Parse skinvar requestblogid
-        * 
+        *
         * @param       void
         * @return      void
         */
@@ -4464,7 +4018,7 @@ class AdminActions extends BaseActions
        /**
         * AdminActions::parse_requestiprange()
         * Parse skinvar requestiprange
-        * 
+        *
         * @param       void
         * @return      void
         */
@@ -4482,32 +4036,9 @@ class AdminActions extends BaseActions
        }
        
        /**
-        * AdminActions::parse_selectlocaladminskinfiles()
-        * Parse skinvar selectlocaladminskinfiles
-        * 
-        * @param       void
-        * @return      void
-        */
-       public function parse_selectlocaladminskinfiles()
-       {
-               global $DIR_SKINS, $manager;
-               
-               $adminskindir = $DIR_SKINS . 'admin/';
-               $candidates = SkinImport::searchForCandidates($adminskindir);
-               
-               foreach ( $candidates as $skinname => $skinfile )
-               {
-                       $html = Entity::hsc($skinfile);
-                       echo '<option value="' . $html . '">' . $skinname . "</option>\n";
-               }
-               
-               return;
-       }
-       
-       /**
         * AdminActions::parse_selectlocalskinfiles()
         * Parse skinvar selectlocalskinfiles
-        * 
+        *
         * @param       void
         * @return      void
         */
@@ -4515,26 +4046,47 @@ class AdminActions extends BaseActions
        {
                global $DIR_SKINS;
                
-               $candidates = SkinImport::searchForCandidates($DIR_SKINS);
+               if ( !class_exists('SkinImport', FALSE) )
+               {
+                       include_libs('skinie.php');
+               }
                
-               foreach ( $candidates as $skinname => $skinfile )
+               if ( !in_array($this->skintype, Admin::$adminskin_actions) && $this->skintype != 'importAdmin' )
+               {
+                       $skindir = $DIR_SKINS;
+               }
+               else
                {
-                       $html = Entity::hsc($skinfile);
-                       echo '<option value="' . $html . '">' . $skinname . "</option>\n";
+                       $skindir = "{$DIR_SKINS}admin/";
                }
                
+               $candidates = SkinImport::searchForCandidates($skindir);
+               foreach ( $candidates as $skinname => $skinfile )
+               {
+                       $skinname = Entity::hsc($skinname);
+                       if ( !in_array($this->skintype, Admin::$adminskin_actions) && $this->skintype != 'importAdmin' )
+                       {
+                               $skinfile = Entity::hsc($skinfile);
+                       }
+                       else
+                       {
+                               $skinfile = Entity::hsc("admin/$skinfile");
+                       }
+                       echo "<option value=\"{$skinfile}\">{$skinname}</option>\n";
+               }
+       
                return;
        }
        
        /**
         * AdminActions::parse_skineditallowedlist()
         * Parse skinvar skineditallowedlist
-        * 
+        *
         * @param       string  $type                   type of skin
-        * @param       string  $templateName   name of template
+        * @param       string  $template_name  name of template
         * @return      void
         */
-       public function parse_skineditallowedlist($type, $templateName = '')
+       public function parse_skineditallowedlist($type, $template_name = '')
        {
                switch ( $type )
                {
@@ -4544,72 +4096,98 @@ class AdminActions extends BaseActions
                                        'content' => 'shortblognames'
                                );
                                $query = sprintf($query, sql_table('blog'));
-                               Showlist($query, 'table', $show, $templateName);
                                break;
                        case 'template':
-                               $query = "SELECT tdname as name, tddesc as description FROM %s WHERE tdname NOT LIKE 'admin/%%';";
+                               if ( !in_array($this->skintype, Admin::$adminskin_actions) )
+                               {
+                                       $query = "SELECT tdname as name, tddesc as description FROM %s WHERE tdname NOT LIKE 'admin/%%';";
+                               }
+                               else
+                               {
+                                       $query = "SELECT tdname as name, tddesc as description FROM %s WHERE tdname LIKE 'admin/%%';";
+                               }
                                $show  = array(
                                        'content' => 'shortnames'
                                );
                                $query = sprintf($query, sql_table('template_desc'));
-                               Showlist($query, 'table', $show, $templateName);
                                break;
                }
+               
+               $skin_list = showlist($query, 'table', $show, $template_name);
+               $this->parser->parse($skin_list);
                return;
        }
        
        /**
         * AdminActions::parse_skinielist()
         * Parse skinvar skinielist
-        * 
+        *
         * @param       string  $type                   type of skin
-        * @param       string  $templateName   name of template to use
+        * @param       string  $template_name  name of template to use
         * @return      void
         */
-       public function parse_skinielist($type, $templateName = '')
+       public function parse_skinielist($type, $template_name = '')
        {
+               global $manager;
+               
                $templates = array();
-               if ( $templateName )
-               {
-                       $templates = Template::read($templateName);
-               }
-               if ( array_key_exists('SKINIE_EXPORT_LIST', $templates) && !empty($templates['SKINIE_EXPORT_LIST']) )
+               if ( $template_name )
                {
-                       $template = $templates['SKINIE_EXPORT_LIST'];
+                       $templates =& $manager->getTemplate($template_name);
                }
-               else
+               if ( !array_key_exists('SKINIE_EXPORT_LIST', $templates) || empty($templates['SKINIE_EXPORT_LIST']) )
                {
-                       $template = "<td>"
+                       $template = "<tr>\n"
+                                 . "<td>"
                                  . "<input type=\"checkbox\" name=\"<%typeid%>\" id=\"<%expid%>\" />\n"
                                  . "<label for=\"<%expid%>\"><%expname%></label>\n"
                                  . "</td>\n"
                                  . "<td><%expdesc%></td>\n"
-                                 . "</tr>\n"
-                                 . "<tr>\n";
+                                 . "</tr>\n";
                }
+               else
+               {
+                       $template = $templates['SKINIE_EXPORT_LIST'];
+               }
+               
                switch ( $type )
                {
                        case 'skin':
-                               $res = sql_query('SELECT * FROM ' . sql_table('skin_desc'));
-                               while ( $skinObj = sql_fetch_object($res) )
+                               if ( !in_array($this->skintype, Admin::$adminskin_actions) )
+                               {
+                                       $res = DB::getResult('SELECT * FROM ' . sql_table('skin_desc'). " WHERE sdname NOT LIKE 'admin/%%';");
+                               }
+                               else
+                               {
+                                       $res = DB::getResult('SELECT * FROM ' . sql_table('skin_desc'). " WHERE sdname LIKE 'admin/%%';");
+                               }
+                               foreach ( $res as $row )
                                {
                                        $data = array(
-                                               'typeid'        => 'skin[' . $skinObj->sdnumber . ']',
-                                               'expid'         => 'skinexp' . $skinObj->sdnumber,
-                                               'expname'       => Entity::hsc($skinObj->sdname),
-                                               'expdesc'       => Entity::hsc($skinObj->sddesc),
+                                               'typeid'        => 'skin[' . $row['sdnumber'] . ']',
+                                               'expid'         => 'skinexp' . $row['sdnumber'],
+                                               'expname'       => Entity::hsc($row['sdname']),
+                                               'expdesc'       => Entity::hsc($row['sddesc'])
                                        );
                                        echo Template::fill($template, $data);
                                }
                                break;
                        case 'template':
-                               $res = sql_query('SELECT * FROM '.sql_table('template_desc'). " WHERE tdname NOT LIKE 'admin/%%';");
-                               while ($templateObj = sql_fetch_object($res)) {
+                               if ( !in_array($this->skintype, Admin::$adminskin_actions) )
+                               {
+                                       $res = DB::getResult('SELECT * FROM '.sql_table('template_desc'). " WHERE tdname NOT LIKE 'admin/%%';");
+                               }
+                               else
+                               {
+                                       $res = DB::getResult('SELECT * FROM '.sql_table('template_desc'). " WHERE tdname LIKE 'admin/%%';");
+                               }
+                               foreach ( $res as $row )
+                               {
                                        $data = array(
-                                               'typeid'        => 'template[' . $templateObj->tdnumber . ']',
-                                               'expid'         => 'templateexp' . $templateObj->tdnumber,
-                                               'expname'       => Entity::hsc($templateObj->tdname),
-                                               'expdesc'       => Entity::hsc($templateObj->tddesc),
+                                               'typeid'        => 'template[' . $row['tdnumber'] . ']',
+                                               'expid'         => 'templateexp' . $row['tdnumber'],
+                                               'expname'       => Entity::hsc($row['tdname']),
+                                               'expdesc'       => Entity::hsc($row['tddesc'])
                                        );
                                        echo Template::fill($template, $data);
                                }
@@ -4621,49 +4199,69 @@ class AdminActions extends BaseActions
        /**
         * AdminActions::parse_skinoverview()
         * Parse skinvar skinoverview
-        * 
-        * @param       string  $templateName   name of template to use
+        *
+        * @param       string  $template_name  name of template to use
         * @return      void
         */
-       public function parse_skinoverview($templateName = '')
+       public function parse_skinoverview($template_name = '')
        {
                global $CONF;
-               $query = "SELECT * FROM %s WHERE sdname NOT LIKE 'admin/%%';";
+               
+               $template = array();
+               if ( !in_array($this->skintype, Admin::$adminskin_actions) )
+               {
+                       $query = "SELECT * FROM %s WHERE sdname NOT LIKE 'admin/%%' ORDER BY sdname;";
+                       $template['handler'] = 'Actions';
+                       $template['editaction'] = 'skinedit';
+                       $template['cloneaction'] = 'skinclone';
+                       $template['deleteaction'] = 'skindelete';
+                       $template['edittypeaction'] = 'skinedittype';
+                       $template['default'] = $CONF['BaseSkin'];
+               }
+               else
+               {
+                       $query = "SELECT * FROM %s WHERE sdname LIKE 'admin/%%' ORDER BY sdname;";
+                       $template['handler'] = 'AdminActions';
+                       $template['editaction'] = 'adminskinedit';
+                       $template['cloneaction'] = 'adminskinclone';
+                       $template['deleteaction'] = 'adminskindelete';
+                       $template['edittypeaction'] = 'adminskinedittype';
+                       $template['default'] = $CONF['AdminSkin'];
+               }
                $query = sprintf($query, sql_table('skin_desc'));
                
-               $template['content']  = 'skinlist';
                $template['tabindex'] = 10;
+               $template['content'] = 'skinlist';
+               
+               $skin_list = showlist($query, 'table', $template, $template_name);
+               $this->parser->parse($skin_list);
                
-               Showlist($query, 'table', $template, $templateName);
                return;
        }
        
        /**
         * AdminActions::parse_skintypehelp()
         * Check editing skintypehelp
-        * 
+        *
         * @param       void
         * @return      void
         */
        public function parse_skintypehelp()
        {
-               $nowSkinType = strtolower(trim(requestVar('type')));
-               
-               /* TODO: use Skin class */
-               $regularType = array(
-                       'index',
-                       'item',
-                       'archivelist',
-                       'archive',
-                       'search',
-                       'error',
-                       'member',
-                       'imagepopup'
-               );
+               $surrent_skin_type = strtolower(trim(requestVar('type')));
+               $page_action  = strtolower(trim(requestVar('action')));
+               if ( in_array($page_action, Admin::$adminskin_actions) )
+               {
+                       $normal_types = array_keys(self::$normal_skin_types);
+               }
+               else
+               {
+                       $normal_types = array_keys(Actions::getNormalSkinTypes());
+               }
                
-               if ( in_array($nowSkinType, $regularType) )
+               if ( in_array($surrent_skin_type, $normal_types) )
                {
-                       help('skinpart' . $nowSkinType);
+                       help('skinpart' . $surrent_skin_type);
                }
                else
                {
@@ -4675,87 +4273,67 @@ class AdminActions extends BaseActions
        /**
         * AdminActions::parse_specialskinlist()
         * Parse skinvar specialskinlist
-        * 
-        * @param       string  $templateName   name of template to use
+        *
+        * @param       string  $template_name  name of template to use
         * @return      void
         */
-       public function parse_specialskinlist($templateName = '')
+       public function parse_specialskinlist($template_name = '')
        {
-               $templates = array();
-               if ( $templateName )
-               {
-                       $templates = Template::read($templateName);
-               }
+               global $CONF, $manager;
+               
+               $template = array();
                
-               /* TODO: use Skin class */
-               $nType  = array(
-                       'index',
-                       'item',
-                       'error',
-                       'search',
-                       'archive',
-                       'archivelist',
-                       'imagepopup',
-                       'member'
-               );
                $skinid = intRequestVar('skinid');
-               $query  = "SELECT stype FROM %s WHERE stype NOT IN ('%s') AND sdesc = %d;";
-               $query = sprintf($query, sql_table('skin'), implode("', '", $nType), $skinid);
                
-               $res    = sql_query($query);
-               if ( $res && sql_num_rows($res) > 0 )
+               if ( !in_array($this->skintype, Admin::$adminskin_actions) )
                {
-                       $data = array();
-                       if ( array_key_exists('SPECIALSKINLIST_HEAD', $templates) && !empty($templates['SPECIALSKINLIST_HEAD']) )
-                       {
-                               $template['head'] = $templates['SPECIALSKINLIST_HEAD'];
-                       }
-                       else
-                       {
-                               $template['head'] = "<ul>\n";
-                       }
-                       echo Template::fill($template['head'], $data);
-                       if ( !array_key_exists('SPECIALSKINLIST_BODY', $templates) || empty($templates['SPECIALSKINLIST_BODY']) )
-                       {
-                               $template['body'] = '<li><a tabindex="<%tabindex%>" href="index.php?action=skinedittype&amp;skinid=<%skinid%>'
-                                                                 . '&amp;type=<%skintype%>"><%skintype%></a> (<a tabindex="<%tabindex%>" href="index.php?'
-                                                                 . 'action=skinremovetype&amp;skinid=<%skinid%>&amp;type=<%skintype%>">remove</a>)</li>';
-                       }
-                       else
-                       {
-                               $template['body'] = $templates['SPECIALSKINLIST_BODY'];
-                       }
-                       
-                       $tabstart = 75;
-                       while ( $row = sql_fetch_assoc($res) )
-                       {
-                               $data = array(
-                                       'tabindex'      => $tabstart++,
-                                       'skinid'        => $skinid,
-                                       'skintype'      => Entity::hsc(strtolower($row['stype']))
-                               );
-                               echo Template::fill($template['body'], $data);
-                       }
-                       $data = array();
-                       if (array_key_exists('SPECIALSKINLIST_FOOT', $templates) && !empty($templates['SPECIALSKINLIST_FOOT']) )
-                       {
-                               $template['foot'] = $templates['SPECIALSKINLIST_FOOT'];
-                       }
-                       else
+                       $skin =& $manager->getSkin($skinid);
+                       $template['editaction'] = 'skinedittype';
+                       $template['removeaction'] = 'skinremovetype';
+               }
+               else
+               {
+                       $skin =& $manager->getSkin($skinid, 'AdminActions');
+                       $template['editaction'] = 'adminskinedittype';
+                       $template['removeaction'] = 'adminskinremovetype';
+               }
+               $normal_types = $skin->getNormalTypes();
+               $available_types = $skin->getAvailableTypes();
+               
+               $special_skintypes = array();
+               foreach( $available_types as $skintype => $skinname )
+               {
+                       if ( !array_key_exists($skintype, $normal_types) )
                        {
-                               $template['foot'] = "</ul>\n";
+                               $special_skintypes[] = array(
+                                       'skintype'              => $skintype,
+                                       'skintypename'  => $skinname
+                               );
                        }
-                       echo Template::fill($template['foot'], $data);
-                       return;
                }
+               
+               if ( sizeof($special_skintypes) > 0 )
+               {
+                       $template['tabindex'] = 75;
+                       $template['skinid'] = $skin->getID();
+                       $template['skinname'] = $skin->getName();
+                       $skin_list = showlist($special_skintypes, 'list_specialskinlist', $template, $template_name);
+                       $this->parser->parse($skin_list);
+               }
+               else
+               {
+                       /* TODO: nothing to be shown */
+               }
+       
+               return;
        }
        
        /**
         * AdminActions::parse_sprinttext()
         * Parse sprinttext
-        * 
-        * @param       string  $which  
-        * @param       string  $val    
+        *
+        * @param       string  $which
+        * @param       string  $val
         * @return      void
         */
        public function parse_sprinttext($which, $val)
@@ -4798,14 +4376,14 @@ class AdminActions extends BaseActions
        /**
         * AdminActions::parse_systemsettings()
         * Parse skinvar systemsettings
-        * 
+        *
         * @param       string  $type                   type of settings for system
-        * @param       string  $templateName   name of template to use 
+        * @param       string  $template_name  name of template to use
         * @return      void
         */
-       public function parse_systemsettings($type = 'phpinfo', $templateName = '')
+       public function parse_systemsettings($type = 'phpinfo', $template_name = '')
        {
-               global $member, $CONF, $nucleus;
+               global $manager, $member, $CONF, $nucleus;
                
                $member->isAdmin() or Admin::disallow();
                
@@ -4818,10 +4396,10 @@ class AdminActions extends BaseActions
                                echo phpversion();
                                break;
                        case 'sqlserverinfo':
-                               echo sql_get_server_info();
+                               echo DB::getAttribute(PDO::ATTR_SERVER_VERSION);
                                break;
                        case 'sqlclientinfo':
-                               echo sql_get_client_info();
+                               echo DB::getAttribute(PDO::ATTR_CLIENT_VERSION);
                                break;
                        case 'magicquotesgpc':
                                echo ini_get('magic_quotes_gpc') ? 'On' : 'Off';
@@ -4834,16 +4412,16 @@ class AdminActions extends BaseActions
                                break;
                        case 'gdinfo':
                                $templates = array();
-                               if ( $templateName )
+                               if ( $template_name )
                                {
-                                       $templates = Template::read($templateName);
+                                       $templates =& $manager->getTemplate($template_name);
                                }
                                if ( !array_key_exists('SYSTEMINFO_GDSETTINGS', $templates) || empty($templates['SYSTEMINFO_GDSETTINGS']) )
                                {
                                        $template = "<tr>\n"
-                                                 . "<td><%key%></td>\n"
-                                                 . "<td><%value%></td>\n"
-                                                 . "</tr>\n";
+                                       . "<td><%key%></td>\n"
+                                       . "<td><%value%></td>\n"
+                                       . "</tr>\n";
                                }
                                else
                                {
@@ -4870,11 +4448,25 @@ class AdminActions extends BaseActions
                                }
                                break;
                        case 'modrewrite':
-                               ob_start();
-                               phpinfo(INFO_MODULES);
-                               $im = ob_get_contents();
-                               ob_end_clean();
-                               echo ( i18n::strpos($im, 'mod_rewrite') !== FALSE ) ? $enable : $disable;
+                               if ( function_exists('apache_get_modules') && in_array('mod_rewrite', apache_get_modules()) )
+                               {
+                                       echo $enable;
+                               }
+                               else
+                               {
+                                       ob_start();
+                                       phpinfo(INFO_MODULES);
+                                       $im = ob_get_contents();
+                                       ob_end_clean();
+                                       if ( i18n::strpos($im, 'mod_rewrite') !== FALSE )
+                                       {
+                                               echo $enable;
+                                       }
+                                       else
+                                       {
+                                               echo $disable;
+                                       }
+                               }
                                break;
                        case 'nucleusversion':
                                echo getNucleusVersion() / 100 . '(' . $nucleus['version'] . ')';
@@ -4907,19 +4499,33 @@ class AdminActions extends BaseActions
        /**
         * AdminActions::parse_templateoverview()
         * Parse skinvar templateoverview
-        * 
-        * @param       string  $templateName   name of template to use
+        *
+        * @param       string  $template_name  name of template to use
         * @return      void
         */
-       public function parse_templateoverview($templateName = '')
+       public function parse_templateoverview($template_name = '')
        {
-               $query  = "SELECT * FROM %s WHERE tdname NOT LIKE 'admin/%%' ORDER BY tdname";
+               if ( !in_array($this->skintype, Admin::$adminskin_actions) )
+               {
+                       $query = "SELECT * FROM %s WHERE tdname NOT LIKE 'admin/%%' ORDER BY tdname;";
+                       $template['deleteaction'] = 'templatedelete';
+                       $template['editaction'] = 'templateedit';
+                       $template['cloneaction'] = 'templateclone';
+               }
+               else
+               {
+                       $query = "SELECT * FROM %s WHERE tdname LIKE 'admin/%%' ORDER BY tdname;";
+                       $template['deleteaction'] = 'admintemplatedelete';
+                       $template['editaction'] = 'admintemplateedit';
+                       $template['cloneaction'] = 'admintemplateclone';
+               }
                $query = sprintf($query, sql_table('template_desc'));
                
-               $template['content']  = 'templatelist';
                $template['tabindex'] = 10;
+               $template['content'] = 'templatelist';
                
-               Showlist($query, 'table', $template, $templateName);
+               $template_list = showlist($query, 'table', $template, $template_name);
+               $this->parser->parse($template_list);
                
                return;
        }
@@ -4927,7 +4533,7 @@ class AdminActions extends BaseActions
        /**
         * AdminActions::parse_ticket()
         * Parse ticket
-        * 
+        *
         * @param       void
         * @return      void
         */
@@ -4941,7 +4547,7 @@ class AdminActions extends BaseActions
        /**
         * AdminActions::parse_versioncheckurl()
         * Parse skinvar versioncheckurl
-        * 
+        *
         * @param       void
         * @return      void
         */
@@ -4954,11 +4560,11 @@ class AdminActions extends BaseActions
        /**
         * AdminActions::parse_yrbloglist()
         * Parse skinvar yrbloglist
-        * 
-        * @param       string  $templateName   name of template to use
+        *
+        * @param       string  $template_name  name of template to use
         * @return      void
         */
-       public function parse_yrbloglist($templateName = '')
+       public function parse_yrbloglist($template_name = '')
        {
                global $member;
                $showAll = requestVar('showall');
@@ -4967,56 +4573,64 @@ class AdminActions extends BaseActions
                {
                        // Super-Admins have access to all blogs! (no add item support though)
                        $query =  "SELECT bnumber, bname, 1 as tadmin, burl, bshortname"
-                               . " FROM %s"
-                               . " ORDER BY bnumber;";
+                       . " FROM %s"
+                       . " ORDER BY bnumber;";
                        $query = sprintf($query, sql_table('blog'));
                }
                else
                {
-                       $query =  "SELECT bnumber, bname, tadmin, burl, bshortname"
-                               . " FROM %s,%s"
-                               . " WHERE tblog=bnumber and tmember=%d"
-                               . " ORDER BY bnumber;";
+                       $query = "SELECT bnumber, bname, tadmin, burl, bshortname"
+                       . " FROM %s,%s"
+                       . " WHERE tblog=bnumber and tmember=%d"
+                       . " ORDER BY bnumber;";
                        $query = sprintf($query, sql_table('blog'), sql_table('team'), (integer) $member->getID());
                }
                
-               $template['content']    = 'bloglist';
-               $template['superadmin'] = $member->isAdmin();
-               
-               $amount = Showlist($query, 'table', $template, $templateName);
-               
-               if ( ($showAll != 'yes') && ($member->isAdmin()) )
+               $resource = DB::getResult($query);
+               if ( ($showAll != 'yes') && $member->isAdmin() )
                {
                        $query = 'SELECT COUNT(*) as result FROM ' . sql_table('blog');
-                       
-                       $total = quickQuery($query);
-                       if ( $total > $amount )
+                       $total = DB::getValue($query);
+                               
+                       if ( $total > $resource->rowCount() )
                        {
                                echo '<p><a href="index.php?action=overview&amp;showall=yes">' . _OVERVIEW_SHOWALL . '</a></p>';
                        }
                }
                
-               if ( $amount == 0 )
-               {
-                       echo _OVERVIEW_NOBLOGS;
-               }
-               elseif( $amount != 0 )
+               if ( $resource->rowCount() > 0 )
                {
+                       $template['content']    = 'bloglist';
+                       $template['superadmin'] = $member->isAdmin();
+                               
+                       $list_resource_table = showlist($resource, 'table', $template, $template_name);
+                       $this->parser->parse($list_resource_table);
+                       $resource->closeCursor();
+                               
                        echo '<h2>' . _OVERVIEW_YRDRAFTS . '</h2>';
-                       
-                       $query =  "SELECT ititle, inumber, bshortname"
-                              . " FROM %s,%s"
-                              . ' WHERE iauthor=%d AND iblog=bnumber AND idraft=1;';
+                               
+                       $query = 'SELECT ititle, inumber, bshortname FROM %s, %s '
+                       . 'WHERE iauthor=%d AND iblog=bnumber AND idraft=1;';
                        $query = sprintf($query, sql_table('item'), sql_table('blog'), (integer) $member->getID());
-                       
-                       $template['content'] = 'draftlist';
-                       
-                       $amountdrafts = Showlist($query, 'table', $template, $templateName);
-                       if ( $amountdrafts == 0 )
+                               
+                       $resource = DB::getResult($query);
+                       if ( $resource->rowCount() > 0 )
+                       {
+                               $template['content'] = 'draftlist';
+                               $draft_list = showlist($resource, 'table', $template, $template_name);
+                               $this->parser->parse($draft_list);
+                       }
+                       else
                        {
                                echo _OVERVIEW_NODRAFTS;
                        }
                }
+               else
+               {
+                       echo _OVERVIEW_NOBLOGS;
+               }
+               $resource->closeCursor();
+               
                return;
        }
        
@@ -5031,7 +4645,7 @@ class AdminActions extends BaseActions
         */
        protected function checkCondition($field, $name='', $value = '')
        {
-               global $CONF, $catid, $blog, $member, $itemidnext, $itemidprev, $manager, $archiveprevexists, $archivenextexists;
+               global $CONF, $archiveprevexists, $archivenextexists, $blog, $catid, $itemidnext, $itemidprev, $manager, $member;
                
                $condition = 0;
                switch ( $field )
@@ -5041,20 +4655,17 @@ class AdminActions extends BaseActions
                                {
                                        if ( $blogid )
                                        {
-                                               global $manager;
                                                $blog =& $manager->getBlog($blogid);
                                        }
                                        elseif ( $catid )
                                        {
                                                $blogid = getBlogIDFromCatID($catid);
-                                               global $manager;
                                                $blog =& $manager->getBlog($blogid);
                                        }
                                        elseif ( intRequestVar('catid') )
                                        {
                                                $catid = intRequestVar('catid');
                                                $blogid = getBlogIDFromCatID($catid);
-                                               global $manager;
                                                $blog =& $manager->getBlog($blogid);
                                        }
                                        else
@@ -5064,9 +4675,6 @@ class AdminActions extends BaseActions
                                }
                                $condition = ($blog && $this->ifCategory($name, $value));
                                break;
-                       case 'blogsetting':
-                               $condition = ($blog && ($blog->getSetting($name) == $value));
-                               break;
                        case 'loggedin':
                                $condition = $member->isLoggedIn();
                                break;
@@ -5101,10 +4709,10 @@ class AdminActions extends BaseActions
                                $condition = $this->ifHasPlugin($name, $value);
                                break;
                        case 'adminaction':
-                               $condition = (Admin::getAdminAction() == $name);
+                               $condition = (Admin::$action == $name);
                                break;
                        case 'adminoldaction':
-                               $condition = (Admin::getAdminAction() == $name);
+                               $condition = (Admin::$action == $name);
                                break;
                        case 'addresschange':
                                $condition = ($this->ifAddresscange());
@@ -5116,14 +4724,35 @@ class AdminActions extends BaseActions
                                $condition = ($this->ifSkincandidates());
                                break;
                        case 'nameclashes':
-                               $condition = requestVar('nameclashes');
+                               $condition = Admin::$contents['nameclashes'];
                                break;
                        case 'existsnewplugin':
                                $condition = ($this->existsNewPlugin());
                                break;
                        case 'autosave':
+                               if ( $value == '' )
+                               {
+                                       $value = 1;
+                               }
                                $condition = (boolean) ($member->getAutosave() == $value);
                                break;
+                       case 'blogsetting':
+                               if ( $value == '' )
+                               {
+                                       $value = 1;
+                               }
+                               $condition = (Admin::$blog->getSetting($name) == $value);
+                               break;
+                       case 'itemproperty':
+                               if ( $value == '' )
+                               {
+                                       $value = 1;
+                               }
+                               if ( array_key_exists($name, Admin::$contents) )
+                               {
+                                       $condition = (boolean) (Admin::$contents[$name] == $value);
+                               }
+                               break;
                        default:
                                $condition = $manager->pluginInstalled("NP_{$field}") && $this->ifPlugin($field, $name, $value);
                                break;
@@ -5132,7 +4761,7 @@ class AdminActions extends BaseActions
        }
        
        /**
-        * Actions::_ifHasPlugin()
+        * AdminActions::_ifHasPlugin()
         *      hasplugin,PlugName
         *         -> checks if plugin exists
         *      hasplugin,PlugName,OptionName
@@ -5141,8 +4770,8 @@ class AdminActions extends BaseActions
         *         -> checks if the option OptionName from plugin PlugName is set to value
         *
         * @param       string  $name   name of plugin
-        * @param       string  $value  
-        * @return      
+        * @param       string  $value
+        * @return
         */
        private function ifHasPlugin($name, $value)
        {
@@ -5176,8 +4805,8 @@ class AdminActions extends BaseActions
        }
        
        /**
-        * Actions::beChangePassword()
-        * 
+        * AdminActions::beChangePassword()
+        *
         * @param       void
         * @return      void
         */
@@ -5187,9 +4816,9 @@ class AdminActions extends BaseActions
        }
        
        /**
-        * Actions::ifSkincandidates()
+        * AdminActions::ifSkincandidates()
         * Checks if a plugin exists and call its doIf function
-        * 
+        *
         * @param       void
         * @return      void
         * @return      boolean
@@ -5202,18 +4831,18 @@ class AdminActions extends BaseActions
        }
        
        /**
-        * Actions::ifPlugin()
+        * AdminActions::ifPlugin()
         * Checks if a plugin exists and call its doIf function
-        * 
+        *
         * @param       string  $name   name of plugin
-        * @param       string  $key    
-        * @param       string  $value  
+        * @param       string  $key
+        * @param       string  $value
         * @return      callback
         */
        private function ifPlugin($name, $key = '', $value = '')
        {
                global $manager;
-
+               
                $plugin =& $manager->getPlugin("NP_{$name}");
                if ( !$plugin )
                {
@@ -5225,11 +4854,11 @@ class AdminActions extends BaseActions
                
                return call_user_func_array(array(&$plugin, 'doIf'), $params);
        }
-
+       
        /**
         * AdminActions::ifCategory()
         *  Different checks for a category
-        * 
+        *
         * @param       string  $key    key for information of category
         * @param       string  $value  value for information of category
         * @return      boolean
@@ -5266,7 +4895,7 @@ class AdminActions extends BaseActions
        /**
         * AdminActions::ifOnTeam()
         * Checks if a member is on the team of a blog and return his rights
-        * 
+        *
         * @param       string  $blogName       name of weblog
         * @return      boolean
         */
@@ -5297,7 +4926,7 @@ class AdminActions extends BaseActions
        /**
         * AdminActions::ifAdmin()
         * Checks if a member is admin of a blog
-        * 
+        *
         * @param       string  $blogName       name of weblog
         * @return      boolean
         */
@@ -5322,19 +4951,21 @@ class AdminActions extends BaseActions
                        // use current blog
                        $blogid = $blog->getID();
                }
-               
+       
                return $member->isBlogAdmin($blogid);
        }
        
        /**
         * AdminActions::ifAddresscange()
         * Check e-Mail address is changed
-        * 
+        *
         * @param       void
         * @return      boolean
         */
        private function ifAddresscange()
        {
+               global $manager;
+
                $key = $this->objAdmin->sessionVar("{$CONF['CookiePrefix']}ackey");
                if ( !$key )
                {
@@ -5345,7 +4976,7 @@ class AdminActions extends BaseActions
                {
                        return FALSE;
                }
-               $mem  = MEMBER::createFromId($info->vmember);
+               $mem =& $manager->getMember($info->vmember);
                if ( !$mem )
                {
                        return FALSE;
@@ -5358,116 +4989,47 @@ class AdminActions extends BaseActions
        }
        
        /**
-        * AdminActions::templateEditRow()
-        * Template edit box
-        * 
-        * @param       array   $template       
-        * @param       string  $desc           
-        * @param       string  $name           
-        * @param       string  $help           
-        * @param       integer $tabindex       
-        * @param       boolean $big            
-        * @param       array   $tmplt          
-        * @return      void
-        */
-       private function templateEditRow(&$template, $desc, $name, $help = '', $tabindex = 0, $big = 0, $tplt = '')
-       {
-               static $count = 1;
-               
-               if ( !array_key_exists($name, $template) )
-               {
-                       $template[$name] = '';
-               }
-               
-               $tmplt = array();
-               $base  = array();
-               
-               if ( $tplt )
-               {
-                       $tmplt = skinableTEMPLATE::read($tplt);
-               }
-               
-               $data = array(
-                       'description'   => $desc,
-                       'help'                  => empty($help) ? '' : helpHtml('template' . $help),
-                       'count'                 => $count,
-                       'name'                  => $name,
-                       'tabindex'              => $tabindex,
-                       'rows'                  => $big ? 10 : 5,
-               );
-               
-               if ( !array_key_exists('TEMPLATE_EDIT_ROW_HEAD', $tmplt) || empty($tmplt['TEMPLATE_EDIT_ROW_HEAD']) )
-               {
-                       $base['head'] = "</tr>"
-                                     . "<tr>\n"
-                                     . "<td><%description%><%help%></td>\n"
-                                     . "<td id=\"td<%count%>\">\n"
-                                     . "<textarea class=\"templateedit\" name=\"<%name%>\" tabindex=\"<%tabindex%>\" cols=\"50\" rows=\"<%rows%>\" id=\"textarea<%count%>\">\n";
-               }
-               else
-               {
-                       $base['head'] = $tmplt['TEMPLATE_EDIT_ROW_HEAD'];
-               }
-               
-               if ( !array_key_exists('TEMPLATE_EDIT_ROW_TAIL', $tmplt) || empty($tmplt['TEMPLATE_EDIT_ROW_TAIL']) )
-               {
-                       $base['tail'] = "</textarea>\n"
-                                     . "</td>\n";
-               }
-               else
-               {
-                       $base['tail'] = $tmplt['TEMPLATE_EDIT_ROW_TAIL'];
-               }
-               
-               echo TEMPLATE::fill($base['head'], $data);
-               echo ENTITY::hsc($template[$name]);
-               echo TEMPLATE::fill($base['tail'], $data);
-               
-               $count++;
-               
-               return;
-       }
-       
-       /**
+        * TODO: move
         * AdminActions::customHelp()
         * shows a link to custom help file
-        * 
-        * @param       string  $id                     
-        * @param       string  $tplName        
-        * @param       string  $url            
-        * @param       string  $iconURL        
-        * @param       string  $alt            
-        * @param       string  $title          
+        *
+        * @param       string  $id
+        * @param       string  $tplName
+        * @param       string  $url
+        * @param       string  $iconURL
+        * @param       string  $alt
+        * @param       string  $title
         * @param       $onclick
-        * 
+        *
         */
        private function customHelp($id, $tplName = '', $url = '', $iconURL = '', $alt = '', $title = '', $onclick = '')
        {
-               echo self::customHelpHtml($id, $tplName, $url, $iconURL, $alt, $title, $onclick);
+               echo $this->customHelpHtml($id, $tplName, $url, $iconURL, $alt, $title, $onclick);
        }
        
        /**
+        * TODO: move
         * AdminActions::customHelp()
         * shows a link to custom help file
-        * 
-        * @param       string  $id                     
-        * @param       string  $tplName        
-        * @param       string  $url            
-        * @param       string  $iconURL        
-        * @param       string  $alt            
-        * @param       string  $title          
+        *
+        * @param       string  $id
+        * @param       string  $tplName
+        * @param       string  $url
+        * @param       string  $iconURL
+        * @param       string  $alt
+        * @param       string  $title
         * @param       $onclick
-        * 
+        *
         */
        static function customHelplink($id, $tplName = '', $url = '', $title = '', $onclick = '')
        {
-               global $CONF;
+               global $CONF, $manager;
                
                $templates = array();
                
                if ( $tplName )
                {
-                       $templates = Template::read($tplName);
+                       $templates =& $manager->getTemplate($tplName);
                }
                
                if ( !array_key_exists('ADMIN_CUSTOMHELPLINK_ANCHOR', $templates) || empty($templates['ADMIN_CUSTOMHELPLINK_ANCHOR']) )
@@ -5507,26 +5069,18 @@ class AdminActions extends BaseActions
        }
        
        /**
+        * TODO: move
         * AdminActions::customHelpHtml()
-        * 
-        * @param       string  $id                     
-        * @param       string  $tplName        
-        * @param       string  $url            
-        * @param       string  $iconURL        
-        * @param       string  $alt            
-        * @param       string  $title          
-        * @param       string  $onclick        
-        * @return      string  anchor element with help uri
         */
        private function customHelpHtml($id, $tplName = '', $url = '', $iconURL = '', $alt = '', $title = '', $onclick = '')
        {
-               global $CONF;
+               global $CONF, $manager;
                
                $templates = array();
                
                if ( $tplName )
                {
-                       $templates = Template::read($tplName);
+                       $templates =& $manager->getTemplate($tplName);
                }
                if ( !array_key_exists('ADMIN_CUSTOMHELPLINK_ICON', $templates) || !empty($templates['ADMIN_CUSTOMHELPLINK_ICON']) )
                {
@@ -5558,139 +5112,353 @@ class AdminActions extends BaseActions
                );
                
                $icon = Template::fill($template, $data);
-               $help = self::customHelplink($id, $tplName, $url, $title, $onclick);
+               $help = $this->customHelplink($id, $tplName, $url, $title, $onclick);
                
                return $help . $icon;
        }
        
        /**
-        * AdminActions::input_yesno
-        * 
-        * @param               $name
-        * @param               $checkedval
-        * @param               $tabindex
-        * @param               $value1
-        * @param               $value2
-        * @param               $yesval
-        * @param               $noval
-        * @param               $isAdmin
-        * @param               $templateName
-        * @param               $showlist
-        */
-       private function input_yesno($name,
-                                                               $checkedval,
-                                                               $tabindex        = 0,
-                                                               $value1    = 1,
-                                                               $value2    = 0,
-                                                               $yesval    = _YES,
-                                                               $noval          = _NO,
-                                                               $isAdmin          = 0,
-                                                               $templateName = '',
-                                                               $showlist        = false)
+        * AdminActions::existsNewPlugin()
+        * Check exists new plugin
+        *
+        * @param       void
+        * @return      boolean exists or not
+        */
+       private function existsNewPlugin()
        {
-               $templates = array();
-               if ( $templateName )
-               {
-                       $templates = Template::read($templateName);
-               }
+               global $DIR_PLUGINS;
                
-               if ( $name == 'admin' )
+               $query = "SELECT * FROM %s;";
+               $query = sprintf($query, sql_table('plugin'));
+               $res  = DB::getResult($query);
+               
+               $installed = array();
+               foreach( $res as $row )
                {
-                       if ( !array_key_exists('INPUTYESNO_TEMPLATE_ADMIN', $templates) || empty($templates['INPUTYESNO_TEMPLATE_ADMIN']) )
-                       {
-                               $template = '<input onclick="selectCanLogin(true);" type="radio" name="<%name%>" value="<%yesval%>" <%yescheckedval%> id="<%yesid%>" />' . "\n"
-                                         . '<label for="<%yesid%>"><%yesvaltext%></label>' . "\n"
-                                         . '<input onclick="selectCanLogin(false);" type="radio" name="<%name%>" value="<%noval%>" <%nocheckedval%> id="<%noid%>"<%disabled%> />' . "\n"
-                                         . '<label for="<%noid%>"><%novaltext%></label>' . "\n";
-                       }
-                       else
-                       {
-                               $template = $templates['INPUTYESNO_TEMPLATE_ADMIN'];
-                       }
+                       $installed[] = $row['pfile'];
                }
-               else
+               
+               $files = scandir($DIR_PLUGINS);
+               
+               $candidates = array();
+               foreach ( $files as $file )
                {
-                       if ( array_key_exists('INPUTYESNO_TEMPLATE_NORMAL', $templates) && !empty($templates['INPUTYESNO_TEMPLATE_NORMAL']) )
-                       {
-                               $template = $templates['INPUTYESNO_TEMPLATE_NORMAL'];
-                       }
-                       if ( $showlist )
+                       if ( preg_match("#^(NP_.*)\.php$#", $file, $matches) )
                        {
-                               if ( array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OYESNO', $templates) && !empty($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OYESNO']) )
+                               if ( !in_array($matches[1], $installed) )
                                {
-                                       $template = $templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OYESNO'];
+                                       $candidates[] = preg_replace("#^NP_#", "", $matches[1]);
                                }
                        }
-                       if ( !isset($template) )
-                       {
-                               $template = '<input type="radio" name="<%name%>" value="<%yesval%>" <%yescheckedval%> id="<%yesid%>" />' . "\n"
-                                         . '<label for="<%yesid%>"><%yesvaltext%></label>' . "\n"
-                                         . '<input type="radio" name="<%name%>" value="<%noval%>" <%nocheckedval%> id="<%noid%>"<%disabled%> />' . "\n"
-                                         . '<label for="<%noid%>"><%novaltext%></label>' . "\n";
-                       }
                }
+               $this->newPlugCandidates = $candidates;
+               return (count($candidates) > 0);
+       }
+       
+       /**
+        * AdminActions::pagehead()
+        * Output admin page head
+        *
+        * @param       void
+        * @return      void
+        */
+       public function parse_pagehead()
+       {
+               global $member, $nucleus, $CONF, $manager;
                
-               //echo $template;
-               $id             = Entity::hsc($name);
-               $id             = str_replace('[', '-', $id);
-               $id             = str_replace(']', '-', $id);
-               $id1    = $id . Entity::hsc($value1);
-               $id2    = $id . Entity::hsc($value2);
-               $dat = array(
-                       'name'                  => Entity::hsc($name),
-                       'yesval'                => Entity::hsc($value1),
-                       'noval'                 => Entity::hsc($value2),
-                       'yesid'                 => $id1,
-                       'noid'                  => $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"' : '',
-               );
+               /* HTTP 1.1 application for no caching */
+               header("Cache-Control: no-cache, must-revalidate");
+               header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
                
-               if ( $showlist )
+               $content = $this->parser->skin->getContentFromDB('pagehead');
+               if ( !$content )
                {
-                       return Template::fill($template, $dat);
-               }
-               else
-               {
-                       echo Template::fill($template, $dat);
-               }
+                       $root_element = 'html';
+                       $charset = i18n::get_current_charset();
+                       $locale = preg_replace('#_#', '-', i18n::get_current_locale());
+                       $xml_version_info = '1.0';
+                       $formal_public_identifier = '-//W3C//DTD XHTML 1.0 Strict//EN';
+                       $system_identifier = 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd';
+                       $xhtml_namespace = 'http://www.w3.org/1999/xhtml';
+                       
+                       $content = "<?xml version=\"{$xml_version_info}\" encoding=\"{$charset}\" ?>\n"
+                                 . "<!DOCTYPE {$root_element} PUBLIC \"{$formal_public_identifier}\" \"{$system_identifier}\">\n"
+                                 . "<{$root_element} xmlns=\"{$xhtml_namespace}\" xml:lang=\"{$locale}\" lang=\"{$locale}\">\n"
+                                 . "<head>\n"
+                                 . "<title><%sitevar(name)%> - Admin</title>\n"
+                                 . "<script type=\"text/javascript\" src=\"<%skinfile(/javascripts/edit.js)%>\"></script>"
+                                 . "<script type=\"text/javascript\" src=\"<%skinfile(/javascripts/admin.js)%>\"></script>"
+                                 . "<script type=\"text/javascript\" src=\"<%skinfile(/javascripts/compatibility.js)%>\"></script>"
+                                 . "<%extrahead%>"
+                                 . "</head>"
+                                 . "<body>"
+                                 . "<div id=\"adminwrapper\">"
+                                 . "<div class=\"header\">"
+                                 . "<h1><%sitevar(name)%></h1>"
+                                 . "</div>"
+                                 . "<div id=\"container\">"
+                                 . "<div id=\"content\">"
+                                 . "<div class=\"loginname\">"
+                                 . "<link rel=\"stylesheet\" title=\"Nucleus Admin Default\" type=\"text/css\" href=\"<%skinfile(admin/defaultadmin/styles/addedit.css%>\" />\n"
+                                 . "<script type=\"text/javascript\" src=\"<%skinfile(/javascripts/edit.js)%>\"></script>\n"
+                                 . "<script type=\"text/javascript\" src=\"<%skinfile(/javascripts/admin.js)%>\"></script>\n"
+                                 . "<script type=\"text/javascript\" src=\"<%skinfile(/javascripts/compatibility.js)%>\"></script>\n"
+                                 . "<%extrahead%>\n"
+                                 . "</head>\n"
+                                 . "\n"
+                                 . "<body>\n"
+                                 . "<div id=\"adminwrapper\">\n"
+                                 . "<div class=\"header\">\n"
+                                 . "<h1><%sitevar(name)%></h1>\n"
+                                 . "</div>\n"
+                                 . "<div id=\"container\">\n"
+                                 . "<div id=\"content\">\n"
+                                 . "<div class=\"loginname\">\n"
+                                 . "<%if(loggedin)%>"
+                                 . "<%text(_LOGGEDINAS)%> <%member(yourrealname)%> - <a href=\"<%adminurl%>index.php?action=logout\"><%text(_LOGOUT)%></a><br />"
+                                 . "<a href=\"<%adminurl%>index.php?action=overview\"><%text(_ADMINHOME)%></a> - "
+                                 . "<%else%>"
+                                 . "<a href=\"<%adminurl%>index.php?action=showlogin\" title=\"Log in\"><%text(_NOTLOGGEDIN)%></a><br />"
+                                 . "<%endif%>"
+                                 . "<a href=\"<%sitevar(url)%>\"><%text(_YOURSITE)%></a><br />"
+                                 . "("
+                                 . "<%if(superadmin)%>"
+                                 . "<a href=\"<%versioncheckurl%>\" title=\"<%text(_ADMIN_SYSTEMOVERVIEW_VERSIONCHECK_TITLE)%>\"><%version%><%codename%></a>"
+                                 . "<%newestcompare%><%else%><%version%><%codename%>"
+                                 . "<%endif%>"
+                                 . ")"
+                                 . "</div>";
+               }
+               
+               $this->parser->parse($content);
                return;
        }
        
        /**
-        * AdminActions::existsNewPlugin()
-        * Check exists new plugin
-        * 
+        * AdminActionss::pagefoot()
+        * Output admin page foot include quickmenu
+        *
         * @param       void
-        * @return      boolean exists or not
+        * @return      void
         */
-       private function existsNewPlugin()
+       public function parse_pagefoot()
        {
-               global $DIR_PLUGINS;
+               global $action, $member, $manager, $blogid;
+
+               $data = array('action' => Admin::$action);
+               $manager->notify('AdminPrePageFoot', $data);
+               
+               $content = $this->parser->skin->getContentFromDB('pagefoot');
+               if ( !$content )
+               {
+                       $content = "<%if(loggedin)%>"
+                                . "<%ifnot(adminaction,showlogin)%>"
+                                . "<h2><%text(_LOGOUT)%></h2>"
+                                . "<ul>"
+                                . "<li><a href=\"<%adminurl%>index.php?action=overview\"><%text(_BACKHOME)%></a></li>"
+                                . "<li><a href=\"<%adminurl%>index.php?action=logout\"><%text(_LOGOUT)%></a></li>"
+                                . "</ul>"
+                                . "<%endif%>"
+                                . "<%endif%>"
+                                . "<div class=\"foot\">"
+                                . "<a href=\"<%text(_ADMINPAGEFOOT_OFFICIALURL)%>\">Nucleus CMS</a> &copy; 2002- <%date(%Y)%> <%text(_ADMINPAGEFOOT_COPYRIGHT)%>"
+                                . " - <a href=\"<%text(_ADMINPAGEFOOT_DONATEURL)%>\"><%text(_ADMINPAGEFOOT_DONATE)%></a>"
+                                . "</div>"
+                                . "</div>"
+                                . "<!-- content -->"
+                                . "<div id=\"quickmenu\">"
+                                . "<%if(loggedin)%>"
+                                . "<%ifnot(adminaction,showlogin)%>"
+                                . "<ul>"
+                                . "<li><a href=\"<%adminurl%>index.php?action=overview\"><%text(_QMENU_HOME)%></a></li>"
+                                . "</ul>"
+                                . "<h2><%text(_QMENU_ADD)%></h2>"
+                                . "<form method=\"get\" action=\"<%adminurl%>index.php\">"
+                                . "<div>"
+                                . "<input type=\"hidden\" name=\"action\" value=\"createitem\" />"
+                                . "<%qmenuaddselect(admin/default)%>"
+                                . "</div>"
+                                . "</form>"
+                                . "<h2><%member(yourrealname)%></h2>"
+                                . "<ul>"
+                                . "<li><a href=\"<%adminurl%>index.php?action=editmembersettings\"><%text(_QMENU_USER_SETTINGS)%></a></li>"
+                                . "<li><a href=\"<%adminurl%>index.php?action=browseownitems\"><%text(_QMENU_USER_ITEMS)%></a></li>"
+                                . "<li><a href=\"<%adminurl%>index.php?action=browseowncomments\"><%text(_QMENU_USER_COMMENTS)%></a></li>"
+                                . "</ul>"
+                                . "<%if(superadmin)%>"
+                                . "<h2><%text(_QMENU_MANAGE)%></h2>"
+                                . "<ul>"
+                                . "<li><a href=\"<%adminurl%>index.php?action=actionlog\"><%text(_QMENU_MANAGE_LOG)%></a></li>"
+                                . "<li><a href=\"<%adminurl%>index.php?action=settingsedit\"><%text(_QMENU_MANAGE_SETTINGS)%></a></li>"
+                                . "<li><a href=\"<%adminurl%>index.php?action=systemoverview\"><%text(_QMENU_MANAGE_SYSTEM)%></a></li>"
+                                . "<li><a href=\"<%adminurl%>index.php?action=usermanagement\"><%text(_QMENU_MANAGE_MEMBERS)%></a></li>"
+                                . "<li><a href=\"<%adminurl%>index.php?action=createnewlog\"><%text(_QMENU_MANAGE_NEWBLOG)%></a></li>"
+                                . "<li><a href=\"<%adminurl%>index.php?action=backupoverview\"><%text(_QMENU_MANAGE_BACKUPS)%></a></li>"
+                                . "<li><a href=\"<%adminurl%>index.php?action=pluginlist\"><%text(_QMENU_MANAGE_PLUGINS)%></a></li>"
+                                . "</ul>"
+                                . "<h2><%text(_QMENU_LAYOUT)%></h2>"
+                                . "<ul>"
+                                . "<li><a href=\"<%adminurl%>index.php?action=skinoverview\"><%text(_QMENU_LAYOUT_SKINS)%></a></li>"
+                                . "<li><a href=\"<%adminurl%>index.php?action=templateoverview\"><%text(_QMENU_LAYOUT_TEMPL)%></a></li>"
+                                . "<li><a href=\"<%adminurl%>index.php?action=skinieoverview\"><%text(_QMENU_LAYOUT_IEXPORT)%></a></li>"
+                                . "</ul>"
+                                . "<h2><%text(_SKINABLEADMIN_QMENU_LAYOUT)%></h2>"
+                                . "<ul>"
+                                . "<li><a href=\"<%adminurl%>index.php?action=adminskinoverview\"><%text(_QMENU_LAYOUT_SKINS)%></a></li>"
+                                . "<li><a href=\"<%adminurl%>index.php?action=admintemplateoverview\"><%text(_QMENU_LAYOUT_TEMPL)%></a></li>"
+                                . "<li><a href=\"<%adminurl%>index.php?action=adminskinieoverview\"><%text(_QMENU_LAYOUT_IEXPORT)%></a></li>"
+                                . "</ul>"
+                                . "<%endif%>"
+                                . "<%quickmenu(admin/default)%>"
+                                . "<%endif%>"
+                                . "<%elseif(adminaction,activate)%>"
+                                . "<h2><%text(_QMENU_ACTIVATE)%></h2>"
+                                . "<%text(_QMENU_ACTIVATE_TEXT)%>"
+                                . "<%elseif(adminaction,activatesetpwd)%>"
+                                . "<h2><%text(_QMENU_ACTIVATE)%></h2><%text(_QMENU_ACTIVATE_TEXT)%>"
+                                . "<%else%>"
+                                . "<h2><%text(_QMENU_INTRO)%></h2><%text(_QMENU_INTRO_TEXT)%>"
+                                . "<%endif%>"
+                                . "</div>"
+                                . "<!-- content / quickmenu container -->"
+                                . "<div class=\"clear\"></div>"
+                                . "<!-- new -->"
+                                . "</div>"
+                                . "<!-- adminwrapper -->"
+                                . "<!-- new -->"
+                                . "</div>"
+                                . "<!-- new -->"
+                                . "<p style=\"text-align:right;\"><%benchmark%></p>"
+                                . "</body>"
+                                . "</html>";
+               }
+               
+               $this->parser->parse($content);
+               return;
+       }
+       /**
+        * AdminActions::selectBlog()
+        * Inserts a HTML select element with choices for all blogs to which the user has access
+        *      mode = 'blog' => shows blognames and values are blogids
+        *      mode = 'category' => show category names and values are catids
+        *
+        * @param       string  $name
+        * @param       string  $mode
+        * @param       integer $selected
+        * @param       integer $tabindex
+        * @param       integer $showNewCat
+        * @param       integer $iForcedBlogInclude     ID for weblog always included
+        * @param $iForcedBlogInclude
+        *      ID of a blog that always needs to be included, without checking if the
+        *      member is on the blog team (-1 = none)
+        * @return      void
+        */
+       private function selectBlog($name, $mode='blog', $selected = 0, $tabindex = 0, $showNewCat = 0, $iForcedBlogInclude = -1)
+       {
+               global $member, $CONF;
                
-               $candidates = array();
-               $files = scandir($DIR_PLUGINS);
+               // 0. get IDs of blogs to which member can post items (+ forced blog)
+               $aBlogIds = array();
+               if ( $iForcedBlogInclude != -1 )
+               {
+                       $aBlogIds[] = intval($iForcedBlogInclude);
+               }
                
-               foreach ( $files as $file )
+               if ( $member->isAdmin() && array_key_exists('ShowAllBlogs', $CONF) && $CONF['ShowAllBlogs'] )
+               {
+                       $query =  "SELECT bnumber FROM %s ORDER BY bname;";
+                       $query = sprintf($query, sql_table('blog'));
+               }
+               else
+               {
+                       $query =  "SELECT bnumber FROM %s, %s WHERE tblog=bnumber AND tmember=%d;";
+                       $query = sprintf($query, sql_table('blog'), sql_table('team'), (integer) $member->getID());
+               }
+               
+               $rblogids = DB::getResult($query);
+               foreach ( $rblogids as $row )
+               {
+                       if ( $row['bnumber'] != $iForcedBlogInclude )
+                       {
+                               $aBlogIds[] = intval($row['bnumber']);
+                       }
+               }
+               
+               if ( count($aBlogIds) == 0 )
+               {
+                       return;
+               }
+               
+               echo "<select name=\"{$name}\" tabindex=\"{$tabindex}\">\n";
+               
+               // 1. select blogs (we'll create optiongroups)
+               // (only select those blogs that have the user on the team)
+               $queryBlogs = "SELECT bnumber, bname FROM %s WHERE bnumber in (%s) ORDER BY bname;";
+               $queryBlogs = sprintf($queryBlogs, sql_table('blog'), implode(',', $aBlogIds));
+               $blogs = DB::getResult($queryBlogs);
+               
+               if ( $mode == 'category' )
                {
-                       if ( preg_match("#^NP_(.*)\.php$#", $file, $matches) )
+                       if ( $blogs->rowCount() > 1 )
+                       {
+                               $multipleBlogs = 1;
+                       }
+                       foreach ( $blogs as $rBlog )
                        {
-                               $name = $matches[1];
-                               $query = "SELECT * FROM %s WHERE pfile='%s';";
-                               $query = sprintf($query, sql_table('plugin'), sql_real_escape_string("{NP_{$name}"));
-                               $res  = sql_query($query);
+                               if ( isset($multipleBlogs) && !empty($multipleBlogs) )
+                               {
+                                       echo '<optgroup label="' . Entity::hsc($rBlog['bname']) . "\">\n";
+                               }
+                               
+                               // show selection to create new category when allowed/wanted
+                               if ( $showNewCat )
+                               {
+                                       // check if allowed to do so
+                                       if ( $member->blogAdminRights($rBlog['bnumber']) )
+                                       {
+                                               echo '<option value="newcat-' . $rBlog['bnumber'] . '">' . _ADD_NEWCAT . "</option>\n";
+                                       }
+                               }
+                               
+                               // 2. for each category in that blog
+                               $catQuery = "SELECT cname, catid FROM %s WHERE cblog=%d ORDER BY cname ASC;";
+                               $catQuery = sprintf($catQuery, sql_table('category'), (integer) $rBlog['bnumber']);
+                               $categories = DB::getResult($catQuery);
+                               foreach ( $categories as $rCat )
+                               {
+                                       if ( $rCat['catid'] == $selected )
+                                       {
+                                               $selectText = ' selected="selected" ';
+                                       }
+                                       else
+                                       {
+                                               $selectText = '';
+                                       }
+                                       echo '<option value="' . $rCat['catid'] . '" ' . $selectText . '>' . Entity::hsc($rCat['cname']) . "</option>\n";
+                               }
                                
-                               if ( sql_num_rows($res) == 0 )
+                               if ( isset($multipleBlogs) && !empty($multipleBlogs) )
                                {
-                                       $candidates[] = $name;
+                                       echo '</optgroup>';
                                }
                        }
-                       continue;
                }
-               $this->newPlugCandidates = $candidates;
-               return (count($candidates) > 0);
+               else
+               {
+                       foreach ( $blogs as $rBlog )
+                       {
+                               echo '<option value="' . $rBlog['bnumber'] . '"';
+                               if ( $rBlog['bnumber'] == $selected )
+                               {
+                                       echo '<option value="' . $rBlog['bnumber'] . '" selected="selected">' . Entity::hsc($rBlog['bname']) . "</option>\n";
+                               }
+                               else
+                               {
+                                       echo '<option value="' . $rBlog['bnumber'] . '">' . Entity::hsc($rBlog['bname']) . "</option>\n";
+                               }
+                       }
+               }
+               echo "</select>\n";
+               return;
        }
 }