OSDN Git Service

MERGE: リビジョン1834。globalfunctions.phpの非推奨関数の整理。
[nucleus-jp/nucleus-next.git] / nucleus / libs / AdminActions.php
index 7acedab..be713d3 100644 (file)
 <?php
+if ( !class_exists('BaseActions') )
+{
+       include $DIR_LIBS . 'BaseActions.php';
+}
+
+
 class AdminActions extends BaseActions
 {
-       /*
-        * TODO: I believe we can push them into Admin class
-        * if Admin class is just a static class.
-        */
        private $skintype;
-       private $objAdmin;
        
-       private $actions = array(
+       /* NOTE: list of whole available action names for tags
                'actionloglist',
                'activationmessage',
                'addtickettourl',
+               'adminbanlist',
                'adminbatchaction',
                'adminbatchlist',
-               'adminbanlist',
                'adminbloglink',
                'adminerrormesg',
-               'adminparsedinclude',
                'adminskineditallowedlist',
                'adminskinielist',
                'adminskinoverview',
+               'adminskinselectoptions',
                'adminspecialskinlist',
                'admintemplateoverview',
                'allowedadminskinactions',
                'allowedskinactions',
-               'batchmovetitle',
-               'batchmovetype',
-               'batchmovelist',
-               'batchmovebtn',
+               'banlistdeletedlist',
                'batchdeletelist',
                'batchdeletetype',
+               'batchmovebtn',
+               'batchmovelist',
+               'batchmovetitle',
+               'batchmovetype',
                'blogcatlist',
                'blognotifysetting',
                'blogselectbox',
+               'blogsetting',
                'blogsettingyesno',
                'blogteamlist',
                'blogteammembers',
                'blogtime',
                'bookmarkletadmin',
+               'category',
                'categorysetting',
                'codename',
                'commentnavlist',
                'configsettingsedit',
                'configsettingsyesno',
+               'customhelplink',
                'date',
                'defaultadminskintypes',
                'defblogselect',
                'defcatselect',
                'defskinselect',
                'deletecomment',
-               'deleteitemid',
                'deleteitembody',
+               'deleteitemid',
                'deleteitemtitle',
                'editadminskin',
                'editadminskintype',
                'editadmintemplateinfo',
                'editcomment',
                'editdesturl',
-               'editmemberlist',
                'editmember',
+               'editmemberlist',
+               'editpluginfo',
+               'editplugoptionslist',
                'editskin',
                'editskintype',
                'edittemplateinfo',
-               'editpluginfo',
-               'editplugoptionslist',
-               'extrahead',
                'eventformextra',
+               'extrahead',
                'getblogsetting',
                'geteditpluginfo',
+               'getmember',
                'headmessage',
                'helplink',
                'helpplugname',
                'ilistaddnew',
                'importskininfo',
                'inputyesno',
+               'insertpluginfo',
                'insertpluginoptions',
+               'insplugoptcontent',
                'iprangeinput',
                'itemnavlist',
                'jstoolbaroptions',
-               'languageselectoptions',
                'listplugplugoptionrow',
+               'localeselectoptions',
                'mediadirwarning',
                'movedistselect',
                'moveitemid',
-               'newmemberselect',
                'newestcompare',
+               'newmemberselect',
                'newpluginlist',
                'outputspecialdirs',
                'passrequestvars',
+               'pluginextras',
                'pluginhelp',
                'pluginlistlist',
-               'pluginextras',
                'pluginoptions',
                'qmenuaddselect',
                'quickmenu',
@@ -100,44 +108,670 @@ class AdminActions extends BaseActions
                'selectlocaladminskinfiles',
                'selectlocalskinfiles',
                'skineditallowedlist',
+               'skinfile',
                'skinielist',
                'skinoverview',
                'skintypehelp',
                'specialskinlist',
                'sprinttext',
                'systemsettings',
-               'text',
                'templateoverview',
+               'text',
                'ticket',
                'versioncheckurl',
-               'yrbloglist',
-               'adminstyleselectoptions',
-       /* FIXME: typo of adminstylesheets */
-               'adminstyleseets',
-               'adminskinselectoptions'
-       /* FIXME: lack entries. need to be review
-        * parse_banlistdeletedlist
-        * parse_blogsetting
-        * parse_category
-        * parse_customhelplink
-        * parse_getmember
-        * parse_insertpluginfo
-        * parse_insplugoptcontent
-        * parse_skinfile
+               'yrbloglist'
+       );
+        */
+       
+       /**
+        * AdminActions::$default_actions
+        * list of whole action names with which this class can deal
+        */
+       static private $default_actions = array(
+               'addtickettourl',
+               'adminurl',
+               'codename',
+               'customhelplink',
+               'date',
+               'extrahead',
+               'headmessage',
+               'helplink',
+               'member',
+               'newestcompare',
+               'pagehead',
+               'pagefoot',
+               'qmenuaddselect',
+               'quickmenu',
+               'sitevar',
+               'sprinttext',
+               'ticket',
+               'version',
+               'versioncheckurl'
+       );
+       
+       /**
+        * AdminActions::$skin_type_friendly_names
+        * friendly name for wrapped page types
         */
+       static private $default_skin_types = array(
+               'actionlog'                             => _ADM_SKPRT_ACTIONLOG,
+               'activate'                              => _ADM_SKPRT_ACTIVATE,
+               'activatesetpwd'                => _ADM_SKPRT_ACTIVATESETPWD,
+               'addnewlog'                             => _ADM_SKPRT_ADDNEWLOG,
+               'adminerrorpage'                => _ADM_SKPRT_ADMINERRORPAGE,
+               'adminskindelete'               => _ADM_SKPRT_ADMINSKINDELETE,
+               'adminskinedit'                 => _ADM_SKPRT_ADMINSKINEDIT,
+               'adminskinedittype'             => _ADM_SKPRT_ADMINSKINEDITTYPE,
+               'adminskiniedoimport'   => _ADM_SKPRT_ADMINSKINIEDOIMPORT,
+               'adminskinieimport'             => _ADM_SKPRT_ADMINSKINIEIMPORT,
+               'adminskinieoverview'   => _ADM_SKPRT_ADMINSKINIEOVERVIEW,
+               'adminskinoverview'             => _ADM_SKPRT_ADMINSKINOVERVIEW,
+               'adminskinremovetype'   => _ADM_SKPRT_ADMINSKINREMOVETYPE,
+               'admintemplatedelete'   => _ADM_SKPRT_ADMINTEMPLATEDELETE,
+               'admintemplateedit'             => _ADM_SKPRT_ADMINTEMPLATEEDIT,
+               'admntemplateoverview'  => _ADM_SKPRT_ADMINTEMPLATEOVERVIEW,
+               'backupoverview'                => _ADM_SKPRT_BACKUPOVERVIEW,
+               'backuprestore'                 => _ADM_SKPRT_BACKUPRESTORE,
+               'banlist'                               => _ADM_SKPRT_BANLIST,
+               'banlistdelete'                 => _ADM_SKPRT_BANLISTDELETE,
+               'banlistdeleteconfirm'  => _ADM_SKPRT_BANLISTDELETECONFIRM,
+               'banlistnew'                    => _ADM_SKPRT_BANLISTNEW,
+               'batchcategory'                 => _ADM_SKPRT_BATCHCATEGORY,
+               'batchcomment'                  => _ADM_SKPRT_BATCHCOMMENT,
+               'batchdelete'                   => _ADM_SKPRT_BATCHDELETE,
+               'batchitem'                             => _ADM_SKPRT_BATCHITEM,
+               'batchmember'                   => _ADM_SKPRT_BATCHMEMBER,
+               'batchmove'                             => _ADM_SKPRT_BATCHMOVE,
+               '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,
+               'browseownitems'                => _ADM_SKPRT_BROWSEOWNITEMS,
+               'categorydelete'                => _ADM_SKPRT_CATEGORYDELETE,
+               'categoryedit'                  => _ADM_SKPRT_CATEGORYEDIT,
+               'commentdelete'                 => _ADM_SKPRT_COMMENTDELETE,
+               'commentedit'                   => _ADM_SKPRT_COMMENTEDIT,
+               'createitem'                    => _ADM_SKPRT_CREATEITEM,
+               'createnewlog'                  => _ADM_SKPRT_CREATENEWLOG,
+               'deleteblog'                    => _ADM_SKPRT_DELETEBLOG,
+               'editmembersettings'    => _ADM_SKPRT_EDITMEMBERSETTINGS,
+               'insertpluginoptions'   => _ADM_SKPRT_INSERTPLUGINO,
+               '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,
+               'plugindelete'                  => _ADM_SKPRT_PLUGINDELETE,
+               'pluginhelp'                    => _ADM_SKPRT_PLUGINHELP,
+               'pluginlist'                    => _ADM_SKPRT_PLUGINLIST,
+               'pluginoptions'                 => _ADM_SKPRT_PLUGINOPTIONS,
+               'settingsedit'                  => _ADM_SKPRT_SETTINGSEDIT,
+               'showlogin'                             => _ADM_SKPRT_SHOWLOGIN,
+               'skindelete'                    => _ADM_SKPRT_SKINDELETE,
+               'skinedit'                              => _ADM_SKPRT_SKINEDIT,
+               'skinedittype'                  => _ADM_SKPRT_SKINEDITTYPE,
+               'skiniedoimport'                => _ADM_SKPRT_SKINIEDOIMPORT,
+               'skinieimport'                  => _ADM_SKPRT_SKINIEIMPORT,
+               'skinieoverview'                => _ADM_SKPRT_SKINIEOVERVIEW,
+               'skinoverview'                  => _ADM_SKPRT_SKINOVERVIEW,
+               'skinremovetype'                => _ADM_SKPRT_SKINREMOVETYPE,
+               'systemoverview'                => _ADM_SKPRT_SYSTEMOVERVIEW,
+               'teamdelete'                    => _ADM_SKPRT_TEAMDELETE,
+               'templatedelete'                => _ADM_SKPRT_TEMPLATEDELETE,
+               'templateedit'                  => _ADM_SKPRT_TEMPLATEEDIT,
+               'templateoverview'              => _ADM_SKPRT_TEMPLATEOVERVIEW,
+               'usermanagement'                => _ADM_SKPRT_USERMANAGEMENT,
        );
        
        /**
-        * AdminActions::getDefinedActions()
-        * Returns an array with the actions that are defined
-        * in the AdminActions class
+        * 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()
+        *
+        * @static
         * @param       void
+        * @return      array   list of friendly names for page actions
+        */
+       static public function getDefaultTypes()
+       {
+               return self::$default_skin_types;
+       }
+       
+       /**
+        * AdminActions::__construct()
+        * Constructor for a new Actions object
+        * 
+        * @param       string  $type
         * @return      void
         */
-       public function getDefinedActions()
+       public function __construct($type)
+       {
+               // call constructor of superclass first
+               parent::__construct();
+               $this->skintype = $type;
+               if ( !class_exists('Navlist') || !class_exists('Batch') )
+               {
+                       global $DIR_LIBS;
+                       include $DIR_LIBS . 'ENCAPSULATE.php';
+               }
+               return;
+       }
+       
+       /**
+        * AdminActions::getAvailableActions()
+        * 
+        * @param       void
+        * @return      array   allowed actions for the page type
+        */
+       public function getAvailableActions()
        {
-               return $this->actions;
+               $extra_actions = array();
+               
+               switch ( $this->skintype )
+               {
+                       case 'actionlog':
+                               $extra_actions = array(
+                                       'actionloglist',
+                               );
+                               break;
+                       case 'activate':
+                               $extra_actions = array(
+                                       'activationmessage',
+                                       'eventformextra',
+                               );
+                               break;
+                       case 'activatesetpwd':
+                               $extra_actions = array(
+                               );
+                               break;
+                       case 'addnewlog':
+                               $extra_actions = array(
+                                       'getblogsetting',
+                                       'blogsetting',
+                                       'requestblogid',
+                                       );
+                               break;
+                       case 'adminerrorpage':
+                               $extra_actions = array(
+                               );
+                               break;
+                       case 'adminskindelete':
+                               $extra_actions = array(
+                                       'editadminskintype',
+                               );
+                               break;
+                       case 'adminskinedit':
+                               $extra_actions = array(
+                                       'editadminskin',
+                                       'defaultadminskintypes',
+                                       'adminspecialskinlist',
+                               );
+                               break;
+                       case 'adminskinedittype':
+                               $extra_actions = array(
+                                       'editadminskintype',
+                                       'skintypehelp',
+                                       'allowedadminskinactions',
+                                       'adminskineditallowedlist',
+                               );
+                               break;
+                       case 'adminskiniedoimport':
+                               $extra_actions = array(
+                                       'importskininfo',
+                               );
+                               break;
+                       case 'adminskinieimport':
+                               $extra_actions = array(
+                                       'importskininfo',
+                               );
+                               break;
+                       case 'adminskinieoverview':
+                               $extra_actions = array(
+                                       'selectlocaladminskinfiles',
+                                       'adminskinielist',
+                               );
+                               break;
+                       case 'adminskinoverview':
+                               $extra_actions = array(
+                                       'adminskinoverview',
+                               );
+                               break;
+                       case 'adminskinremovetype':
+                               $extra_actions = array(
+                                       'editadminskintype',
+                               );
+                               break;
+                       case 'admintemplatedelete':
+                               $extra_actions = array(
+                                       'editadmintemplateinfo',
+                               );
+                       case 'admintemplateedit':
+                               $extra_actions = array(
+                                       'editadmintemplateinfo',
+                               );
+                               break;
+                       case 'admntemplateoverview':
+                               $extra_actions = array(
+                                       'admintemplateoverview',
+                               );
+                               break;
+                       case 'backupoverview':
+                               $extra_actions = array(
+                               );
+                               break;
+                       case 'backuprestore':
+                               $extra_actions = array(
+                               );
+                               break;
+                       case 'banlist':
+                               $extra_actions = array(
+                                       'adminbloglink',
+                                       'adminbanlist',
+                                       'requestblogid',
+                               );
+                               break;
+                       case 'banlistdelete':
+                               $extra_actions = array(
+                                       'requestiprange',
+                                       'requestblogid',
+                               );
+                               break;
+                       case 'banlistdeleteconfirm':
+                               $extra_actions = array(
+                                       'banlistdeletedlist',
+                                       'requestblogid',
+                               );
+                               break;
+                       case 'banlistnew':
+                               $extra_actions = array(
+                                       'iprangeinput',
+                                       'requestblogid',
+                                       'blogsetting',
+                               );
+                               break;
+                       case 'batchcategory':
+                               $extra_actions = array(
+                                       'adminbatchaction',
+                                       'adminbatchlist',
+                               );
+                               break;
+                       case 'batchcomment':
+                               $extra_actions = array(
+                                       'adminbatchaction',
+                                       'adminbatchlist',
+                               );
+                               break;
+                       case 'batchdelete':
+                               $extra_actions = array(
+                                       'batchdeletetype',
+                                       'batchdeletelist',
+                               );
+                               break;
+                       case 'batchitem':
+                               $extra_actions = array(
+                                       'adminbatchaction',
+                                       'adminbatchlist',
+                               );
+                               break;
+                       case 'batchmember':
+                               $extra_actions = array(
+                                       'adminbatchaction',
+                                       'adminbatchlist',
+                               );
+                               break;
+                       case 'batchmove':
+                               $extra_actions = array(
+                                       'batchmovetitle',
+                                       'batchmovetype',
+                                       'batchmovelist',
+                                       'movedistselect',
+                                       'batchmovebtn',
+                               );
+                               break;
+                       case 'batchmovecat':
+                               $extra_actions = array(
+                                       'batchmovetitle',
+                                       'batchmovetype',
+                                       'batchmovelist',
+                                       'movedistselect',
+                                       'batchmovebtn',
+                               );
+                               break;
+                       case 'batchteam':
+                               $extra_actions = array(
+                                       'requestblogid',
+                                       'adminbatchaction',
+                                       'adminbatchlist',
+                               );
+                               break;
+                       case 'blogcommentlist':
+                               $extra_actions = array(
+                                       'adminbloglink',
+                                       'commentnavlist',
+                                       'adminbatchlist',
+                               );
+                               break;
+                       case 'blogselectbox':
+                               $extra_actions = array(
+                                       'blogselectbox',
+                               );
+                               break;
+                       case 'blogsettings':
+                               $extra_actions = array(
+                                       'adminbloglink',
+                                       'blogcatlist',
+                                       'blognotifysetting',
+                                       'blogsetting',
+                                       'blogsettingyesno',
+                                       'blogteammembers',
+                                       'blogtime',
+                                       'defcatselect',
+                                       'defskinselect',
+                                       'pluginextras',
+                                       'pluginoptions',
+                                       'requestblogid',
+                               );
+                               break;
+                       case 'bookmarklet':
+                               $extra_actions = array(
+                                       'bookmarkletadmin',
+                               );
+                               break;
+                       case 'browseowncomments':
+                               $extra_actions = array(
+                                       'commentnavlist',
+                               );
+                               break;
+                       case 'browseownitems':
+                               $extra_actions = array(
+                                       'itemnavlist',
+                               );
+                               break;
+                       case 'categorydelete':
+                               $extra_actions = array(
+                                       'categorysetting',
+                                       'requestblogid',
+                               );
+                               break;
+                       case 'categoryedit':
+                               $extra_actions = array(
+                                       'requestblogid',
+                                       'categorysetting',
+                                       'editdesturl',
+                                       'pluginoptions'
+                               );
+                               break;
+                       case 'commentdelete':
+                               $extra_actions = array(
+                                       'deletecomment',
+                               );
+                               break;
+                       case 'commentedit':
+                               $extra_actions = array(
+                                       'editcomment',
+                               );
+                               break;
+                       case 'createitem':
+                               $extra_actions = array(
+                                       'adminbloglink',
+                                       'blogid',
+                                       'contents',
+                                       'categories',
+                                       'currenttime',
+                                       'init',
+                                       'pluginoptions',
+                                       'pluginextras'
+                               );
+                               break;
+                       case 'createnewlog':
+                               $extra_actions = array(
+                                       'defskinselect',
+                                       'blogtime',
+                               );
+                               break;
+                       case 'deleteblog':
+                               $extra_actions = array(
+                                       'blogsetting',
+                                       'requestblogid',
+                               );
+                               break;
+                       case 'editmembersettings':
+                               $extra_actions = array(
+                                       'adminskinselectoptions',
+                                       'editmember',
+                                       'localeselectoptions',
+                                       'pluginoptions',
+                               );
+                               break;
+                       case 'insertpluginoptions':
+                               $extra_actions = array(
+                                       'insertpluginoptions',
+                               );
+                               break;
+                       case 'itemcommentlist':
+                               $extra_actions = array(
+                                       'requestblogid',
+                                       'commentnavlist',
+                               );
+                               break;
+                       case 'itemdelete':
+                               $extra_actions = array(
+                                       'deleteitemtitle',
+                                       'deleteitembody',
+                                       'deleteitemid',
+                               );
+                               break;
+                       case 'itemedit':
+                               $extra_actions = array(
+                                       'init',
+                                       'contents',
+                                       'checkedonval',
+                                       'categories',
+                                       'currenttime',
+                                       'itemtime',
+                                       'pluginoptions',
+                                       'pluginextras'
+                               );
+                               break;
+                       case 'itemlist':
+                               $extra_actions = array(
+                                       'adminbloglink',
+                                       'ilistaddnew',
+                                       'itemnavlist',
+                               );
+                               break;
+                       case 'itemmove':
+                               $extra_actions = array(
+                                       'moveitemid',
+                                       'movedistselect',
+                               );
+                               break;
+                       case 'manage':
+                               $extra_actions = array(
+                               );
+                               break;
+                       case 'manageteam':
+                               $extra_actions = array(
+                                       'requestblogid',
+                                       'blogsetting',
+                                       'blogteamlist',
+                                       'newmemberselect',
+                                       'inputyesno',
+                               );
+                               break;
+                       case 'memberdelete':
+                               $extra_actions = array(
+                                       'editmember',
+                               );
+                               break;
+                       case 'overview':
+                               $extra_actions = array(
+                                       'yrbloglist',
+                               );
+                               break;
+                       case 'plugindelete':
+                               $extra_actions = array(
+                                       'editpluginfo',
+                               );
+                               break;
+                       case 'pluginhelp':
+                               $extra_actions = array(
+                                       'helpplugname',
+                                       'pluginhelp',
+                               );
+                               break;
+                       case 'pluginlist':
+                               $extra_actions = array(
+                                       'pluginlistlist',
+                                       'newpluginlist',
+                               );
+                               break;
+                       case 'pluginoptions':
+                               $extra_actions = array(
+                                       'editpluginfo',
+                                       'editplugoptionslist',
+                               );
+                               break;
+                       case 'settingsedit':
+                               $extra_actions = array(
+                                       'defblogselect',
+                                       'defskinselect',
+                                       'configsettingsedit',
+                                       'configsettingsyesno',
+                                       'outputspecialdirs',
+                                       'jstoolbaroptions',
+                                       'localeselectoptions',
+                                       'mediadirwarning',
+                                       'pluginextras',
+                               );
+                               break;
+                       case 'showlogin':
+                               $extra_actions = array(
+                                       'passrequestvars',
+                               );
+                               break;
+                       case 'skindelete':
+                               $extra_actions = array(
+                                       'editskintype',
+                               );
+                               break;
+                       case 'skinedit':
+                               $extra_actions = array(
+                                       'editskin',
+                                       'specialskinlist',
+                               );
+                               break;
+                       case 'skinedittype':
+                               $extra_actions = array(
+                                       'editskintype',
+                                       'skintypehelp',
+                                       'allowedskinactions',
+                                       'skineditallowedlist',
+                                       'skineditallowedlist',
+                               );
+                               break;
+                       case 'skiniedoimport':
+                               $extra_actions = array(
+                                       'importskininfo',
+                               );
+                               break;
+                       case 'skinieimport':
+                               $extra_actions = array(
+                                       'importskininfo',
+                               );
+                               break;
+                       case 'skinieoverview':
+                               $extra_actions = array(
+                                       'selectlocalskinfiles',
+                                       'skinielist',
+                               );
+                               break;
+                       case 'skinoverview':
+                               $extra_actions = array(
+                                       'skinoverview',
+                               );
+                               break;
+                       case 'skinremovetype':
+                               $extra_actions = array(
+                                       'editskintype',
+                               );
+                               break;
+                       case 'systemoverview':
+                               $extra_actions = array(
+                                       'systemsettings',
+                               );
+                               break;
+                       case 'teamdelete':
+                               $extra_actions = array(
+                                       'editmember',
+                                       'blogsetting',
+                                       'requestblogid',
+                               );
+                               break;
+                       case 'templatedelete':
+                               $extra_actions = array(
+                                       'edittemplateinfo',
+                               );
+                               break;
+                       case 'templateedit':
+                               $extra_actions = array(
+                                       'edittemplateinfo',
+                               );
+                               break;
+                       case 'templateoverview':
+                               $extra_actions = array(
+                                       'templateoverview',
+                               );
+                               break;
+                       case 'usermanagement':
+                               $extra_actions = array(
+                                       'editmemberlist',
+                                       'inputyesno',
+                               );
+                               break;
+                       case 'importAdmin':
+                               $extra_actions = array(
+                                       'charset',
+                                       'sitevar',
+                                       'adminurl',
+                                       'extrahead',
+                                       'member',
+                                       'versioncheckurl',
+                                       'version',
+                                       'codename',
+                                       'newestcompare',
+                                       'selectlocaladminskinfiles',
+                                       'adminskinielist',
+                               );
+                               break;
+                       default:
+                               break;
+               }
+               
+               $defined_actions = array_merge(self::$default_actions, $extra_actions);
+               
+               return array_merge($defined_actions, parent::getAvailableActions());
        }
        
        /**
@@ -153,10 +787,11 @@ class AdminActions extends BaseActions
                $query = sprintf($query, sql_table('actionlog'));       
                
                $template['content'] = 'actionlist';
-               $amount = skinableShowlist($query, 'table', $template, $templateName);
+               $amount = showlist($query, 'table', $template, $templateName);
                return;
        }
        
+       
        /**
         * AdminActions::parse_activationmessage()
         * Parse skinvar activationmessage
@@ -173,25 +808,25 @@ class AdminActions extends BaseActions
                
                if ( !empty($templateName))
                {
-                       $template = skinableTEMPLATE::read($templateName);
+                       $template = Template::read($templateName);
                }
                
                $key = postVar('ackey');
                if ( !$key )
                {
-                       $this->objAdmin->error(_ERROR_ACTIVATE);
+                       Admin::error(_ERROR_ACTIVATE);
                }
                
                $info = MEMBER::getActivationInfo($key);
                if ( !$info )
                {
-                       $this->objAdmin->error(_ERROR_ACTIVATE);
+                       Admin::error(_ERROR_ACTIVATE);
                }
                
                $mem  = MEMBER::createFromId($info->vmember);
                if ( !$mem )
                {
-                       $this->objAdmin->error(_ERROR_ACTIVATE);
+                       Admin::error(_ERROR_ACTIVATE);
                }
                switch ( $info->vtype )
                {
@@ -257,10 +892,10 @@ class AdminActions extends BaseActions
                switch ( $type )
                {
                        case 'title':
-                               echo TEMPLATE::fill($title, $aVars);
+                               echo Template::fill($title, $aVars);
                                break;
                        case 'text':
-                               echo TEMPLATE::fill($text,  $aVars);
+                               echo Template::fill($text,  $aVars);
                                break;
                        case 'ackey':
                                echo Entity::hsc($key);
@@ -270,7 +905,7 @@ class AdminActions extends BaseActions
        }
        
        /**
-        * Actions::parse_addtickettourl()
+        * AdminActions::parse_addtickettourl()
         * Parse skinvar addtickettourl
         * 
         * @param       string  $url    URI for ticket
@@ -285,7 +920,7 @@ class AdminActions extends BaseActions
        }
        
        /**
-        * Actions::parse_adminbanlist()
+        * AdminActions::parse_adminbanlist()
         * Parse skinvar adminbanlist
         * 
         * @param       string  $templateName   name of template to use
@@ -310,7 +945,7 @@ class AdminActions extends BaseActions
        }
        
        /**
-        * Actions::parse_adminbatchaction()
+        * AdminActions::parse_adminbatchaction()
         * Parse skinvar adminbatchaction
         * 
         * @param       void
@@ -323,7 +958,7 @@ class AdminActions extends BaseActions
        }
        
        /**
-        * Actions::parse_adminbatchlist()
+        * AdminActions::parse_adminbatchlist()
         * Parse skinvar adminbatchlist
         * 
         * @param       string  $templateName   name of template to use
@@ -333,24 +968,29 @@ class AdminActions extends BaseActions
        {
                global $manager;
                $templates = array();
+               
                if ( !empty($templateName) )
                {
                        $templates = Template::read($templateName);
                }
-               if ( isset($templates['ADMIN_BATCHLIST']) || !empty($templates['ADMIN_BATCHLIST']) )
+               
+               if ( !array_key_exists('ADMIN_BATCHLIST', $templates) || empty($templates['ADMIN_BATCHLIST']) )
                {
-                       $template = $templates['ADMIN_BATCHLIST'];
+                       $template = '<li><%text(_BATCH_EXECUTING)%>&nbsp;'
+                                 . '<b><%adminbatchaction%></b>&nbsp;'
+                                 . '<%batchlisttype%>&nbsp;'
+                                 . '<b><%batchid%></b>...&nbsp;'
+                                 . '<b><%batchlistmsg%></b>'
+                                 . '</li>' . "\n";
                }
                else
                {
-                       $template = '<li><%text(_BATCH_EXECUTING)%><b><%adminbatchaction%></b>'
-                                         . '<%batchlisttype%> <b><%batchid%></b>...'
-                                         . '<b><%batchlistmsg%></b></li>' . "\n";
+                       $template = $templates['ADMIN_BATCHLIST'];
                }
                
                $selected = requestIntArray('batch');
                $action   = requestVar('batchaction');
-               
+
                switch ( $this->skintype )
                {
                        case 'batchitem':
@@ -391,64 +1031,66 @@ class AdminActions extends BaseActions
                // walk over all selectedids and perform action
                foreach ( $selected as $selectedid )
                {
-                       $error    = '';
+                       $error = '';
                        $selectedid = intval($selectedid);
                        switch ( $action )
                        {
                                case 'delete':
                                        if ( $this->skintype != 'batchteam' )
                                        {
-                                               $error = $this->objAdmin->$deleteaction($selectedid);
+                                               $error = call_user_func_array(array('Admin', $deleteaction), array($selectedid));
                                        }
                                        else
                                        {
-                                               $error  = $this->objAdmin->deleteOneTeamMember($blogid, $selectedid);
+                                               $error  = Admin::deleteOneTeamMember($blogid, $selectedid);
                                        }
                                        break;
                                case 'move':
-                                       $error = $this->objAdmin->$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 ' . $unsetupsql . $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 Actions('template', $template, new ADMIN);
-                       $parser  = new Parser($handler);
                        
+                       $handler = new AdminActions('template');
+                       $parser = new Parser($handler);
+                       
+                       $output = Template::fill($template, $data);
                        ob_start();
-                       $parser->parse($template);
-                       $template = ob_get_contents();
+                       $parser->parse($output);
+                       $output = ob_get_contents();
                        ob_end_clean();
-                       
-                       echo TEMPLATE::fill($template, $data);
-                       return;
+                       echo "{$output}<br />";
                }
+               return;
        }
        
        /**
-        * Actions::parse_adminbloglink()
+        * AdminActions::parse_adminbloglink()
         * Parse skinvar adminbloglink
         * 
         * @param       string  $templateName   name of template to use
@@ -466,13 +1108,13 @@ class AdminActions extends BaseActions
                        $templates = Template::read($templateName);
                }
                
-               if ( isset($templates['ADMIN_BLOGLINK']) || !empty($templates['ADMIN_BLOGLINK']) )
+               if ( !array_key_exists('ADMIN_BLOGLINK', $templates) || empty($templates['ADMIN_BLOGLINK']) )
                {
-                       $template = $templates['ADMIN_BLOGLINK'];
+                       $template = '<a href="<%url%>" title="<%adminbloglinktitle%>"><%blogname%></a>';
                }
                else
                {
-                       $template = '<a href="<%url%>" title="<%adminbloglinktitle%>"><%blogname%></a>';
+                       $template = $templates['ADMIN_BLOGLINK'];
                }
                
                $data = array(
@@ -481,12 +1123,12 @@ class AdminActions extends BaseActions
                        'blogname'                              => Entity::hsc($blog->getName())
                );
                
-               echo TEMPLATE::fill($template, $data);
+               echo Template::fill($template, $data);
                return;
        }
        
        /**
-        * Actions::parse_adminerrormesg()
+        * AdminActions::parse_adminerrormesg()
         * Parse skinvar adminerrormesg
         * 
         * @param       void
@@ -505,70 +1147,25 @@ class AdminActions extends BaseActions
                {
                        $message = cookieVar($CONF['CookiePrefix'] . 'errormessage');
                }
-               elseif ( $this->objAdmin->sessionVar($CONF['CookiePrefix'] . 'errormessage') )
+               elseif ( Admin::sessionVar($CONF['CookiePrefix'] . 'errormessage') )
                {
-                       $message = $this->objAdmin->sessionVar($CONF['CookiePrefix'] . 'errormessage');
+                       $message = Admin::sessionVar($CONF['CookiePrefix'] . 'errormessage');
                }
                echo Entity::hsc($message);
                return;
        }
        
        /**
-        * Actions::parse_adminparsedinclude()
-        * Parse skinvar adminparsedinclude
+        * AdminActions::parse_adminskineditallowedlist()
+        * Parse skinvar adminskineditallowedlist
         * 
-        * @param       string  $filename       name of file
+        * @param       string  $type                   template/blog
+        * @param       string  $templateName   name of template to use
         * @return      void
         */
-       public function parse_adminparsedinclude($filename)
+       public function parse_adminskineditallowedlist($type = 'template', $templateName = '')
        {
-               // check current level
-               if ( $this->level > 3)
-               {
-                       // max. depth reached (avoid endless loop)
-                       return;
-               }
-               $skin = new Skin($this->skin->id);
-               $file = $this->getIncludeFileName($filename);
-               
-               if ( !$skin->isValid && !file_exists($file) )
-               {
-                       return;
-               }
-               
-               $contents = $skin->getContent($filename);
-               
-               if ( !$contents )
-               {
-                       if ( !file_exists($file) )
-                       {
-                               return;
-                       }
-                       $contents = file_get_contents($file);
-                       if ( empty($contents) )
-                       {
-                               return;
-                       }
-               }
-               $this->level = $this->level + 1;
-               // parse file contents
-               $this->parser->parse($contents);
-               
-               $this->level = $this->level - 1;
-               return;
-       }
-       
-       /**
-        * Actions::parse_adminskineditallowedlist()
-        * Parse skinvar adminskineditallowedlist
-        * 
-        * @param       string  $type                   template/blog
-        * @param       string  $templateName   name of template to use
-        * @return      void
-        */
-       public function parse_adminskineditallowedlist($type = 'template', $templateName = '')
-       {
-               switch ( $type )
+               switch ( $type )
                {
                        /* TODO: blog seems not to be used */
                        case 'blog':
@@ -577,21 +1174,22 @@ class AdminActions extends BaseActions
                                $show  = array(
                                        'content' => 'shortblognames'
                                );
+                               Showlist($query, 'table', $show, $templateName);
                                break;
                        case 'template':
-                               $query = "SELECT tdname as name, tddesc as description FROM %s;";
-                               $query = sprintf($query, sql_table('admintemplate_desc'));
+                               $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;
                }
-               Showlist($query, 'table', $show, $templateName);
                return;
        }
        
        /**
-        * Actions::parse_adminskinielist()
+        * AdminActions::parse_adminskinielist()
         * Parse skinvar adminskinielist
         * 
         * @param       string  $type                   skin/template
@@ -605,47 +1203,53 @@ class AdminActions extends BaseActions
                {
                        $templates = Template::read($templateName);
                }
-               if ( isset($templates['SKINIE_EXPORT_LIST']) && !empty($templates['SKINIE_EXPORT_LIST']) )
+               
+               if ( !array_key_exists('SKINIE_EXPORT_LIST', $templates) || empty($templates['SKINIE_EXPORT_LIST']) )
                {
-                       $template = $templates['SKINIE_EXPORT_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";
                }
                else
                {
-                       $template = '<td><input type="checkbox" name="<%typeid%>"  id="<%expid%>" /><label for="<%expid%>"><%expname%></label></td>' . "\n"
-                                         . "<td><%expdesc%></td>\n"
-                                         . "</tr><tr>\n";
+                       $template = $templates['SKINIE_EXPORT_LIST'];
                }
+               
                switch ( $type )
                {
                        case 'skin':
-                               $query = "SELECT * FROM %s;";
-                               $query = sprintf($query, sql_table('adminskin_desc'));
-                               $res = sql_query($query);
+                               $query = "SELECT * FROM %s WHERE sdname LIKE 'admin/%%';";
+                               $query = sprintf($query, sql_table('skin_desc'));
+                               $res = DB::getResult($query);
                                
-                               while ( $skinObj = sql_fetch_object($res) )
+                               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);
+                                       echo Template::fill($template, $data);
                                }
                                break;
                        case 'template':
-                               $query = "SELECT * FROM %s;";
-                               $query = sprintf($query, sql_table('admintemplate_desc'));
-                               $res = sql_query($query);
-                               while ( $templateObj = sql_fetch_object($res) )
+                               $query = "SELECT * FROM %s WHERE tdname LIKE 'admin/%%';";
+                               $query = sprintf($query, sql_table('template_desc'));
+                               $res = DB::getResult($query);
+                               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);
+                                       echo Template::fill($template, $data);
                                }
                                break;
                }
@@ -653,7 +1257,7 @@ class AdminActions extends BaseActions
        }
        
        /**
-        * Actions::parse_adminskinoverview()
+        * AdminActions::parse_adminskinoverview()
         * Parse skinvar adminskinoverview
         * 
         * @param       string  $templateName   name of template to use
@@ -661,37 +1265,38 @@ class AdminActions extends BaseActions
         */
        public function parse_adminskinoverview($templateName = '')
        {
-               $query = "SELECT * FROM %s ORDER BY sdname;";
-               $query = sprintf($query, sql_table('adminskin_desc'));
+               $query = "SELECT * FROM %s WHERE sdname LIKE 'admin/%%' ORDER BY sdname;";
+               $query = sprintf($query, sql_table('skin_desc'));
                
-               $template['content']    = 'adminskinlist';
-               $template['tabindex']   = 10;
+               $template['content'] = 'adminskinlist';
+               $template['tabindex'] = 10;
+               $template['friendly_names'] = $this->parser->skin->getAvailableTypes();
                Showlist($query, 'table', $template, $templateName);
                return;
        }
        
        /**
-        * Actions::parse_adminskinselectoptions()
+        * AdminActions::parse_adminskinselectoptions()
         * Parse skinvar adminskinselectoptions
         * 
         * @param       void
         * @return      void
-        */
-       public function parse_adminskinselectoptions()
+        */     
+       public function parse_adminskinselectoptions($templateName = '')
        {
                global $CONF;
-               $query = "SELECT sdname as text, sdnumber as value FROM %s;";
-               $query = sprintf($query, sql_table('adminskin_desc'));
+               $query = "SELECT sdname as text, sdnumber as value FROM %s WHERE sdname LIKE 'admin/%%';";
+               $query = sprintf($query, sql_table('skin_desc'));
                
-               $template['name']        = 'adminskin';
-               $template['selected'] = $CONF['DefaultAdminSkin'];
+               $template['name'] = 'adminskin';
+               $template['selected'] = $CONF['AdminSkin'];
                $template['tabindex'] = 110;
-               Showlist($query, 'select', $template, '');
+               Showlist($query, 'select', $template, $templateName);
                return;
        }
        
        /**
-        * Actions::parse_adminspecialskinlist()
+        * AdminActions::parse_adminspecialskinlist()
         * Parse skinvar adminspecialskinlist
         * 
         * @param       string  $templateName   name of template to use
@@ -704,128 +1309,70 @@ class AdminActions extends BaseActions
                        $templates = Template::read($templateName);
                }
                
-               $nType  = Skin::getAdminskinDefaultTypes();
+               $nType  = $this->parser->skin->getAvailableTypes();
                $skinid = intRequestVar('skinid');
                
                $query = "SELECT stype FROM  %s WHERE stype NOT IN (%s) AND sdesc=%d;";
-               $query = sprintf($query, sql_table('adminskin'), "'" . implode("', '", $nType) . "'", (integer) $skinid);
+               $query = sprintf($query, sql_table('skin'), "'" . implode("', '", $nType) . "'", (integer) $skinid);
                
-               $res    = sql_query($query);
-               if ( $res && sql_num_rows($res) > 0 )
+               $res    = DB::getResult($query);
+               if ( $res && $res->rowCount() > 0 )
                {
-                       $data = array();
-                       if ( isset($templates['ADMIN_SPECIALSKINLIST_HEAD']) && !empty($templates['ADMIN_SPECIALSKINLIST_HEAD']) )
+                       /* NOTE: set templates for HEAD/BODY/FOOT */
+                       if ( !array_key_exists('ADMIN_SPECIALSKINLIST_HEAD', $templates) || empty($templates['ADMIN_SPECIALSKINLIST_HEAD']) )
                        {
-                               $template['head'] = $templates['ADMIN_SPECIALSKINLIST_HEAD'];
+                               $template['head'] = "<ul>\n";
                        }
                        else
                        {
-                               $template['head'] = "<ul>\n";
+                               $template['head'] = $templates['ADMIN_SPECIALSKINLIST_HEAD'];
                        }
-                       echo TEMPLATE::fill($template['head'], $data);
-                       if ( isset($templates['ADMIN_SPECIALSKINLIST_BODY']) && !empty($templates['ADMIN_SPECIALSKINLIST_BODY']) )
+                       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['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>';
+                               $template['foot'] = $templates['ADMIN_SPECIALSKINLIST_FOOT'];
                        }
+                       
                        $tabstart = 120;
-                       while ( $row = sql_fetch_assoc($res) )
+                       
+                       /* NOTE: do echo */
+                       $data = array();
+                       echo $template['head'];
+                       foreach ( $res as $row )
                        {
                                $data = array(
                                        'tabindex'      => $tabstart++,
                                        'skinid'        => $skinid,
                                        'skintype'      => Entity::hsc(strtolower($row['stype']))
                                );
-                               echo TEMPLATE::fill($template['body'], $data);
+                               echo Template::fill($template['body'], $data);
                        }
-                       
                        $data = array();
-                       if ( isset($templates['ADMIN_SPECIALSKINLIST_FOOT']) && !empty($templates['ADMIN_SPECIALSKINLIST_FOOT']) )
-                       {
-                               $template['foot'] = $templates['ADMIN_SPECIALSKINLIST_FOOT'];
-                       }
-                       else
-                       {
-                               $template['foot'] = "<ul>\n";
-                       }
-                       echo TEMPLATE::fill($template['foot'], $data);
-                       return;
-               }
-       }
-       
-       /**
-        * Actions::parse_adminstylesheets()
-        * Parse skinvar adminstylesheets
-        * 
-        * @param       void
-        * @return      void
-        */
-       public function parse_adminstylesheets()
-       {
-               global $CONF;
-               $includePrefix = $this->skin->includePrefix;
-               
-               if ( strlen($includePrefix) > 0 )
-               {
-                       $styleURL = Entity::hsc($CONF['AdminURL']) . 'adminskins/' . $includePrefix . 'admin_' . $CONF['AdminCSS'] . '.css';
-               }
-               else
-               {
-                       $styleURL = Entity::hsc($CONF['AdminURL']) . 'styles/admin_' . $CONF['AdminCSS'] . '.css';
-               }
-               echo $styleURL;
-               return;
-       }
-       
-       /**
-        * Actions::parse_adminstyleselectoptions()
-        * Parse skinvar adminstyleselectoptions
-        * 
-        * @param       void
-        * @return      void
-        */
-       public function parse_adminstyleselectoptions()
-       {
-               global $CONF, $manager, $DIR_NUCLEUS;
-               if ( strlen($this->skin->includePrefix) > 0 )
-               {
-                       $scndir = $DIR_NUCLEUS . 'adminskins/' . $this->skin->includePrefix;
-               }
-               else
-               {
-                       $scndir = $DIR_NUCLEUS . 'styles/';
-               }
-               $files = scandir($scndir);
-               
-               foreach ( $files as $file )
-               {
-                       if ( !preg_match("#^admin_(.*)\.css$#", $file, $matches) )
-                       {
-                               continue;
-                       }
-                       
-                       $name = $matches[1];
-                       $opts = '<option value="' . $name . '"';
-                       if ( $name != $CONF['AdminCSS'] )
-                       {
-                               $opts .= "<option value=\"{$name}\">{$name}</option>\n";
-                       }
-                       else
-                       {
-                               $opts .= "<option value=\"{$name}\" selected=\"selected\">{$name}</option>\n";
-                       }
-                       echo $opts;
+                       echo $template['foot'];
                }
                return;
        }
        
        /**
-        * Actions::parse_admintemplateoverview()
+        * AdminActions::parse_admintemplateoverview()
         * Parse skinvar admintemplateoverview
         * 
         * @param       string  $templateName   name of template to use
@@ -833,10 +1380,10 @@ class AdminActions extends BaseActions
         */
        public function parse_admintemplateoverview($templateName = '')
        {
-               $query  = "SELECT * FROM %s ORDER BY tdname;";
-               $query = sprintf($query, sql_table('admintemplate_desc'));
+               $query = "SELECT * FROM %s WHERE tdname LIKE 'admin/%%' ORDER BY tdname;";
+               $query = sprintf($query, sql_table('template_desc'));
                
-               $template['content']  = 'admintemplatelist';
+               $template['content'] = 'admintemplatelist';
                $template['tabindex'] = 10;
                
                Showlist($query, 'table', $template, $templateName);
@@ -844,7 +1391,7 @@ class AdminActions extends BaseActions
        }
        
        /**
-        * Actions::parse_allowedadminskinactions()
+        * AdminActions::parse_allowedadminskinactions()
         * Parse skinvar allowedadminskinactions
         * 
         * @param       void
@@ -854,18 +1401,19 @@ class AdminActions extends BaseActions
        {
                global $DIR_ADMINSKINS;
                $skinType = strtolower(trim(requestVar('type')));
-               $actions  = Skin::getAllowedActionsForType($skinType);
+               $actions  = $this->parser->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 "<a href=\"{$DIR_ADMINSKINS}documentation/help.html#{$current}\" onclick=\"if (event &amp;&amp; event.preventDefault) event.preventDefault(); return help(this.href);\">{$current}</a>\n";
+                       echo helplink("adminskinvar-{$current}") . "$current</a>\n";
                        
                        if ( count($actions) != 0 )
                        {
@@ -876,7 +1424,7 @@ class AdminActions extends BaseActions
        }
        
        /**
-        * Actions::parse_allowedskinactions()
+        * AdminActions::parse_allowedskinactions()
         * Parse skinvar allowedskinactions
         * 
         * @param       void
@@ -885,11 +1433,15 @@ class AdminActions extends BaseActions
        public function parse_allowedskinactions()
        {
                $skinType = strtolower(trim(requestVar('type')));
-               $actions  = SKIN::getAllowedActionsForType($skinType);
+               $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' )
                        {
@@ -908,7 +1460,7 @@ class AdminActions extends BaseActions
        }
        
        /**
-        * Action::parse_banlistdeletedlist()
+        * AdminActions::parse_banlistdeletedlist()
         * Parse skinvar banlistdeletedlist
         * 
         * @param       string  $templateName   name of template to use
@@ -917,34 +1469,37 @@ class AdminActions extends BaseActions
        public function parse_banlistdeletedlist($templateName = '')
        {
                global $manager;
-               $templates = array();
                
+               $templates = array();
                if ( $templateName )
                {
                        $templates = Template::read($templateName);
                }
-               if ( isset($templates['BANLIST_DELETED_LIST']) && !empty($templates['BANLIST_DELETED_LIST']) )
+               
+               if ( !array_key_exists('BANLIST_DELETED_LIST', $templates) || empty($templates['BANLIST_DELETED_LIST']) )
                {
-                       $template = $templates['BANLIST_DELETED_LIST'];
+                       $template = "<li><%blogname%></li>\n";
                }
                else
                {
-                       $template = "<li><%blogname%></li>\n";
+                       $template = $templates['BANLIST_DELETED_LIST'];
                }
+               
                $deleted = requestArray('delblogs');
                foreach ( $deleted as $delblog )
                {
                        $blog =& $manager->getBlog($delblog);
                        $data =  array(
-                               Entity::hsc($blog->getName())
+                               'blogname' => Entity::hsc($blog->getName())
                        );
-                       TEMPLATE::fill($template, $data);
+                       echo Template::fill($template, $data);
                }
+               
                return;
        }
        
        /**
-        * Actions::parse_batchdeletelist()
+        * AdminActions::parse_batchdeletelist()
         * Parse skinvar batchdeletelist
         * 
         * @param       void
@@ -972,7 +1527,7 @@ class AdminActions extends BaseActions
        }
        
        /**
-        * Actions::parse_batchdeletetype()
+        * AdminActions::parse_batchdeletetype()
         * Parse skinvar batchdeletetype
         * 
         * @param       void
@@ -985,7 +1540,7 @@ class AdminActions extends BaseActions
        }
 
        /**
-        * Actions::parse_batchmovebtn()
+        * AdminActions::parse_batchmovebtn()
         * Parse skinvar batchmovebtn
         * 
         * @param       void
@@ -1007,7 +1562,7 @@ class AdminActions extends BaseActions
        }
        
        /**
-        * Actions::parse_batchmovelist()
+        * AdminActions::parse_batchmovelist()
         * Parse skinvar batchmovelist
         * 
         * @param       void
@@ -1016,15 +1571,17 @@ class AdminActions extends BaseActions
        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;
        }
        
        /**
-        * Actions::parse_batchmovetitle()
+        * AdminActions::parse_batchmovetitle()
         * Parse skinvar batchmovetitle
         * 
         * @param       void
@@ -1046,7 +1603,7 @@ class AdminActions extends BaseActions
        }
        
        /**
-        * Actions::parse_batchmovetype()
+        * AdminActions::parse_batchmovetype()
         * Parse skinvar batchmovetype
         * 
         * @param       void
@@ -1059,13 +1616,13 @@ class AdminActions extends BaseActions
        }
        
        /**
-        * Actions::parse_blogcatlist()
+        * AdminActions::parse_blogcatlist()
         * Parse skinvar blogcatlist
         * 
         * @param       void
         * @return      void
         */
-       public function parse_blogcatlist()
+       public function parse_blogcatlist($templateName = '')
        {
                global $manager;
                $blogid = intRequestVar('blogid');
@@ -1075,13 +1632,26 @@ class AdminActions extends BaseActions
                $template['content']  = 'categorylist';
                $template['tabindex'] = 200;
                
-               $batch = new Batch('member');
-               $batch->showlist($query, 'table', $template);
+               $batch = new Batch('category');
+               $batch->showlist($query, 'table', $template, $templateName);
+               return;
+       }
+       
+       /**
+        * AdminActions::parse_blogid()
+        * Parse skinvar blogid
+        * 
+        * @param       void
+        * @return      void
+        */
+       public function parse_blogid()
+       {
+               echo intRequestVar('blogid');
                return;
        }
        
        /**
-        * Actions::parse_blognotifysetting()
+        * AdminActions::parse_blognotifysetting()
         * Parse skinvar blognotifysetting
         * 
         * @param       void
@@ -1119,7 +1689,7 @@ class AdminActions extends BaseActions
        }
        
        /**
-        * AdminAction::parse_blogselectbox()
+        * AdminActions::parse_blogselectbox()
         * Parse skinvar blogselectbox
         * 
         * @param       void
@@ -1131,8 +1701,8 @@ class AdminActions extends BaseActions
                
                $selectData     = requestVar('selectData');
                $mode           = $selectData['mode'];
-               $name           = ENTITY::hsc($selectData['name'], ENT_QUOTES);
-               $tabindex       = ENTITY::hsc($selectData['tabindex'], ENT_QUOTES);
+               $name           = Entity::hsc($selectData['name']);
+               $tabindex       = Entity::hsc($selectData['tabindex']);
                $aBlogIds       = array_map('intval', $selectData['aBlogIds']);
                $showNewCat     = intval($selectData['showNewCat']);
                $selected       = intval($selectData['selected']);
@@ -1143,38 +1713,38 @@ class AdminActions extends BaseActions
                // (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);
+               $blogs = DB::getResult($queryBlogs);
                
                if ( $mode == 'category' )
                {
-                       if ( sql_num_rows($blogs) > 1 )
+                       if ( $blogs->rowCount() > 1 )
                        {
                                $multipleBlogs = 1;
                        }
-                       while ( $oBlog = sql_fetch_object($blogs) )
+                       foreach ( $blogs as $rBlog )
                        {
                                if ( isset($multipleBlogs) && !empty($multipleBlogs) )
                                {
-                                       echo '<optgroup label="' . ENTITY::hsc($oBlog->bname, ENT_QUOTES) . "\>\n";
+                                       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($oBlog->bnumber) )
+                                       if ( $member->blogAdminRights($rBlog['bnumber']) )
                                        {
-                                               echo '<option value="newcat-' . $oBlog->bnumber . '">' . _ADD_NEWCAT . "</option>\n";
+                                               echo '<option value="newcat-' . $rBlog['bnumber'] . '">' . _ADD_NEWCAT . "</option>\n";
                                        }
                                }
                                
                                // 2. for each category in that blog
-                               $catQueriy  = "SELECT cname, catid FROM %s WHERE cblog=%d ORDER BY cname ASC;";
-                               $catQuery = sprintf($catQuery, sql_table('category'), (integer) $oBlog->bnumber);
-                               $categories = sql_query(sprintf($catQueriy));
-                               while ( $oCat = sql_fetch_object($categories) )
+                               $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 ( $oCat->catid == $selected )
+                                       if ( $rCat['catid'] == $selected )
                                        {
                                                $selectText = ' selected="selected" ';
                                        }
@@ -1182,7 +1752,7 @@ class AdminActions extends BaseActions
                                        {
                                                $selectText = '';
                                        }
-                                       echo '<option value="' . $oCat->catid . '" ' . $selectText . '>' . ENTITY::hsc($oCat->cname, ENT_QUOTES) . "</option>\n";
+                                       echo '<option value="' . $rCat['catid'] . '" ' . $selectText . '>' . Entity::hsc($rCat['cname']) . "</option>\n";
                                }
                                
                                if ( isset($multipleBlogs) && !empty($multipleBlogs) )
@@ -1194,16 +1764,16 @@ class AdminActions extends BaseActions
                else
                {
                        // blog mode
-                       while ( $oBlog = sql_fetch_object($blogs) )
+                       foreach ( $blogs as $rBlog )
                        {
-                               echo '<option value="' . $oBlog->bnumber . '"';
-                               if ( $oBlog->bnumber == $selected )
+                               echo '<option value="' . $rBlog['bnumber'] . '"';
+                               if ( $rBlog['bnumber'] == $selected )
                                {
-                                       echo '<option value="' . $oBlog->bnumber . '" selected="selected">' . ENTITY::hsc($oBlog->bname, ENT_QUOTES) . "</option>\n";
+                                       echo '<option value="' . $rBlog['bnumber'] . '" selected="selected">' . Entity::hsc($rBlog['bname']) . "</option>\n";
                                }
                                else
                                {
-                                       echo '<option value="' . $oBlog->bnumber . '">' . ENTITY::hsc($oBlog->bname, ENT_QUOTES) . "</option>\n";
+                                       echo '<option value="' . $rBlog['bnumber'] . '">' . Entity::hsc($rBlog['bname']) . "</option>\n";
                                }
                        }
                }
@@ -1212,7 +1782,7 @@ class AdminActions extends BaseActions
        }
        
        /**
-        * Actions::parse_blogsetting()
+        * AdminActions::parse_blogsetting()
         * Parse skinvar blogsetting
         * 
         * @param       string  $which  name of weblog setting
@@ -1225,7 +1795,7 @@ class AdminActions extends BaseActions
        }
        
        /**
-        * Actions::parse_blogsettingyesno()
+        * AdminActions::parse_blogsettingyesno()
         * Parse skinvar blogsettingyesno
         * 
         * @param       string  $type                   type of weblog setting
@@ -1271,7 +1841,7 @@ class AdminActions extends BaseActions
        }
        
        /**
-        * Actions::parse_blogteamlist()
+        * AdminActions::parse_blogteamlist()
         * Parse skinvar blogteamlist
         * 
         * @param       string  $templateName   name of template to use
@@ -1290,12 +1860,12 @@ class AdminActions extends BaseActions
                $template['tabindex'] = 10;
 
                $batch = new Batch('team');
-               $batch->showlist($query, 'table', $template, _LISTS_NOMORE, $templateName);
+               $batch->showList($query, 'table', $template, $templateName, _LISTS_NOMORE);
                return;
        }
        
        /**
-        * Actions::parse_blogteammembers()
+        * AdminActions::parse_blogteammembers()
         * Parse skinvar blogteammembers
         * 
         * @param       void
@@ -1308,16 +1878,17 @@ class AdminActions extends BaseActions
                                . "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)) {
-                       $memberNames[] = Entity::hsc($o->mname) . ' (' . Entity::hsc($o->mrealname). ')';
+               foreach ( $res as $row )
+               {
+                       $memberNames[] = Entity::hsc($row['mname']) . ' (' . Entity::hsc($row['mrealname']). ')';
                }
                echo implode(',', $memberNames);
        }
        
        /**
-        * Actions::parse_blogtime()
+        * AdminActions::parse_blogtime()
         * Parse skinvar blogtime
         * 
         * @param       string  $type   type of time
@@ -1336,9 +1907,9 @@ class AdminActions extends BaseActions
                }
                else
                {
-                       $bid            = intRequestVar('blogid');
-                       $b                      = $manager->getBlog($bid);
-                       $timestamp      = $b->getCorrectTime() + $offset;
+                       $bid = intRequestVar('blogid');
+                       $b = $manager->getBlog($bid);
+                       $timestamp = $b->getCorrectTime() + $offset;
                }
                
                echo i18n::formatted_datetime($format, $timestamp);
@@ -1346,34 +1917,80 @@ class AdminActions extends BaseActions
        }
        
        /**
-        * Actions::parse_bookmarkletadmin()
+        * AdminActions::parse_bookmarkletadmin()
         * Parse skinvar bookmarkletadmin
         * 
-        * @param       string  $type   type of anchor element for bookmarklet
+        * @param       void
         * @return      void
         */
-       public function parse_bookmarkletadmin($type)
+       public function parse_bookmarkletadmin()
        {
                global $manager;
                
                $blogid = intRequestVar('blogid');
                
-               if ( $type != 'regfile' )
+               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
+        */
+       public function parse_categories($startidx = 0)
+       {
+               global $manager;
+               
+               $item = FALSE;
+               $itemid =  intRequestVar('itemid');
+               $item   = &$manager->getItem($itemid, 1, 1);
+               
+               $blog = FALSE;
+               if ( !$item )
+               {
+                       $blogid =  intRequestVar('blogid');
+               }
+               else
+               {
+                       $blogid =  $item['blogid'];
+               }
+               $blog   = &$manager->getBlog($blogid);
+               
+               if ( $item && $blog->convertBreaks() && requestVar('action') == 'itemedit' )
+               {
+                       $item['body'] = removeBreaks($item['body']);
+                       $item['more'] = removeBreaks($item['more']);
+               }
+               
+               $contents = array();
+               if ( requestVar('action') == 'itemedit' )
                {
-                       echo Entity::hsc(getBookmarklet($blogid));
+                       $contents = $item;
+               }
+               
+               if ( !array_key_exists('catid', $contents) || empty($contents['catid']) )
+               {
+                       // on add item
+                       $catid = $blog->getDefaultCategory();
                }
                else
                {
-                       $url = 'index.php?action=regfile&blogid=' . intval($blogid);
-                       $url = $manager->addTicketToUrl($url);
-                       /* TODO: Shift-JIS is not always correct, I think... */
-                       echo Entity::hsc($url, 'SJIS');
+                       // on edit item
+                       $catid = $contents['catid'];
                }
+               
+               Admin::selectBlogCategory('catid', $catid, $startidx, 1, $blog->getID());
+               
                return;
        }
        
        /**
-        * Actions::parse_category()
+        * AdminActions::parse_category()
         * Parse skinvar category
         * 
         * @param       string  $type   name of setting for category
@@ -1386,7 +2003,7 @@ class AdminActions extends BaseActions
        }
        
        /**
-        * Actions::parse_categorysetting()
+        * AdminActions::parse_categorysetting()
         * Parse skinvar categorysetting
         * 
         * @param       string  $type   type in category setting
@@ -1403,23 +2020,62 @@ 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 != desc )
+               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;
+       }
+       
+       /**
+        * AdminActions::parse_codename()
+        * Parse templatevar codename
+        * 
+        * @param       $value
+        * @param       $name
+        * 
+        */
+       public function parse_checkedonval($value, $name)
+       {
+               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;
+               }
+               if ( !isset($contents[$name]) )
+               {
+                       $contents[$name] = '';
+               }
+               if ($contents[$name] == $value)
+               {
+                       echo 'checked="checked"';
+               }
                return;
        }
        
        /**
-        * Actions::parse_codename()
+        * AdminActions::parse_codename()
         * Parse templatevar codename
         * 
         * @param       void
@@ -1435,7 +2091,7 @@ class AdminActions extends BaseActions
        }
        
        /**
-        * Actions::parse_commentnavlist()
+        * AdminActions::parse_commentnavlist()
         * Parse skinvar commentnavlist
         * 
         * @param       void
@@ -1502,7 +2158,7 @@ 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}";
@@ -1515,7 +2171,7 @@ class AdminActions extends BaseActions
        }
        
        /**
-        * Actions::parse_configsettingsedit()
+        * AdminActions::parse_configsettingsedit()
         * Parse skinvar configsettingsedit
         * 
         * @param       string  $type   type of global configuration
@@ -1531,7 +2187,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 )
@@ -1563,7 +2219,7 @@ class AdminActions extends BaseActions
        }
        
        /**
-        * Actions::parse_configsettingsyesno()
+        * AdminActions::parse_configsettingsyesno()
         * Parse skinvar configsettingsyesno
         * 
         * @param       string  $type           type of global setting
@@ -1581,7 +2237,78 @@ class AdminActions extends BaseActions
        }
        
        /**
-        * Actions::parse_customhelplink()
+        * AdminActions::parse_contents()
+        * Parse skinvar contents
+        * 
+        * @param       string  $which          part for item
+        * @return      void
+        */
+       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) )
+               {
+                       $contents[$which] = '';
+               }
+               echo Entity::hsc($contents[$which],ENT_QUOTES);
+       }
+       
+       /**
+        * AdminActions::parse_currenttime()
+        * Parse skinvar currenttime
+        * 
+        * @param       string  $what
+        */
+       // for future items
+       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());
+               echo $nu[$what];
+       }
+       
+       /**
+        * AdminActions::parse_customhelplink()
         * Parse skinvar customhelplink
         * 
         * @param       string  $topic          name of topic
@@ -1599,7 +2326,7 @@ class AdminActions extends BaseActions
        }
        
        /**
-        * Actions::parse_date()
+        * AdminActions::parse_date()
         * Parse skinvar date
         */
        public function parse_date($format = 'c')
@@ -1610,7 +2337,7 @@ class AdminActions extends BaseActions
        }
        
        /**
-        * Actions::parse_defaultadminskintypes()
+        * AdminActions::parse_defaultadminskintypes()
         * Parse skinvar defaultadminskintypes
         * 
         * @param       string  $tabindex               index number for tabindex attribute of input element
@@ -1620,40 +2347,51 @@ class AdminActions extends BaseActions
        public function parse_defaultadminskintypes($tabindex, $templateName = '')
        {
                $templates = array();
+               
                if ( $templateName )
                {
                        $templates = Template::read($templateName);
                }
                
-               $types   = Skin::getAdminskinDefaultTypeFriendlyNames();
+               $types = $this->parser->skin->getAvailableTypes();
                ksort($types);
                
-               if ( array_key_exists('ADMINSKINTYPELIST_HEAD', $templates) && !empty($templates['ADMINSKINTYPELIST_HEAD']) )
+               /* NOTE: set templates for HEAD/BODY/FOOT */
+               if ( !array_key_exists('ADMINSKINTYPELIST_HEAD', $templates) || empty($templates['ADMINSKINTYPELIST_HEAD']) )
                {
-                       $template['head'] = $templates['ADMINSKINTYPELIST_HEAD'];
+                       $template['head'] = "<ul>\n";
                }
                else
                {
-                       $template['head'] = "<ul>\n";
+                       $template['head'] = $templates['ADMINSKINTYPELIST_HEAD'];
                }
-               
-               echo $template['head'];
-               
-               if ( array_key_exists('ADMINSKINTYPELIST_BODY', $templates) && !empty($templates['ADMINSKINTYPELIST_BODY']) )
+               if ( !array_key_exists('ADMINSKINTYPELIST_BODY', $templates) || empty($templates['ADMINSKINTYPELIST_BODY']) )
+               {
+                       $template['body'] = "<li>"
+                                         . "<a tabindex=\"<%tabindex%>\" href=\"index.php?action=adminskinedittype&amp;skinid=<%skinid%>&amp;type=<%skintype%>\"><%name%></a> <%help%>"
+                                         . "</li>\n";
+               }
+               else
                {
                        $template['body'] = $templates['ADMINSKINTYPELIST_BODY'];
                }
+               if ( !array_key_exists('ADMINSKINTYPELIST_FOOT', $templates) || empty($templates['ADMINSKINTYPELIST_FOOT']) )
+               {
+                       $template['foot'] = "</ul>\n";
+               }
                else
                {
-                       $template['body'] = '<li><a tabindex="<%tabindex%>" href="index.php?action=adminskinedittype&amp;skinid=<%skinid%>&amp;type=<%skintype%>">'
-                                         . "<%name%></a> <%help%></li>\n";
+                       $template['foot'] = $templates['ADMINSKINTYPELIST_FOOT'];
                }
-               $handler = new Actions('template', $template, new ADMIN);
-               $parser  = new PARSER(Actions::getDefinedActions(), $handler);
                
+               $handler = new AdminActions('template');
+               $parser = new PARSER($handler);
+               
+               /* NOTE: do output */
+               echo $template['head'];
                foreach ( $types as $type => $fName )
                {
-                       $helplink = $this->customHelpHtml('skinpart' . $type, $templateName);
+                       $helplink = $this->customHelpHtml("skinpart{$type}{$templateName}");
                        $data = array(
                                'tabindex'      => $tabindex,
                                'skintype'      => $type,
@@ -1661,24 +2399,16 @@ class AdminActions extends BaseActions
                                'help'          => $helplink,
                                'skinid'        => intrequestVar('skinid'),
                        );
-                       $templateBody = Template::fill($template['body'], $data);
-                       $parser->parse($templateBody);
+                       $parser->parse(Template::fill($template['body'], $data));
                        $tabindex++;
                }
-               if ( array_key_exists('ADMINSKINTYPELIST_FOOT', $templates) && !empty($templates['ADMINSKINTYPELIST_FOOT']) )
-               {
-                       $template['foot'] = $templates['ADMINSKINTYPELIST_FOOT'];
-               }
-               else
-               {
-                       $template['foot'] = "           </ul>\n";
-               }
                echo $template['foot'];
+               
                return;
        }
        
        /**
-        * Actions::parse_defblogselect()
+        * AdminActions::parse_defblogselect()
         * Parse skinvar defblogselect
         * 
         * @param       string  $templateName   name of template
@@ -1687,17 +2417,21 @@ class AdminActions extends BaseActions
        public function parse_defblogselect($templateName = '')
        {
                global $CONF;
-               $query  = "SELECT bname as text, bnumber as value FROM %s;";
+               
+               $query = "SELECT bname as text, bnumber as value FROM %s;";
                $query = sprintf($query, sql_table('blog'));
-               $template['name']        = 'DefaultBlog';
+               
+               $template['name'] = 'DefaultBlog';
                $template['selected'] = $CONF['DefaultBlog'];
                $template['tabindex'] = 10;
+               
                Showlist($query, 'select', $template, $templateName);
+               
                return;
        }
        
        /**
-        * Actions::parse_defcatselect()
+        * AdminActions::parse_defcatselect()
         * Parse skinvar defcatselect
         * 
         * @param       string  $templateName   name of template
@@ -1706,19 +2440,24 @@ class AdminActions extends BaseActions
        public function parse_defcatselect($templateName = '')
        {
                global $manager;
+               
                $blogid = intRequestVar('blogid');
-               $blog   = $manager->getBlog($blogid);
-               $query  = "SELECT cname as text, catid as value FROM %s WHERE cblog=%d;";
+               $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());
+               
                $template['name']        = 'defcat';
                $template['selected'] = $blog->getDefaultCategory();
                $template['tabindex'] = 110;
+               
                Showlist($query, 'select', $template, $templateName);
+               
                return;
        }
        
        /**
-        * Actions::parse_defskinselect()
+        * AdminActions::parse_defskinselect()
         * Parse skinvar defskinselect
         * 
         * @param       string  $type                   type of skin
@@ -1727,20 +2466,20 @@ class AdminActions extends BaseActions
         */
        public function parse_defskinselect($type = 'blog', $templateName = '')
        {
-               global $manager;
-               $query  = "SELECT sdname as text, sdnumber as value FROM %s;";
+               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 )
                {
-                       global $CONF;
                        $template['selected'] = $CONF['BaseSkin'];
                }
                else
                {
-                       $blog                            = $manager->getBlog($blogid);
+                       $blog = $manager->getBlog($blogid);
                        $template['selected'] = $blog->getDefaultSkin();
                }
                
@@ -1755,7 +2494,9 @@ class AdminActions extends BaseActions
                
                $template['name']        = $nname;
                $template['tabindex'] = 50;
+               
                Showlist($query, 'select', $template, $templateName);
+               
                return;
        }
        
@@ -1788,13 +2529,13 @@ class AdminActions extends BaseActions
                                break;
                        case 'body':
                                $body = strip_tags($comment['body']);
-                               echo ENTITY::hsc(shorten($body, 300, '...'), ENT_QUOTES);
+                               echo Entity::hsc(shorten($body, 300, '...'));
                }
                return;
        }
        
        /**
-        * Actions::parse_deleteitembody()
+        * AdminActions::parse_deleteitembody()
         * Parse skinvar deleteitembody
         * 
         * @param       void
@@ -1803,15 +2544,19 @@ class AdminActions extends BaseActions
        public function parse_deleteitembody()
        {
                global $manager;
+               
                $itemid =  intRequestVar('itemid');
-               $item   =& $manager->getItem($itemid, 1, 1);
-               $body   =  strip_tags($item['body']);
+               $item =& $manager->getItem($itemid, 1, 1);
+               
+               $body =  strip_tags($item['body']);
+               
                echo Entity::hsc(shorten($body, 300, '...'));
+               
                return;
        }
        
        /**
-        * Actions::parse_deleteitemid()
+        * AdminActions::parse_deleteitemid()
         * Parse skinvar deleteitemid
         * 
         * @param       void
@@ -1824,7 +2569,7 @@ class AdminActions extends BaseActions
        }
        
        /**
-        * Actions::parse_deleteitemtitle()
+        * AdminActions::parse_deleteitemtitle()
         * Parse skinvar deleteitemtitle
         * 
         * @param       void
@@ -1833,14 +2578,17 @@ class AdminActions extends BaseActions
        public function parse_deleteitemtitle()
        {
                global $manager;
+               
                $itemid = intRequestVar('itemid');
-               $item  =& $manager->getItem($itemid, 1, 1);
+               $item =& $manager->getItem($itemid, 1, 1);
+               
                echo Entity::hsc(strip_tags($item['title']));
+               
                return;
        }
        
        /**
-        * Actions::parse_editadminskin()
+        * AdminActions::parse_editadminskin()
         * Parse skinvar editadminskin
         * 
         * @param       string  $type   type of skin setting
@@ -1876,7 +2624,7 @@ class AdminActions extends BaseActions
        }
        
        /**
-        * Actions::parse_editadminskintype()
+        * AdminActions::parse_editadminskintype()
         * Parse skinvar editadminskintype
         * 
         * @param       string  $type   name of skin type
@@ -1885,9 +2633,8 @@ class AdminActions extends BaseActions
        public function parse_editadminskintype($type = 'id')
        {
                global $CONF, $manager, $member;
-               $skinid = intRequestVar('skinid');
-               $skin   = new Skin($skinid);
-               $fNames = Skin::getFriendlyNames();
+               
+               $fNames = $this->parser->skin->getAvailableTypes();
                $sType  = strtolower(trim(requestVar('type')));
                
                switch ( $type )
@@ -1896,26 +2643,26 @@ class AdminActions extends BaseActions
                                echo intRequestVar('skinid');
                                break;
                        case 'name':
-                               echo Entity::hsc($skin->getName());
+                               echo Entity::hsc($this->parser->skin->getName());
                                break;
                        case 'desc':
-                               echo Entity::hsc($skin->getDescription());
+                               echo Entity::hsc($this->parser->skin->getDescription());
                                break;
                        case 'type':
-                               echo Entity::hsc($skin->getContentType());
+                               echo Entity::hsc($this->parser->skin->getContentType());
                                break;
                        case 'content':
-                               echo Entity::hsc($skin->getContent($sType));
+                               echo Entity::hsc($this->parser->skin->getContentFromDB($sType));
                                break;
                        case 'skintype':
-                               $skinType = isset($fNames[$sType]) ? $fNames[$sType] : ucfirst($sType);
+                               $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($skin->getIncludePrefix());
+                               echo Entity::hsc($this->parser->skin->getIncludePrefix());
                                break;
                        case 'mode':
                                $incMode = $skin->getIncludeMode() ? _PARSER_INCMODE_SKINDIR : _PARSER_INCMODE_NORMAL;
@@ -1928,81 +2675,7 @@ class AdminActions extends BaseActions
        }
        
        /**
-        * Actions::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, $description = '', $name = '', $help = '', $tabindex = 0, $big = 0, $tplt = '')
-       {
-               global $manager;
-               $templateid                             =  intRequestVar('templateid');
-               $templatename                   =  Template::getNameFromId($templateid);
-               $templatedescription    =  Template::getDesc($templateid);
-               $template                               =& Template::read($templatename);
-               switch ( $type )
-               {
-                       case 'id':
-                               echo intval($templateid);
-                               break;
-                       case 'name':
-                               echo Entity::hsc($templatename);
-                               break;
-                       case 'desc':
-                               echo Entity::hsc($templatedescription);
-                               break;
-                       case 'extratemplate':
-                               $tabidx    = 600;
-                               $pluginfields = array();
-                               $manager->notify(
-                                       'AdminTemplateExtraFields',
-                                       array(
-                                               'fields' => &$pluginfields
-                                       )
-                               );
-                               $tmplt = array();
-                               if ( $description )
-                               {
-                                       $tmplt = Template::read($description);
-                               }
-                               if ( array_key_exists('TEMPLATE_EDIT_EXPLUGNAME', $tmplt) && !empty($tmplt['TEMPLATE_EDIT_EXPLUGNAME']) )
-                               {
-                                       $base = $tmplt['TEMPLATE_EDIT_EXPLUGNAME'];
-                               }
-                               else
-                               {
-                                       $base = "</tr>\n"
-                                             . "<tr>\n"
-                                             . "\t" . '<th colspan="2"><%explugtplname%>' . "</th>\n";
-                               }
-                               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);
-                                       }
-                               }
-                               break;
-                       default:
-                               $desc = defined($description) ? constant($description) : $description;
-                               $name = defined($name) ? constant($name) : $name;
-                               $this->_templateEditRow($template, $desc, $name, $help, $tabindex, $big, $tplt);
-                               break;
-               }
-               return;
-       }
-       
-       /**
-        * Actions::parse_editcomment()
+        * AdminActions::parse_editcomment()
         * Parse skinvar editcomment
         * 
         * @param       string  $type   type of comment setting
@@ -2011,6 +2684,7 @@ class AdminActions extends BaseActions
        public function parse_editcomment($type = 'id')
        {
                global $manager;
+               
                $commentid      = intRequestVar('commentid');
                $comment        = COMMENT::getComment($commentid);
                
@@ -2022,13 +2696,13 @@ class AdminActions extends BaseActions
                                echo intRequestVar('commentid');
                                break;
                        case 'user':
-                               if (array_key_exists('member', $comment) && !empty($comment['member']) )
+                               if ( !array_key_exists('member', $comment) || empty($comment['member']) )
                                {
-                                       echo $comment['member'] . " (" . _EDITC_MEMBER . ")";
+                                       echo $comment['user'] . " (" . _EDITC_NONMEMBER . ")";
                                }
                                else
                                {
-                                       echo $comment['user'] . " (" . _EDITC_NONMEMBER . ")";
+                                       echo $comment['member'] . " (" . _EDITC_MEMBER . ")";
                                }
                                break;
                        case 'date':
@@ -2038,6 +2712,13 @@ 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];
                                break;
@@ -2046,7 +2727,7 @@ class AdminActions extends BaseActions
        }
        
        /**
-        * Actions::parse_editdesturl()
+        * AdminActions::parse_editdesturl()
         * Parse skinvar editdesturl
         */
        public function parse_editdesturl()
@@ -2059,7 +2740,7 @@ class AdminActions extends BaseActions
        }
        
        /**
-        * Actions::parse_editmemberlist()
+        * AdminActions::parse_editmemberlist()
         * Parse skinvar editmemberlist
         * 
         * @param       string  $templateName   name of template
@@ -2070,11 +2751,11 @@ class AdminActions extends BaseActions
                global $manager;
                // show list of members with actions
                $query =  'SELECT * FROM '.sql_table('member');
-               $template['content']  = 'memberlist';
+               $template['content'] = 'memberlist';
                $template['tabindex'] = 10;
                
                $batch = new Batch('member');
-               $batch->showlist($query, 'table', $template, _LISTS_NOMORE, $templateName);
+               $batch->showList($query, 'table', $template, $templateName, _LISTS_NOMORE);
                return;
        }
        
@@ -2089,8 +2770,9 @@ class AdminActions extends BaseActions
        public function parse_editmember($type = 'id', $templateName = '')
        {
                global $CONF, $manager, $member;
-               $memberid       = intRequestVar('memberid');
-               $mem            = MEMBER::createFromID($memberid);
+               
+               $memberid = intRequestVar('memberid');
+               $mem = MEMBER::createFromID($memberid);
                
                switch ( $type )
                {
@@ -2100,11 +2782,11 @@ class AdminActions extends BaseActions
                        case 'displayname':
                                if ( $this->skintype == 'teamdelete' || $this->skintype == 'memberdelete' )
                                {
-                                       echo ENTITY::hsc($mem->getDisplayName(), ENT_QUOTES);
+                                       echo Entity::hsc($mem->getDisplayName());
                                }
                                else
                                {
-                                       $dispName = ENTITY::hsc($mem->getDisplayName(), ENT_QUOTES);
+                                       $dispName = Entity::hsc($mem->getDisplayName());
                                        if ( $CONF['AllowLoginEdit'] || $member->isAdmin() )
                                        {
                                                echo '<input name="name" tabindex="10" maxlength="32" size="32" value="' . $dispName . "\" />\n";
@@ -2116,13 +2798,13 @@ class AdminActions extends BaseActions
                                }
                                break;
                        case 'realname':
-                               echo ENTITY::hsc($mem->getRealName(), ENT_QUOTES);
+                               echo Entity::hsc($mem->getRealName());
                                break;
                        case 'email':
-                               echo ENTITY::hsc($mem->getEmail(), ENT_QUOTES);
+                               echo Entity::hsc($mem->getEmail());
                                break;
                        case 'url':
-                               echo ENTITY::hsc($mem->getURL(), ENT_QUOTES);
+                               echo Entity::hsc($mem->getURL());
                                break;
                        case 'admin':
                                $this->parse_inputyesno('admin', $mem->isAdmin(), 60, 1, 0, _YES, _NO, 0, $templateName);
@@ -2131,7 +2813,7 @@ class AdminActions extends BaseActions
                                $this->parse_inputyesno('canlogin', $mem->canLogin(), 70, 1, 0, _YES, _NO, $mem->isAdmin(), $templateName);
                                break;
                        case 'notes':
-                               echo ENTITY::hsc($mem->getNotes(), ENT_QUOTES);
+                               echo Entity::hsc($mem->getNotes());
                                break;
                        case 'autosave':
                                $this->parse_inputyesno('autosave', $mem->getAutosave(), 87, 1, 0, _YES, _NO, 0, $templateName);
@@ -2143,7 +2825,7 @@ class AdminActions extends BaseActions
        }
        
        /**
-        * Actions::parse_editpluginfo()
+        * AdminActions::parse_editpluginfo()
         * Parse skinvar editpluginfo
         * 
         * @param       string  $type   type of plugin info
@@ -2151,6 +2833,8 @@ class AdminActions extends BaseActions
         */
        public function parse_editpluginfo($type)
        {
+               global $manager;
+               
                $pid = intRequestVar('plugid');
                switch ( $type )
                {
@@ -2158,14 +2842,14 @@ class AdminActions extends BaseActions
                                echo $pid;
                                break;
                        case 'name':
-                               echo Entity::hsc(getPluginNameFromPid($pid));
+                               echo Entity::hsc($manager->getPluginNameFromPid($pid));
                                break;
                }
                return;
        }
        
        /**
-        * Actions::parse_editplugoptionslist()
+        * AdminActions::parse_editplugoptionslist()
         * Parse skinvar editplugoptionslist
         * 
         * @param       string  $templateName   name of template
@@ -2179,21 +2863,20 @@ class AdminActions extends BaseActions
                $aOptions = array();
                $aOIDs  = array();
                
-               $query  = "SELECT * FROM %s WHERE ocontext='global' AND opid=%d ORDER BY oid ASC";
+               $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);
+               $resource = DB::getResult($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,
+               foreach ( $resource as $row )
+               {
+                       array_push($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
                        );
                }
@@ -2204,26 +2887,26 @@ 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);
+                       $result = DB::getResult($query);
                        
-                       while ( $o = sql_fetch_object($result) )
+                       foreach ( $result as $row )
                        {
-                               $aOptions[$o->oid]['value'] = $o->ovalue;
+                               $aOptions[$row['oid']]['value'] = $row['ovalue'];
                        }
                }
                
                // call plugins
-               $manager->notify(
-                       'PrePluginOptionsEdit',
-                       array(
-                               'context'       =>  'global',
-                               'plugid'        =>  $pid,
-                               'options'       => &$aOptions
-                       )
+               $data = array(
+                       'context'       =>  'global',
+                       'plugid'        =>  $pid,
+                       'options'       => &$aOptions
                );
+               $manager->notify('PrePluginOptionsEdit', $data);
                
                $template['content'] = 'plugoptionlist';
-               $amount                   = Showlist($aOptions, 'table', $template, $templateName);
+               
+               $amount = Showlist($aOptions, 'table', $template, $templateName);
+               
                if ( $amount == 0 )
                {
                        echo '<p>' . _ERROR_NOPLUGOPTIONS . "</p>\n";
@@ -2232,7 +2915,7 @@ class AdminActions extends BaseActions
        }
        
        /**
-        * Actions::parse_editskin()
+        * AdminActions::parse_editskin()
         * Parse skinvar editskin
         * 
         * @param       string  $type   type of skin
@@ -2268,7 +2951,7 @@ class AdminActions extends BaseActions
        }
        
        /**
-        * Actions::parse_editskintype()
+        * AdminActions::parse_editskintype()
         * Parse skinvar editskintype
         * 
         * @param       string  $type   name of type for skin type
@@ -2277,10 +2960,10 @@ class AdminActions extends BaseActions
        public function parse_editskintype($type = 'id')
        {
                global $CONF, $manager, $member;
-               $skinid = intRequestVar('skinid');
-               $skin   = new SKIN($skinid);
-               $fNames = SKIN::getFriendlyNames();
-               $sType  = strtolower(trim(requestVar('type')));
+               $skinid = intRequestVar('skinid');
+               $skin   = new SKIN($skinid);
+               $fNames = $skin->getAvailableTypes();
+               $sType  = strtolower(trim(requestVar('type')));
                
                switch ( $type )
                {
@@ -2297,10 +2980,10 @@ class AdminActions extends BaseActions
                                echo Entity::hsc($skin->getContentType());
                                break;
                        case 'content':
-                               echo Entity::hsc($skin->getContent($sType));
+                               echo Entity::hsc($skin->getContentFromDB($sType));
                                break;
                        case 'skintype':
-                               $skinType = isset($fNames[$sType]) ? $fNames[$sType] : ucfirst($sType);
+                               $skinType = !array_key_exists($sType, $fNames) ? ucfirst($sType) : $fNames[$sType];
                                echo Entity::hsc($skinType);
                                break;
                        case 'skintyperaw':
@@ -2320,7 +3003,21 @@ class AdminActions extends BaseActions
        }
        
        /**
-        * Actions::parse_edittemplateinfo()
+        * AdminActions::parse_adminurl()
+        * Parse skinvar adminurl
+        * (shortcut for admin url)
+        *
+        * @param       void
+        * @return      void
+        */
+       public function parse_adminurl()
+       {
+               $this->parse_sitevar('adminurl');
+               return;
+       }
+       
+       /**
+        * AdminActions::parse_edittemplateinfo()
         * Parse skinvar edittemplateinfo
         * 
         * @param       string  $type                   name of type for skin
@@ -2330,71 +3027,146 @@ class AdminActions extends BaseActions
         * @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, $description = '', $name = '', $help = '', $tabindex = 0, $big = 0, $tplt = '')
+       public function parse_edittemplateinfo($type, $desc = '', $name = '', $help = '', $tabindex = 0, $big = 0, $tplt = '')
        {
                global $manager;
-               $templateid                             =  intRequestVar('templateid');
-               $templatename                   =  TEMPLATE::getNameFromId($templateid);
-               $templatedescription    =  TEMPLATE::getDesc($templateid);
-               $template                               =& $manager->getTemplate($templatename);
+               
+               $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($templateid);
+                               echo intval($t_id);
                                break;
                        case 'name':
-                               echo Entity::hsc($templatename);
+                               echo Entity::hsc($t_name);
                                break;
                        case 'desc':
-                               echo Entity::hsc($templatedescription);
+                               echo Entity::hsc($t_desc);
                                break;
                        case 'extratemplate':
-                               $tabidx    = 600;
+                               $tabidx = 600;
                                $pluginfields = array();
-                               $manager->notify(
-                                       'TemplateExtraFields',
-                                       array(
-                                               'fields' => &$pluginfields
-                                       )
-                               );
+                               $manager->notify('TemplateExtraFields', array('fields' => &$pluginfields));
+                               
                                $tmplt = array();
-                               if ( $description )
+                               if ( $desc )
+                               {
+                                       $tmplt = Template::read($desc);
+                               }
+                               if ( !array_key_exists('TEMPLATE_EDIT_EXPLUGNAME', $tmplt) || empty($tmplt['TEMPLATE_EDIT_EXPLUGNAME']) )
                                {
-                                       $tmplt = Template::read($description);
+                                       $base = "</tr>\n"
+                                             . "<tr>\n"
+                                             . '<th colspan="2"><%explugtplname%>' . "</th>\n";
                                }
-                               if ( array_key_exists('TEMPLATE_EDIT_EXPLUGNAME', $tmplt) && !empty($tmplt['TEMPLATE_EDIT_EXPLUGNAME']) )
+                               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);
+                                       }
+                               }
+                               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));
+                               
+                               $tmplt = array();
+                               if ( $desc )
+                               {
+                                       $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";
+                               }
                                else
                                {
-                                       $base = "</tr><tr>\n"
-                                                 . "\t" . '<th colspan="2"><%explugtplname%>' . "</th>\n";
+                                       $base = $tmplt['TEMPLATE_EDIT_EXPLUGNAME'];
                                }
+                               
                                foreach ( $pluginfields as $pfkey => $pfvalue )
                                {
-                                       $data = array(
-                                               'explugtplname' => Entity::hsc($pfkey)
-                                       );
-                                       echo TEMPLATE::fill($base, $data);
+                                       $data = array('explugtplname' => Entity::hsc($pfkey));
+                                       
+                                       echo Template::fill($base, $data);
+                                       
                                        foreach ( $pfvalue as $pffield => $pfdesc )
                                        {
-                                               $this->_templateEditRow($template, $pfdesc, $pffield, '', ++$tabidx, 0, $name);
+                                               $this->templateEditRow($template, $pfdesc, $pffield, '', ++$tabidx, 0, $name);
                                        }
                                }
                                break;
                        default:
-                               $desc = defined($description) ? constant($description) : $description;
+                               $desc = defined($desc) ? constant($desc) : $desc;
                                $name = defined($name) ? constant($name) : $name;
-                               $this->_templateEditRow($template, $desc, $name, $help, $tabindex, $big, $tplt);
+                               $this->templateEditRow($template, $desc, $name, $help, $tabindex, $big, $tplt);
                                break;
                }
                return;
        }
        
        /**
-        * Actions::parse_eventformextra()
+        * AdminActions::parse_eventformextra()
         * Parse skinvar eventformextra
         * 
         * @param       string  $type   name of type for event form extra
@@ -2403,33 +3175,34 @@ class AdminActions extends BaseActions
        public function parse_eventformextra($type = 'activation')
        {
                global $manager;
+               
+               $data = array();
+               
                switch ( $type )
                {
                        case 'activation':
                                $key = requestVar('ackey');
                                if ( !$key )
                                {
-                                       $this->objAdmin->error(_ERROR_ACTIVATE);
+                                       Admin::error(_ERROR_ACTIVATE);
                                }
                                $info = MEMBER::getActivationInfo($key);
                                if ( !$info )
                                {
-                                       $this->objAdmin->error(_ERROR_ACTIVATE);
+                                       Admin::error(_ERROR_ACTIVATE);
                                }
                                $mem  = MEMBER::createFromId($info->vmember);
                                if ( !$mem )
                                {
-                                       $this->objAdmin->error(_ERROR_ACTIVATE);
+                                       Admin::error(_ERROR_ACTIVATE);
                                }
                                $data = array(
-                                       'type'   => 'activation',
-                                       'member' => $mem
+                                       'type'          => 'activation',
+                                       'member'        => $mem
                                );
                                break;
                        case 'membermailform-notloggedin':
-                               $data = array(
-                                       'type' => 'membermailform-notloggedin',
-                               );
+                               $data = array('type' => 'membermailform-notloggedin',);
                                break;
                }
                $manager->notify('FormExtra', $data);
@@ -2437,153 +3210,285 @@ class AdminActions extends BaseActions
        }
        
        /**
-        * Actions::parse_extrahead()
+        * AdminActions::parse_extrahead()
         * Parse skinvar extrahead
         */
        public function parse_extrahead()
        {
                global $manager;
-               $extrahead = $this->objAdmin->extrahead;
-               $manager->notify(
-                       'AdminPrePageHead',
-                       array(
-                               'extrahead'     => &$extrahead,
-                               'action'        => $this->objAdmin->action
-                       )
-               );
-               echo $extrahead;
-               return;
-       }
-       
-       /**
-        * AdminActions::parse_getblogsetting()
-        * Parse skinvar getblogsetting
-        */
-       public function parse_getblogsetting($which)
-       {
-               global $blog;
                
-               if ( $blog )
-               {
-                       $b =& $blog;
-               }
-               elseif ( $bid = intRequestVar('blogid') )
-               {
-                       global $manager;
-                       $b = $manager->getBlog($bid);
-               }
-               else
-               {
-                       return;
-               }
+               $extrahead = Admin::getAdminextrahead();
                
-               switch ( $which )
-               {
-                       case 'id':
-                               return ENTITY::hsc($b->getID(), ENT_QUOTES);
-                               break;
-                       case 'url':
-                               return ENTITY::hsc($b->getURL(), ENT_QUOTES);
-                               break;
-                       case 'name':
-                               return ENTITY::hsc($b->getName(), ENT_QUOTES);
-                               break;
-                       case 'desc':
-                               return ENTITY::hsc($b->getDescription(), ENT_QUOTES);
-                               break;
-                       case 'short':
-                               return ENTITY::hsc($b->getShortName(), ENT_QUOTES);
-                               break;
-                       case 'notifyaddress':
-                               return ENTITY::hsc($b->getNotifyAddress(), ENT_QUOTES);
-                               break;
-                       case 'maxcomments':
-                               return ENTITY::hsc($b->getMaxComments(), ENT_QUOTES);
-                               break;
-                       case 'updatefile':
-                               return ENTITY::hsc($b->getUpdateFile(), ENT_QUOTES);
-                               break;
-                       case 'timeoffset':
-                               return ENTITY::hsc($b->getTimeOffset(), ENT_QUOTES);
-                               break;
-               }
-               return;
-       }
-       
-       /**
-        * Actions::parse_geteditpluginfo()
-        * Parse skinvar geteditpluginfo
-        * 
-        * @param       string  $type   name of setting for edit plugin info
-        * @return      void
-        */
-       public function parse_geteditpluginfo($type)
-       {
-               $pid = intRequestVar('plugid');
-               switch ( $type )
-               {
-                       case 'id':
-                               return $pid;
-                               break;
-                       case 'name':
-                               return Entity::hsc(getPluginNameFromPid($pid));
-                               break;
-               }
+               $data = array(
+                       'extrahead'     => &$extrahead,
+                       'action'        => Admin::getAdminAction()
+               );
+               
+               $manager->notify('AdminPrePageHead', $data);
+               echo $extrahead;
                return;
        }
        
        /**
-        * Actions::parse_getmember()
-        * Parse skinvar getmember
+        * AdminActions::parse_member()
+        * Parse skinvar member
         * (includes a member info thingie)
         * 
-        * @param       string  $what   name of setting for member
+        * @param       string  $what   which memberdata is needed
         * @return      void
         */
-       public function parse_getmember($what)
+       public function parse_member($what)
        {
-               global $memberinfo, $member;
+               global $memberinfo, $member, $CONF;
+               
                // 1. only allow the member-details-page specific variables on member pages
                if ( $this->skintype == 'member' )
                {
-                       switch ( $what )
+                       switch( $what )
                        {
                                case 'name':
-                                       return Entity::hsc($memberinfo->getDisplayName());
+                                       echo Entity::hsc($memberinfo->getDisplayName());
                                        break;
                                case 'realname':
-                                       return Entity::hsc($memberinfo->getRealName());
+                                       echo Entity::hsc($memberinfo->getRealName());
                                        break;
                                case 'notes':
-                                       return Entity::hsc($memberinfo->getNotes());
+                                       echo Entity::hsc($memberinfo->getNotes());
                                        break;
                                case 'url':
-                                       return Entity::hsc($memberinfo->getURL());
+                                       echo Entity::hsc($memberinfo->getURL());
                                        break;
                                case 'email':
-                                       return Entity::hsc($memberinfo->getEmail());
+                                       echo Entity::hsc($memberinfo->getEmail());
                                        break;
                                case 'id':
-                                       return Entity::hsc($memberinfo->getID());
+                                       echo Entity::hsc($memberinfo->getID());
                                        break;
                        }
                }
+               
                // 2. the next bunch of options is available everywhere, as long as the user is logged in
                if ( $member->isLoggedIn() )
                {
-                       switch ( $what )
+                       switch( $what )
                        {
                                case 'yourname':
-                                       return $member->getDisplayName();
+                                       echo $member->getDisplayName();
                                        break;
                                case 'yourrealname':
-                                       return $member->getRealName();
+                                       echo $member->getRealName();
                                        break;
                                case 'yournotes':
-                                       return $member->getNotes();
+                                       echo $member->getNotes();
                                        break;
                                case 'yoururl':
-                                       return $member->getURL();
+                                       echo $member->getURL();
+                                       break;
+                               case 'youremail':
+                                       echo $member->getEmail();
+                                       break;
+                               case 'yourid':
+                                       echo $member->getID();
+                                       break;
+                               case 'yourprofileurl':
+                                       if ( $CONF['URLMode'] == 'pathinfo' )
+                                       {
+                                               echo Link::create_member_link($member->getID());
+                                       }
+                                       else
+                                       {
+                                               echo $CONF['IndexURL'] . Link::create_member_link($member->getID());
+                                       }
+                                       break;
+                       }
+               }
+               return;
+       }
+       
+       /**
+        * AdminActions::parse_version()
+        * Parse skinvar version
+        * (include nucleus versionnumber)
+        *
+        * @param       void
+        * @return      void
+        */
+       public function parse_version()
+       {
+               global $nucleus;
+               echo 'Nucleus CMS ' . $nucleus['version'];
+               return;
+       }
+       
+       /**
+        * AdminActions::parse_sitevar()
+        * Parse skinvar sitevar
+        * (include a sitevar)
+        *
+        * @param       string  $which
+        * @return      void
+        */
+       public function parse_sitevar($which)
+       {
+               global $CONF;
+               switch ( $which )
+               {
+                       case 'url':
+                               echo $CONF['IndexURL'];
+                               break;
+                       case 'name':
+                               echo $CONF['SiteName'];
+                               break;
+                       case 'admin':
+                               echo $CONF['AdminEmail'];
+                               break;
+                       case 'adminurl':
+                               echo $CONF['AdminURL'];
+               }
+               return;
+       }
+       
+       /**
+        * AdminActions::parse_charset()
+        * Parse skinvar charset
+        *
+        * @param       void
+        * @return      void
+        */
+       public function parse_charset()
+       {
+               echo i18n::get_current_charset();
+               return;
+       }
+       
+       /**
+        * AdminActions::parse_getblogsetting()
+        * Parse skinvar getblogsetting
+        */
+       public function parse_getblogsetting($which)
+       {
+               global $blog, $manager;
+               
+               if ( $blog )
+               {
+                       $b =& $blog;
+               }
+               elseif ( $bid = intRequestVar('blogid') )
+               {
+                       $b = $manager->getBlog($bid);
+               }
+               else
+               {
+                       return;
+               }
+               
+               switch ( $which )
+               {
+                       case 'id':
+                               return Entity::hsc($b->getID());
+                               break;
+                       case 'url':
+                               return Entity::hsc($b->getURL());
+                               break;
+                       case 'name':
+                               return Entity::hsc($b->getName());
+                               break;
+                       case 'desc':
+                               return Entity::hsc($b->getDescription());
+                               break;
+                       case 'short':
+                               return Entity::hsc($b->getShortName());
+                               break;
+                       case 'notifyaddress':
+                               return Entity::hsc($b->getNotifyAddress());
+                               break;
+                       case 'maxcomments':
+                               return Entity::hsc($b->getMaxComments());
+                               break;
+                       case 'updatefile':
+                               return Entity::hsc($b->getUpdateFile());
+                               break;
+                       case 'timeoffset':
+                               return Entity::hsc($b->getTimeOffset());
+                               break;
+               }
+               return;
+       }
+       
+       /**
+        * AdminActions::parse_geteditpluginfo()
+        * Parse skinvar geteditpluginfo
+        * 
+        * @param       string  $type   name of setting for edit plugin info
+        * @return      void
+        */
+       public function parse_geteditpluginfo($type)
+       {
+               $pid = intRequestVar('plugid');
+               switch ( $type )
+               {
+                       case 'id':
+                               return $pid;
+                               break;
+                       case 'name':
+                               return Entity::hsc($manager->getPluginNameFromPid($pid));
+                               break;
+               }
+               return;
+       }
+       
+       /**
+        * AdminActions::parse_getmember()
+        * Parse skinvar getmember
+        * (includes a member info thingie)
+        * 
+        * @param       string  $what   name of setting for member
+        * @return      void
+        */
+       public function parse_getmember($what)
+       {
+               global $memberinfo, $member;
+               // 1. only allow the member-details-page specific variables on member pages
+               if ( $this->skintype == 'member' )
+               {
+                       switch ( $what )
+                       {
+                               case 'name':
+                                       return Entity::hsc($memberinfo->getDisplayName());
+                                       break;
+                               case 'realname':
+                                       return Entity::hsc($memberinfo->getRealName());
+                                       break;
+                               case 'notes':
+                                       return Entity::hsc($memberinfo->getNotes());
+                                       break;
+                               case 'url':
+                                       return Entity::hsc($memberinfo->getURL());
+                                       break;
+                               case 'email':
+                                       return Entity::hsc($memberinfo->getEmail());
+                                       break;
+                               case 'id':
+                                       return Entity::hsc($memberinfo->getID());
+                                       break;
+                       }
+               }
+               // 2. the next bunch of options is available everywhere, as long as the user is logged in
+               if ( $member->isLoggedIn() )
+               {
+                       switch ( $what )
+                       {
+                               case 'yourname':
+                                       return $member->getDisplayName();
+                                       break;
+                               case 'yourrealname':
+                                       return $member->getRealName();
+                                       break;
+                               case 'yournotes':
+                                       return $member->getNotes();
+                                       break;
+                               case 'yoururl':
+                                       return $member->getURL();
                                        break;
                                case 'youremail':
                                        return $member->getEmail();
@@ -2597,7 +3502,7 @@ class AdminActions extends BaseActions
        }
        
        /**
-        * Actions::parse_headmessage()
+        * AdminActions::parse_headmessage()
         * Parse skinvar headmessage
         * 
         * @param       void
@@ -2605,15 +3510,15 @@ class AdminActions extends BaseActions
         */
        public function parse_headmessage()
        {
-               if ( !empty($this->objAdmin->headMess) )
+               if ( !empty(Admin::$headMess) )
                {
-                       echo '<p>' . _MESSAGE . ': ' . Entity::hsc($this->objAdmin->headMess) . "</p>\n";
+                       echo '<p>' . _MESSAGE . ': ' . Entity::hsc(Admin::$headMess) . "</p>\n";
                }
                return;
        }
        
        /**
-        * Actions::parse_helplink()
+        * AdminActions::parse_helplink()
         * Parse skinvar helplink
         * 
         * @param       string  $topic  name of topic for help
@@ -2621,16 +3526,15 @@ class AdminActions extends BaseActions
         */
        public function parse_helplink($topic = '')
        {
-               if ( empty($topic) )
+               if ( !empty($topic) )
                {
-                       return;
+                       help($topic);
                }
-               help($topic);
                return;
        }
        
        /**
-        * Actions::parse_helpplugname()
+        * AdminActions::parse_helpplugname()
         * Parse skinvar helpplugname
         * 
         * @param       void
@@ -2639,12 +3543,12 @@ class AdminActions extends BaseActions
        public function parse_helpplugname()
        {
                $plugid = intGetVar('plugid');
-               Entity::hsc(getPluginNameFromPid($plugid));
+               Entity::hsc($manager->getPluginNameFromPid($plugid));
                return;
        }
        
        /**
-        * Actions::parse_ilistaddnew()
+        * AdminActions::parse_ilistaddnew()
         * Parse skinvar ilistaddnew
         * 
         * @param       void
@@ -2661,7 +3565,7 @@ class AdminActions extends BaseActions
        }
        
        /**
-        * Actions::parse_importskininfo()
+        * AdminActions::parse_importskininfo()
         * Parse skinvar importskininfo
         * 
         * @param       string  $type   name of information for imported skin
@@ -2701,7 +3605,45 @@ class AdminActions extends BaseActions
        }
        
        /**
-        * Actions::parse_inputyesno()
+        * AdminActions::parse_inputyesno()
+        * Parse skinvar inputyesno
+        * 
+        * some init stuff for all forms
+        * 
+        * @param       void
+        * @return      void
+        */
+       public function parse_init()
+       {
+               global $manager;
+               
+               $item = false;
+               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 = '';
+               }
+               $blog->insertJavaScriptInfo($authorid);
+               return;
+       }
+       
+       /**
+        * AdminActions::parse_inputyesno()
         * Parse skinvar inputyesno
         * 
         * @param       string  $name                   
@@ -2722,12 +3664,12 @@ class AdminActions extends BaseActions
        }
        
        /**
-        * Actions::parse_insertpluginfo()
+        * AdminActions::parse_insertpluginfo()
         * Parse templatevar insertpluginfo
         */
        public function parse_insertpluginfo($type)
        {
-               $option = $this->objAdmin;
+               $option = Admin::getAdminaOption();
                switch ( $type )
                {
                        case 'id':
@@ -2741,7 +3683,7 @@ class AdminActions extends BaseActions
        }
        
        /**
-        * Actions::parse_insertpluginoptions()
+        * AdminActions::parse_insertpluginoptions()
         * Parse skinvar insertpluginoptions
         * 
         * @param       string  $templateName   name of template
@@ -2749,7 +3691,7 @@ class AdminActions extends BaseActions
         */
        public function parse_insertpluginoptions($templateName = '')
        {
-               $options        = $this->objAdmin->aOptions;
+               $options        = Admin::getAdminaOption();
                $template       = array();
                $templats       = array();
                
@@ -2757,36 +3699,47 @@ class AdminActions extends BaseActions
                {
                        $templates = Template::read($templateName);
                }
-               if (array_key_exists('INSERT_PLUGOPTION_TITLE', $templates) && !empty($templates['INSERT_PLUGOPTION_TITLE']) )
+               
+               if ( !array_key_exists('INSERT_PLUGOPTION_TITLE', $templates) || empty($templates['INSERT_PLUGOPTION_TITLE']) )
                {
-                       $template['title'] = $templates['INSERT_PLUGOPTION_TITLE'];
+                       $template['title'] = "<tr>"
+                                          . "<th colspan=\"2\"><%sprinttext(_PLUGIN_OPTIONS_TITLE, <|%insertpluginfo(name)%|>)%></th>"
+                                          . "</tr>\n";
                }
                else
                {
-                       $template['title'] = '<tr><th colspan="2"><%sprinttext(_PLUGIN_OPTIONS_TITLE, <|%insertpluginfo(name)%|>)%></th></tr>' . "\n";
+                       $template['title'] = $templates['INSERT_PLUGOPTION_TITLE'];
                }
-               if ( array_key_exists('INSERT_PLUGOPTION_BODY', $templates) && !empty($templates['INSERT_PLUGOPTION_BODY']) )
+               
+               if ( !array_key_exists('INSERT_PLUGOPTION_BODY', $templates) || empty($templates['INSERT_PLUGOPTION_BODY']) )
                {
-                       $template['body'] = $templates['INSERT_PLUGOPTION_BODY'];
+                       $template['body'] = "<tr>"
+                                         . "<%listplugplugoptionrow%>"
+                                         . "</tr>\n";
                }
                else
                {
-                       $template['body'] = '<tr><%listplugplugoptionrow%></tr>' . "\n";
+                       $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 )
                {
-                       $handler = new Actions($this->skintype, $template, $option);
-                       $parser  = new PARSER(Actions::getDefinedActions(), $handler);
+                       
                        // 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']);
@@ -2796,7 +3749,7 @@ class AdminActions extends BaseActions
        }
        
        /**
-        * Actions::parse_insplugoptcontent()
+        * AdminActions::parse_insplugoptcontent()
         * Parse skinvar insplugoptcontent
         * 
         * @param       void
@@ -2804,10 +3757,10 @@ class AdminActions extends BaseActions
         */
        public function parse_insplugoptcontent()
        {
-               $option = $this->objAdmin->aOption;
+               $option = Admin::getAdminaOption();
                
-               $meta   = NucleusPlugin::getOptionMeta($option['typeinfo']);
-               if (array_key_exists('access', $meta) && $meta['access'] != 'hidden')
+               $meta = NucleusPlugin::getOptionMeta($option['typeinfo']);
+               if ( array_key_exists('access', $meta) && $meta['access'] != 'hidden' )
                {
                        echo '<tr>';
                        listplug_plugOptionRow($option);
@@ -2817,7 +3770,7 @@ class AdminActions extends BaseActions
        }
        
        /**
-        * Actions::parse_iprangeinput()
+        * AdminActions::parse_iprangeinput()
         * Parse skinvar iprangeinput
         * 
         * @param       void
@@ -2828,11 +3781,11 @@ class AdminActions extends BaseActions
                if ( requestVar('ip') )
                {
                        $iprangeVal = Entity::hsc(requestVar('ip'));
-                       echo '<input name="iprange" type="radio" value="' . $iprangeVal . '" checked="checked" id="ip_fixed" />' . "\n";
-                       echo '<label for="ip_fixed">' . $iprangeVal . "</label><br />\n";
+                       echo "<input name=\"iprange\" type=\"radio\" value=\"{$iprangeVal}\" checked=\"checked\" id=\"ip_fixed\" />\n";
+                       echo "<label for=\"ip_fixed\">{$iprangeVal}</label><br />\n";
                        echo '<input name="iprange" type="radio" value="custom" id="ip_custom" />' . "\n";
                        echo '<label for="ip_custom">' . _BAN_IP_CUSTOM . '</label>' . "\n";
-                       echo '<input name="customiprange" value="' . $iprangeVal . '" maxlength="15" size="15" />' . "\n";
+                       echo "<input name=\"customiprange\" value=\"{$iprangeVal}\" maxlength=\"15\" size=\"15\" />\n";
                }
                else
                {
@@ -2843,62 +3796,49 @@ class AdminActions extends BaseActions
        }
        
        /**
-        * Actions::parse_itemnavlist()
+        * AdminActions::parse_itemnavlist()
         * Parse skinvar itemnavlist
         * 
         * @param       void
         * @return      void
         */
-       public function parse_itemnavlist()
+       public function parse_itemnavlist($templateName)
        {
                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"
-                       . " 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) )
                        {
-                               $query .= ' and iauthor = ' . $member->getID();
+                               $query .= ' AND iauthor = ' . $member->getID();
                        }
                }
                elseif ( $this->skintype == 'browseownitems' )
                {
-                       $query .= 'and iauthor   = ' . $member->getID();
+                       $query .= ' AND iauthor   = ' . $member->getID();
                        $blogid = 0;
                        $template['now'] = time();
                }
@@ -2908,28 +3848,93 @@ 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);
+               $navList->showBatchList('item', $query, 'table', $template, '', $templateName);
                return;
        }
        
        /**
-        * Actions::parse_jstoolbaroptions()
-        * Parse skinvar jstoolbaroptions
+        * AdminActions::parse_itemtime()
+        * date change on edit item
         * 
-        * @param       void
+        * @param       string  $key    key of PHP's getDate()
         * @return      void
         */
-       public function parse_jstoolbaroptions()
+       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);
+               }
+               $itemtime = getdate($contents['timestamp']);
+               echo $itemtime[$key];
+               return;
+       }
+       
+       /**
+        * AdminActions::parse_jstoolbaroptions()
+        * Parse skinvar jstoolbaroptions
+        * 
+        * @param       void
+        * @return      void
+        */
+       public function parse_jstoolbaroptions()
        {
                global $CONF;
                $options = array(
@@ -2937,6 +3942,7 @@ class AdminActions extends BaseActions
                        _SETTINGS_JSTOOLBAR_SIMPLE,
                        _SETTINGS_JSTOOLBAR_FULL
                );
+               
                $i = 1;
                foreach ( $options as $option )
                {
@@ -2947,9 +3953,8 @@ class AdminActions extends BaseActions
                }
                return;
        }
-       
        /**
-        * Actions::parse_localeselectoptions()
+        * AdminActions::parse_localeselectoptions()
         * Parse skinvar localeselectoptions
         * 
         * @param       void
@@ -2958,7 +3963,8 @@ class AdminActions extends BaseActions
        public function parse_localeselectoptions()
        {
                $locales = i18n::get_available_locale_list();
-               $memid   = intRequestVar('memberid');
+               
+               $memid = intRequestVar('memberid');
                if ( $memid )
                {
                        $mem = MEMBER::createFromID($memid);
@@ -2977,10 +3983,18 @@ class AdminActions extends BaseActions
                        {
                                echo "<option value=\"\" selected=\"selected\">en_Latn_US</option>\n";
                        }
+                       else
+                       {
+                               echo "<option value=\"\">en_Latn_US</option>\n";
+                       }
                }
                foreach ( $locales as $locale )
                {
-                       if ($memid)
+                       if ( $locale == 'en_Latn_US' )
+                       {
+                               continue;
+                       }
+                       else if ($memid)
                        {
                                if ( $locale == $mem->getLocale() )
                                {
@@ -3007,7 +4021,7 @@ class AdminActions extends BaseActions
        }
        
        /**
-        * Actions::parse_listplugplugoptionrow()
+        * AdminActions::parse_listplugplugoptionrow()
         * Parse templatevar listplugplugoptionrow
         * 
         * @param       string  $templateName   name of template
@@ -3015,13 +4029,12 @@ class AdminActions extends BaseActions
         */
        public function parse_listplugplugoptionrow($templateName = '')
        {
-               $option = $this->objAdmin;
-               echo listplug_plugOptionRow($option, $templateName);
+               echo listplug_plugOptionRow(Admin::getAdminaOption(), $templateName);
                return;
        }
        
        /**
-        * Actions::parse_mediadirwarning()
+        * AdminActions::parse_mediadirwarning()
         * Parse skinvar mediadirwarning
         * 
         * @param       void
@@ -3046,7 +4059,7 @@ class AdminActions extends BaseActions
        }
        
        /**
-        * Actions::parse_movedistselect()
+        * AdminActions::parse_movedistselect()
         * Parse skinvar movedistselect
         */
        public function parse_movedistselect()
@@ -3055,18 +4068,18 @@ class AdminActions extends BaseActions
                switch ( $actionType )
                {
                        case 'batchitem':
-                               $this->objAdmin->selectBlogCategory('destcatid');
+                               Admin::selectBlogCategory('destcatid');
                                break;
                        case 'batchcategory':
-                               $this->objAdmin->selectBlog('destblogid');
+                               Admin::selectBlog('destblogid');
                                break;
                        default:
                                if ( $this->skintype == 'itemmove' )
                                {
                                        $query  = "SELECT icat as result FROM %s WHERE inumber=%d;";
-                                       $query = spriintf($query, sql_table('item'), intRequestVar('itemid'));
-                                       $catid  = quickQuery(sprintf($query, intRequestVar('itemid')));
-                                       $this->objAdmin->selectBlogCategory('catid', $catid, 10, 1);
+                                       $query = sprintf($query, sql_table('item'), intRequestVar('itemid'));
+                                       $catid  = DB::getValue(sprintf($query, intRequestVar('itemid')));
+                                       Admin::selectBlogCategory('catid', $catid, 10, 1);
                                }
                                break;
                }
@@ -3074,7 +4087,7 @@ class AdminActions extends BaseActions
        }
        
        /**
-        * Actions::parse_moveitemid()
+        * AdminActions::parse_moveitemid()
         * Parse skinvar moveitemid
         * 
         * @param       void
@@ -3087,7 +4100,7 @@ class AdminActions extends BaseActions
        }
        
        /**
-        * Actions::parse_newestcompare()
+        * AdminActions::parse_newestcompare()
         * Parse skinvar newestcompare
         * 
         * @param       void
@@ -3096,9 +4109,11 @@ class AdminActions extends BaseActions
        public function parse_newestcompare()
        {
                global $nucleus;
+               
                $newestVersion  = getLatestVersion();
                $newestCompare  = str_replace('/', '.', $newestVersion);
                $currentVersion = str_replace(array('/', 'v'), array('.', ''), $nucleus['version']);
+               
                if ( $newestVersion && version_compare($newestCompare, $currentVersion, '>') )
                {
                        echo '<br /><a style="color:red" href="http://nucleuscms.org/upgrade.php" title="' . _ADMIN_SYSTEMOVERVIEW_LATESTVERSION_TITLE . '">';
@@ -3108,7 +4123,7 @@ class AdminActions extends BaseActions
        }
        
        /**
-        * Actions::parse_newmemberselect()
+        * AdminActions::parse_newmemberselect()
         * Parse skinvar newmemberselect
         * 
         * @param       string  $templateName   name of template to use
@@ -3118,27 +4133,30 @@ class AdminActions extends BaseActions
        {
                $blogid = intRequestVar('blogid');
                
-               $query  = "SELECT tmember FROM %s WHERE tblog=%d;";
+               $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;
+               $template = array(
+                                       'name'          => 'memberid',
+                                       'tabindex'      => 10000,
+                                       'selected'      => 0
+                               );
                Showlist($query, 'select', $template, $templateName);
                return;
        }
        
        /**
-        * Actions::parse_newpluginlist()
+        * AdminActions::parse_newpluginlist()
         * Parse skinvar newpluginlist
         * 
         * @param       void
@@ -3155,7 +4173,7 @@ class AdminActions extends BaseActions
        }
        
        /**
-        * Actions::parse_outputspecialdirs()
+        * AdminActions::parse_outputspecialdirs()
         * Parse skinvar outputspecialdirs
         * 
         * @param       string  $type   type of setting for directory
@@ -3163,14 +4181,14 @@ class AdminActions extends BaseActions
         */
        public function parse_outputspecialdirs($type)
        {
+               global $DIR_MEDIA, $DIR_NUCLEUS;
+               
                switch ( $type )
                {
                        case 'nucleusdir':
-                               global $DIR_NUCLEUS;
                                echo Entity::hsc($DIR_NUCLEUS);
                                break;
                        case 'mediadir':
-                               global $DIR_MEDIA;
                                echo Entity::hsc($DIR_MEDIA);
                                break;
                }
@@ -3178,7 +4196,7 @@ class AdminActions extends BaseActions
        }
        
        /**
-        * Actions::parse_passrequestvars()
+        * AdminActions::parse_passrequestvars()
         * Parse skinvar passrequestvars
         * 
         * @param       void
@@ -3186,10 +4204,12 @@ class AdminActions extends BaseActions
         */
        public function parse_passrequestvars()
        {
+               $passvar   = Admin::getAdminpassvar();
                $oldaction = postVar('oldaction');
+               
                if ( ($oldaction != 'logout')
                  && ($oldaction != 'login')
-                 && $this->objAdmin->passvar
+                 && $passvar
                  && !postVar('customaction') )
                {
                        passRequestVars();
@@ -3198,7 +4218,7 @@ class AdminActions extends BaseActions
        }
        
        /**
-        * Actions::parse_pluginextras()
+        * AdminActions::parse_pluginextras()
         * Parse skinvar pluginextras
         * 
         * @param       string  $type   type of plugin context
@@ -3212,22 +4232,12 @@ class AdminActions extends BaseActions
                        case 'member':
                                $id  = intRequestVar('memberid');
                                $mem = MEMBER::createFromID($id);
-                               $manager->notify(
-                                       'MemberSettingsFormExtras',
-                                       array(
-                                               'member' => &$mem
-                                       )
-                               );
+                               $manager->notify('MemberSettingsFormExtras', array('member' => &$mem));
                                break;
                        case 'blog':
                                $id  = intRequestVar('blogid');
                                $blg = $manager->getBlog($id);
-                               $manager->notify(
-                                       'BlogSettingsFormExtras',
-                                       array(
-                                               'member' => &$blg
-                                       )
-                               );
+                               $manager->notify('BlogSettingsFormExtras', array('member' => &$blg));
                                break;
                        default:
                                $manager->notify(
@@ -3241,7 +4251,7 @@ class AdminActions extends BaseActions
        }
        
        /**
-        * Actions::parse_pluginhelp()
+        * AdminActions::parse_pluginhelp()
         * Parse skinvar pluginhelp
         * 
         * @param       void
@@ -3250,8 +4260,9 @@ class AdminActions extends BaseActions
        public function parse_pluginhelp()
        {
                global $manager, $DIR_PLUGINS;
+               
                $plugid = intGetVar('plugid');
-               $plugName =  getPluginNameFromPid($plugid);
+               $plugName = $manager->getPluginNameFromPid($plugid);
                $plug =& $manager->getPlugin($plugName);
                
                if ( $plug->supportsFeature('HelpPage') > 0 )
@@ -3274,7 +4285,7 @@ class AdminActions extends BaseActions
        }
        
        /**
-        * Actions::parse_pluginlistlist()
+        * AdminActions::parse_pluginlistlist()
         * Parse skinvar pluginlistlist
         * 
         * @param       string  $templateName   name of template to use
@@ -3282,41 +4293,100 @@ class AdminActions extends BaseActions
         */
        public function parse_pluginlistlist($templateName = '')
        {
-               $query  = "SELECT * FROM %s ORDER BY porder ASC;";
+               $query = "SELECT * FROM %s ORDER BY porder ASC;";
                $query = sprintf($query, sql_table('plugin'));
+               
                $template['content']  = 'pluginlist';
                $template['tabindex'] = 10;
+               
                Showlist($query, 'table', $template, $templateName);
+               
                return;
        }
        
        /**
-        * Actions::parse_pluginoptions()
+        * 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')
        {
-               switch ( $type )
+               global $itemid, $manager;
+               
+               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':
+                               $contextid = $itemid;
+                               break;
+               }
+               
+               /* 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'                 => ''
+                       );
                }
-               $this->objAdmin->_insertPluginOptions($type, $id);
+               
+               $data = array(
+                       'context'       =>  $context,
+                       'contextid'     =>  $contextid,
+                       'options'       => &$opt4ions
+               );
+               $manager->notify('PrePluginOptionsEdit', $data);
+               
+               $content = $this->parser->skin->getContentFromDB('insertpluginoptions');
+               $this->parser->parse($content);
+               
                return;
        }
        
        /**
-        * Actions::parse_qmenuaddselect()
+        * AdminActions::parse_qmenuaddselect()
         * Parse skinvar qmanuaddselect
         * 
         * @param       string  $templateName   name of template to use
@@ -3340,19 +4410,22 @@ class AdminActions extends BaseActions
                               . ' WHERE tblog=bnumber and tmember=' . $member->getID()
                               . ' ORDER BY bname';
                }
-               $template['name']          = 'blogid';
-               $template['tabindex']   = 15000;
-               $template['extra']        = _QMENU_ADD_SELECT;
-               $template['selected']   = -1;
+               
+               $template['name']               = 'blogid';
+               $template['tabindex']   = 15000;
+               $template['extra']              = _QMENU_ADD_SELECT;
+               $template['selected']   = -1;
                $template['shorten']    = 10;
-               $template['shortenel']  = '';
-               $template['javascript'] = 'onchange="return form.submit()"';
+               $template['shortenel']  = '';
+               $template['javascript'] = 'onchange="return form.submit()"';
+               
                Showlist($query, 'select', $template, $templateName);
+               
                return;
        }
 
        /**
-        * Actions::parse_quickmenu()
+        * AdminActions::parse_quickmenu()
         * Parse skinvar quickmenu
         * 
         * @param       string  $templateName   name of template to use
@@ -3376,38 +4449,44 @@ class AdminActions extends BaseActions
                );
                if ( count($pluginExtras) > 0 )
                {
-                       if ( array_key_exists('PLUGIN_QUICKMENU_TITLE', $templates) || !empty($templates['PLUGIN_QUICKMENU_TITLE']) )
+                       if ( !array_key_exists('PLUGIN_QUICKMENU_TITLE', $templates) || empty($templates['PLUGIN_QUICKMENU_TITLE']) )
                        {
-                               $template['title'] = $templates['PLUGIN_QUICKMENU_TITLE'];
+                               $template['title'] = "<h2><%text(_QMENU_PLUGINS)%></h2>\n";
                        }
                        else
                        {
-                               $template['title'] = '<h2><%text(_QMENU_PLUGINS)%></h2>';
+                               $template['title'] = $templates['PLUGIN_QUICKMENU_TITLE'];
                        }
-                       $handler = new Actions($this->skintype, $template, $this->objAdmin);
-                       $parser  = new PARSER(Actions::getDefinedActions(), $handler);
-                       $parser->parse($template['title']);
-                       
-                       if ( array_key_exists('PLUGIN_QUICKMENU_HEAD', $templates) || !empty($templates['PLUGIN_QUICKMENU_HEAD']) )
+                       if ( !array_key_exists('PLUGIN_QUICKMENU_HEAD', $templates) || empty($templates['PLUGIN_QUICKMENU_HEAD']) )
                        {
-                               $template['head'] = $templates['PLUGIN_QUICKMENU_HEAD'];
+                               $template['head'] = "<ul>\n";
                        }
                        else
                        {
-                               $template['head'] = '<ul>';
+                               $template['head'] = $templates['PLUGIN_QUICKMENU_HEAD'];
                        }
-                       
-                       echo $template['head'];
-                       
-                       if ( array_key_exists('PLUGIN_QUICKMENU_BODY', $templates) || !empty($templates['PLUGIN_QUICKMENU_BODY']) )
+                       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";
+                       }
+                       else
                        {
                                $template['body'] = $templates['PLUGIN_QUICKMENU_BODY'];
                        }
+                       if ( !array_key_exists('PLUGIN_QUICKMENU_FOOT', $templates) || empty($templates['PLUGIN_QUICKMENU_FOOT']) )
+                       {
+                               $template['foot'] = "</ul>\n";
+                       }
                        else
                        {
-                               $template['body'] = '<li><a href="<%plugadminurl%>" title="<%plugadmintooltip%>"><%plugadmintitle%></a></li>';
+                               $template['foot'] = $templates['PLUGIN_QUICKMENU_FOOT'];
                        }
                        
+                       $handler = new Actions($this->skintype);
+                       $parser = new PARSER($handler);
+                       
+                       $parser->parse($template['title']);
+                       echo $template['head'];
                        foreach ( $pluginExtras as $aInfo )
                        {
                                $data = array(
@@ -3415,15 +4494,7 @@ class AdminActions extends BaseActions
                                        'plugadmintooltip'      => Entity::hsc($aInfo['tooltip']),
                                        'plugadmintitle'        => Entity::hsc($aInfo['title']),
                                );
-                               echo TEMPLATE::fill($template['body'], $data);
-                       }
-                       if ( array_key_exists('PLUGIN_QUICKMENU_FOOT', $templates) || !empty($templates['PLUGIN_QUICKMENU_FOOT']) )
-                       {
-                               $template['foot'] = $templates['PLUGIN_QUICKMENU_FOOT'];
-                       }
-                       else
-                       {
-                               $template['foot'] = '</ul>';
+                               echo Template::fill($template['body'], $data);
                        }
                        echo $template['foot'];
                }
@@ -3431,7 +4502,7 @@ class AdminActions extends BaseActions
        }
        
        /**
-        * Actions::parse_requestblogid()
+        * AdminActions::parse_requestblogid()
         * Parse skinvar requestblogid
         * 
         * @param       void
@@ -3444,7 +4515,7 @@ class AdminActions extends BaseActions
        }
        
        /**
-        * Actions::parse_requestiprange()
+        * AdminActions::parse_requestiprange()
         * Parse skinvar requestiprange
         * 
         * @param       void
@@ -3464,7 +4535,7 @@ class AdminActions extends BaseActions
        }
        
        /**
-        * Actions::parse_selectlocaladminskinfiles()
+        * AdminActions::parse_selectlocaladminskinfiles()
         * Parse skinvar selectlocaladminskinfiles
         * 
         * @param       void
@@ -3472,18 +4543,22 @@ class AdminActions extends BaseActions
         */
        public function parse_selectlocaladminskinfiles()
        {
-               global $DIR_ADMINSKINS, $manager;
-               $candidates = SkinImport::searchForCandidates($DIR_ADMINSKINS);
+               global $DIR_SKINS, $manager;
+               
+               $adminskindir = $DIR_SKINS . 'admin/';
+               $candidates = SkinImport::searchForCandidates($adminskindir);
+               
                foreach ( $candidates as $skinname => $skinfile )
                {
-                       $html = Entit::hsc($skinfile);
+                       $html = Entity::hsc($skinfile);
                        echo '<option value="' . $html . '">' . $skinname . "</option>\n";
                }
+               
                return;
        }
        
        /**
-        * Actions::parse_selectlocalskinfiles()
+        * AdminActions::parse_selectlocalskinfiles()
         * Parse skinvar selectlocalskinfiles
         * 
         * @param       void
@@ -3492,17 +4567,20 @@ class AdminActions extends BaseActions
        public function parse_selectlocalskinfiles()
        {
                global $DIR_SKINS;
+               
                $candidates = SkinImport::searchForCandidates($DIR_SKINS);
+               
                foreach ( $candidates as $skinname => $skinfile )
                {
                        $html = Entity::hsc($skinfile);
                        echo '<option value="' . $html . '">' . $skinname . "</option>\n";
                }
+               
                return;
        }
        
        /**
-        * Actions::parse_skineditallowedlist()
+        * AdminActions::parse_skineditallowedlist()
         * Parse skinvar skineditallowedlist
         * 
         * @param       string  $type                   type of skin
@@ -3514,7 +4592,7 @@ class AdminActions extends BaseActions
                switch ( $type )
                {
                        case 'blog':
-                               $query = "SELECT bshortname, bname FROM %s";
+                               $query = "SELECT bshortname, bname FROM %s;";
                                $show  = array(
                                        'content' => 'shortblognames'
                                );
@@ -3522,7 +4600,7 @@ class AdminActions extends BaseActions
                                Showlist($query, 'table', $show, $templateName);
                                break;
                        case 'template':
-                               $query = "SELECT tdname as name, tddesc as description FROM %s";
+                               $query = "SELECT tdname as name, tddesc as description FROM %s WHERE tdname NOT LIKE 'admin/%%';";
                                $show  = array(
                                        'content' => 'shortnames'
                                );
@@ -3534,29 +4612,7 @@ class AdminActions extends BaseActions
        }
        
        /**
-        * Actions::parse_skinfile()
-        * Inserts an url relative to the skindir (useful when doing import/export)
-        *
-        * e.g. <skinfile(default/myfile.sth)>
-        * 
-        * @param       string  $filename       file name for skin
-        * @return      void
-        */
-       public function parse_skinfile($filename)
-       {
-               /*
-                * TODO: we should decide to use different directory or default $DIR_SKINS
-               $base = NP_SkinableAdmin::getAdminSkinURL();
-               $pref = PARSER::getProperty('IncludePrefix');
-               echo $base . $pref . $filename;
-                */
-               $pref = PARSER::getProperty('IncludePrefix');
-               echo $pref . $filename;
-               return;
-       }
-       
-       /**
-        * Actions::parse_skinielist()
+        * AdminActions::parse_skinielist()
         * Parse skinvar skinielist
         * 
         * @param       string  $type                   type of skin
@@ -3576,35 +4632,40 @@ class AdminActions extends BaseActions
                }
                else
                {
-                       $template = '<td><input type="checkbox" name="<%typeid%>"  id="<%expid%>" /><label for="<%expid%>"><%expname%></label></td>' . "\n"
-                                         . "<td><%expdesc%></td>\n"
-                                         . "</tr><tr>\n";
+                       $template = "<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";
                }
                switch ( $type )
                {
                        case 'skin':
-                               $res = sql_query('SELECT * FROM ' . sql_table('skin_desc'));
-                               while ( $skinObj = sql_fetch_object($res) )
+                               $res = DB::getResult('SELECT * FROM ' . sql_table('skin_desc'));
+                               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);
+                                       echo Template::fill($template, $data);
                                }
                                break;
                        case 'template':
-                               $res = sql_query('SELECT * FROM '.sql_table('template_desc'));
-                               while ($templateObj = sql_fetch_object($res)) {
+                               $res = DB::getResult('SELECT * FROM '.sql_table('template_desc'). " WHERE tdname NOT 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);
+                                       echo Template::fill($template, $data);
                                }
                                break;
                }
@@ -3612,7 +4673,7 @@ class AdminActions extends BaseActions
        }
        
        /**
-        * Actions::parse_skinoverview()
+        * AdminActions::parse_skinoverview()
         * Parse skinvar skinoverview
         * 
         * @param       string  $templateName   name of template to use
@@ -3620,7 +4681,8 @@ class AdminActions extends BaseActions
         */
        public function parse_skinoverview($templateName = '')
        {
-               $query  = "SELECT * FROM %s ORDER BY sdname";
+               global $CONF;
+               $query = "SELECT * FROM %s WHERE sdname NOT LIKE 'admin/%%';";
                $query = sprintf($query, sql_table('skin_desc'));
                
                $template['content']  = 'skinlist';
@@ -3631,7 +4693,7 @@ class AdminActions extends BaseActions
        }
        
        /**
-        * Actions::parse_skintypehelp()
+        * AdminActions::parse_skintypehelp()
         * Check editing skintypehelp
         * 
         * @param       void
@@ -3640,6 +4702,8 @@ class AdminActions extends BaseActions
        public function parse_skintypehelp()
        {
                $nowSkinType = strtolower(trim(requestVar('type')));
+               
+               /* TODO: use Skin class */
                $regularType = array(
                        'index',
                        'item',
@@ -3663,7 +4727,7 @@ class AdminActions extends BaseActions
        }
        
        /**
-        * Actions::parse_specialskinlist()
+        * AdminActions::parse_specialskinlist()
         * Parse skinvar specialskinlist
         * 
         * @param       string  $templateName   name of template to use
@@ -3676,6 +4740,8 @@ class AdminActions extends BaseActions
                {
                        $templates = Template::read($templateName);
                }
+               
+               /* TODO: use Skin class */
                $nType  = array(
                        'index',
                        'item',
@@ -3690,8 +4756,8 @@ class AdminActions extends BaseActions
                $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 )
+               $res    = DB::getResult($query);
+               if ( $res && $res->rowCount() > 0 )
                {
                        $data = array();
                        if ( array_key_exists('SPECIALSKINLIST_HEAD', $templates) && !empty($templates['SPECIALSKINLIST_HEAD']) )
@@ -3702,26 +4768,27 @@ class AdminActions extends BaseActions
                        {
                                $template['head'] = "<ul>\n";
                        }
-                       echo TEMPLATE::fill($template['head'], $data);
-                       if ( array_key_exists('SPECIALSKINLIST_BODY', $templates) && !empty($templates['SPECIALSKINLIST_BODY']) )
-                       {
-                               $template['body'] = $templates['SPECIALSKINLIST_BODY'];
-                       }
-                       else
+                       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) )
+                       foreach ( $res as $row )
                        {
                                $data = array(
-                                       'tabindex' => $tabstart++,
-                                       'skinid'   => $skinid,
-                                       'skintype' => Entity::hsc(strtolower($row['stype']))
+                                       'tabindex'      => $tabstart++,
+                                       'skinid'        => $skinid,
+                                       'skintype'      => Entity::hsc(strtolower($row['stype']))
                                );
-                               echo TEMPLATE::fill($template['body'], $data);
+                               echo Template::fill($template['body'], $data);
                        }
                        $data = array();
                        if (array_key_exists('SPECIALSKINLIST_FOOT', $templates) && !empty($templates['SPECIALSKINLIST_FOOT']) )
@@ -3732,13 +4799,13 @@ class AdminActions extends BaseActions
                        {
                                $template['foot'] = "</ul>\n";
                        }
-                       echo TEMPLATE::fill($template['foot'], $data);
+                       echo Template::fill($template['foot'], $data);
                        return;
                }
        }
        
        /**
-        * Actions::parse_sprinttext()
+        * AdminActions::parse_sprinttext()
         * Parse sprinttext
         * 
         * @param       string  $which  
@@ -3783,7 +4850,7 @@ class AdminActions extends BaseActions
        }
        
        /**
-        * Actions::parse_systemsettings()
+        * AdminActions::parse_systemsettings()
         * Parse skinvar systemsettings
         * 
         * @param       string  $type                   type of settings for system
@@ -3794,7 +4861,7 @@ class AdminActions extends BaseActions
        {
                global $member, $CONF, $nucleus;
                
-               $member->isAdmin() or $this->objAdmin->disallow();
+               $member->isAdmin() or Admin::disallow();
                
                $enable  = _ADMIN_SYSTEMOVERVIEW_ENABLE;
                $disable = _ADMIN_SYSTEMOVERVIEW_DISABLE;
@@ -3805,10 +4872,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';
@@ -3825,13 +4892,16 @@ class AdminActions extends BaseActions
                                {
                                        $templates = Template::read($templateName);
                                }
-                               if ( array_key_exists('SYSTEMINFO_GDSETTINGS', $templates) && !empty($templates['SYSTEMINFO_GDSETTINGS']) )
+                               if ( !array_key_exists('SYSTEMINFO_GDSETTINGS', $templates) || empty($templates['SYSTEMINFO_GDSETTINGS']) )
                                {
-                                       $template = $templates['SYSTEMINFO_GDSETTINGS'];
+                                       $template = "<tr>\n"
+                                                 . "<td><%key%></td>\n"
+                                                 . "<td><%value%></td>\n"
+                                                 . "</tr>\n";
                                }
                                else
                                {
-                                       $template = "<tr>\n\t\t" . '<td width="50%">' . "<%key%></td><td><%value%></td>\n</tr>\n";
+                                       $template = $templates['SYSTEMINFO_GDSETTINGS'];
                                }
                                
                                $gdinfo = gd_info();
@@ -3850,7 +4920,7 @@ class AdminActions extends BaseActions
                                                'key'   => $key,
                                                'value' => $value,
                                        );
-                                       echo TEMPLATE::fill($template, $data);
+                                       echo Template::fill($template, $data);
                                }
                                break;
                        case 'modrewrite':
@@ -3858,7 +4928,7 @@ class AdminActions extends BaseActions
                                phpinfo(INFO_MODULES);
                                $im = ob_get_contents();
                                ob_end_clean();
-                               echo (strstr($im, 'mod_rewrite') != '') ? $enable : $disable;
+                               echo ( i18n::strpos($im, 'mod_rewrite') !== FALSE ) ? $enable : $disable;
                                break;
                        case 'nucleusversion':
                                echo getNucleusVersion() / 100 . '(' . $nucleus['version'] . ')';
@@ -3889,7 +4959,7 @@ class AdminActions extends BaseActions
        }
        
        /**
-        * Actions::parse_templateoverview()
+        * AdminActions::parse_templateoverview()
         * Parse skinvar templateoverview
         * 
         * @param       string  $templateName   name of template to use
@@ -3897,11 +4967,14 @@ class AdminActions extends BaseActions
         */
        public function parse_templateoverview($templateName = '')
        {
-               $query  = "SELECT * FROM %s ORDER BY tdname";
+               $query  = "SELECT * FROM %s WHERE tdname NOT LIKE 'admin/%%' ORDER BY tdname";
                $query = sprintf($query, sql_table('template_desc'));
+               
                $template['content']  = 'templatelist';
                $template['tabindex'] = 10;
+               
                Showlist($query, 'table', $template, $templateName);
+               
                return;
        }
        
@@ -3920,7 +4993,7 @@ class AdminActions extends BaseActions
        }
        
        /**
-        * Actions::parse_versioncheckurl()
+        * AdminActions::parse_versioncheckurl()
         * Parse skinvar versioncheckurl
         * 
         * @param       void
@@ -3933,7 +5006,7 @@ class AdminActions extends BaseActions
        }
        
        /**
-        * Actions::parse_yrbloglist()
+        * AdminActions::parse_yrbloglist()
         * Parse skinvar yrbloglist
         * 
         * @param       string  $templateName   name of template to use
@@ -3949,7 +5022,7 @@ 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";
+                               . " ORDER BY bnumber;";
                        $query = sprintf($query, sql_table('blog'));
                }
                else
@@ -3957,7 +5030,7 @@ class AdminActions extends BaseActions
                        $query =  "SELECT bnumber, bname, tadmin, burl, bshortname"
                                . " FROM %s,%s"
                                . " WHERE tblog=bnumber and tmember=%d"
-                               . " ORDER BY bnumber";
+                               . " ORDER BY bnumber;";
                        $query = sprintf($query, sql_table('blog'), sql_table('team'), (integer) $member->getID());
                }
                
@@ -3970,7 +5043,7 @@ class AdminActions extends BaseActions
                {
                        $query = 'SELECT COUNT(*) as result FROM ' . sql_table('blog');
                        
-                       $total = quickQuery($query);
+                       $total = DB::getValue($query);
                        if ( $total > $amount )
                        {
                                echo '<p><a href="index.php?action=overview&amp;showall=yes">' . _OVERVIEW_SHOWALL . '</a></p>';
@@ -3987,8 +5060,8 @@ class AdminActions extends BaseActions
                        
                        $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());
+                              . ' WHERE iauthor=%d AND iblog=bnumber AND idraft=1;';
+                       $query = sprintf($query, sql_table('item'), sql_table('blog'), (integer) $member->getID());
                        
                        $template['content'] = 'draftlist';
                        
@@ -4002,62 +5075,534 @@ class AdminActions extends BaseActions
        }
        
        /**
-        * Actions::customHelp()
-        * shows a link to custom help file
+        * AdminActions::checkCondition()
+        * Checks conditions for if statements
+        *
+        * @param       string  $field type of <%if%>
+        * @param       string  $name property of field
+        * @param       string  $value value of property
+        * @return      boolean condition
+        */
+       protected function checkCondition($field, $name='', $value = '')
+       {
+               global $CONF, $catid, $blog, $member, $itemidnext, $itemidprev, $manager, $archiveprevexists, $archivenextexists;
+               
+               $condition = 0;
+               switch ( $field )
+               {
+                       case 'category':
+                               if ( !$blog )
+                               {
+                                       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
+                                       {
+                                               return;
+                                       }
+                               }
+                               $condition = ($blog && $this->ifCategory($name, $value));
+                               break;
+                       case 'blogsetting':
+                               $condition = ($blog && ($blog->getSetting($name) == $value));
+                               break;
+                       case 'loggedin':
+                               $condition = $member->isLoggedIn();
+                               break;
+                       case 'onteam':
+                               $condition = $member->isLoggedIn() && $this->ifOnTeam($name);
+                               break;
+                       case 'admin':
+                               $condition = $member->isLoggedIn() && $this->ifAdmin($name);
+                               break;
+                       case 'superadmin':
+                               $condition = $member->isLoggedIn() && $member->isAdmin();
+                               break;
+                       case 'allowloginedit':
+                               $condition = $member->isLoggedIn() && ($CONF['AllowLoginEdit'] || $member->isAdmin());
+                               break;
+                       case 'nextitem':
+                               $condition = ($itemidnext != '');
+                               break;
+                       case 'previtem':
+                               $condition = ($itemidprev != '');
+                               break;
+                       case 'archiveprevexists':
+                               $condition = ($archiveprevexists == true);
+                               break;
+                       case 'archivenextexists':
+                               $condition = ($archivenextexists == true);
+                               break;
+                       case 'skintype':
+                               $condition = (($name == $this->skintype) || ($name == requestVar('action')));
+                               break;
+                       case 'hasplugin':
+                               $condition = $this->ifHasPlugin($name, $value);
+                               break;
+                       case 'adminaction':
+                               $condition = (Admin::getAdminAction() == $name);
+                               break;
+                       case 'adminoldaction':
+                               $condition = (Admin::getAdminAction() == $name);
+                               break;
+                       case 'addresschange':
+                               $condition = ($this->ifAddresscange());
+                               break;
+                       case 'bechangepass':
+                               $condition = ($this->beChangePassword());
+                               break;
+                       case 'skincandidates':
+                               $condition = ($this->ifSkincandidates());
+                               break;
+                       case 'nameclashes':
+                               $condition = requestVar('nameclashes');
+                               break;
+                       case 'existsnewplugin':
+                               $condition = ($this->existsNewPlugin());
+                               break;
+                       case 'autosave':
+                               $condition = (boolean) ($member->getAutosave() == $value);
+                               break;
+                       default:
+                               $condition = $manager->pluginInstalled("NP_{$field}") && $this->ifPlugin($field, $name, $value);
+                               break;
+               }
+               return $condition;
+       }
+       
+       /**
+        * Actions::_ifHasPlugin()
+        *      hasplugin,PlugName
+        *         -> checks if plugin exists
+        *      hasplugin,PlugName,OptionName
+        *         -> checks if the option OptionName from plugin PlugName is not set to 'no'
+        *      hasplugin,PlugName,OptionName=value
+        *         -> checks if the option OptionName from plugin PlugName is set to value
+        *
+        * @param       string  $name   name of plugin
+        * @param       string  $value  
+        * @return      
+        */
+       private function ifHasPlugin($name, $value)
+       {
+               global $manager;
+               $condition = false;
+               // (pluginInstalled method won't write a message in the actionlog on failure)
+               if ( $manager->pluginInstalled("NP_{$name}") )
+               {
+                       $plugin =& $manager->getPlugin("NP_{$name}");
+                       if ( $plugin != NULL )
+                       {
+                               if ( $value == "" )
+                               {
+                                       $condition = true;
+                               }
+                               else
+                               {
+                                       list($name2, $value2) = preg_split('#=#', $value, 2);
+                                       if ( $value2 == "" && $plugin->getOption($name2) != 'no' )
+                                       {
+                                               $condition = true;
+                                       }
+                                       else if ( $plugin->getOption($name2) == $value2 )
+                                       {
+                                               $condition = true;
+                                       }
+                               }
+                       }
+               }
+               return $condition;
+       }
+       
+       /**
+        * Actions::beChangePassword()
         * 
-        * @param       integer $id                     
-        * @param       string  $tplName        
-        * @param       string  $url            
-        * @param       string  $iconURL        
-        * @param       string  $alt            
-        * @param       string  $title          
-        * @param       $onclick
+        * @param       void
+        * @return      void
+        */
+       private function beChangePassword()
+       {
+               return intRequestVar('bNeedsPasswordChange');
+       }
+       
+       /**
+        * Actions::ifSkincandidates()
+        * Checks if a plugin exists and call its doIf function
         * 
+        * @param       void
+        * @return      void
+        * @return      boolean
         */
-       private function customHelp($id, $tplName = '', $url = '', $iconURL = '', $alt = '', $title = '', $onclick = '')
+       private function ifSkincandidates()
        {
-               echo self::customHelpHtml($id, $tplName, $url, $iconURL, $alt, $title, $onclick);
+               global $DIR_SKINS;
+               $candidates = SKINIMPORT::searchForCandidates($DIR_SKINS);
+               return (count($candidates) > 0);
        }
        
        /**
-        * Actions::customHelpHtml()
+        * Actions::ifPlugin()
+        * Checks if a plugin exists and call its doIf function
         * 
-        * @param       integer $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
+        * @param       string  $name   name of plugin
+        * @param       string  $key    
+        * @param       string  $value  
+        * @return      callback
         */
-       private function customHelpHtml($id, $tplName = '', $url = '', $iconURL = '', $alt = '', $title = '', $onclick = '')
+       private function ifPlugin($name, $key = '', $value = '')
        {
-               $templates = array();
-               if ( $tplName )
+               global $manager;
+
+               $plugin =& $manager->getPlugin("NP_{$name}");
+               if ( !$plugin )
                {
-                       $templates = Template::read($tplName);
+                       return;
                }
-               if ( array_key_exists('ADMIN_CUSTOMHELPLINK_ICON', $templates) && !empty($templates['ADMIN_CUSTOMHELPLINK_ICON']) )
+               
+               $params = func_get_args();
+               array_shift($params);
+               
+               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
+        */
+       private function ifCategory($key = '', $value='')
+       {
+               global $blog, $catid;
+               
+               // when no parameter is defined, just check if a category is selected
+               if (($key != 'catname' && $key != 'catid') || ($value == ''))
                {
-                       $template = $templates['ADMIN_CUSTOMHELPLINK_ICON'];
+                       return $blog->isValidCategory($catid);
                }
-               else
+               
+               // check category name
+               if ( $key == 'catname' )
                {
-                       $template = '<img src="<%iconurl%>" <%width%><%height%>alt="<%alt%>" title="<%title%>" /></a>';
+                       $value = $blog->getCategoryIdFromName($value);
+                       if ($value == $catid)
+                       {
+                               return $blog->isValidCategory($catid);
+                       }
                }
                
-               if ( empty($iconURL) )
+               // check category id
+               if (($key == 'catid') && ($value == $catid))
                {
-                       global $CONF;
-                       $iconURL = $CONF['AdminURL'] . 'documentation/icon-help.gif';
+                       return $blog->isValidCategory($catid);
                }
+               
+               return FALSE;
+       }
+       
+       /**
+        * 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
+        */
+       private function ifOnTeam($blogName = '')
+       {
+               global $blog, $member, $manager;
+               
+               // when no blog found
+               if ( ($blogName == '') && !is_object($blog) )
+               {
+                       return 0;
+               }
+               
+               // explicit blog selection
+               if ($blogName != '')
+               {
+                       $blogid = getBlogIDFromName($blogName);
+               }
+               
+               if (($blogName == '') || !$manager->existsBlogID($blogid))
+               {
+                       // use current blog
+                       $blogid = $blog->getID();
+               }
+               return $member->teamRights($blogid);
+       }
+       
+       /**
+        * AdminActions::ifAdmin()
+        * Checks if a member is admin of a blog
+        * 
+        * @param       string  $blogName       name of weblog
+        * @return      boolean
+        */
+       private function ifAdmin($blogName = '')
+       {
+               global $blog, $member, $manager;
+               
+               // when no blog found
+               if (($blogName == '') && (!is_object($blog)))
+               {
+                       return 0;
+               }
+               
+               // explicit blog selection
+               if ($blogName != '')
+               {
+                       $blogid = getBlogIDFromName($blogName);
+               }
+               
+               if (($blogName == '') || !$manager->existsBlogID($blogid))
+               {
+                       // 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()
+       {
+               $key = $this->objAdmin->sessionVar("{$CONF['CookiePrefix']}ackey");
+               if ( !$key )
+               {
+                       return FALSE;
+               }
+               $info = MEMBER::getActivationInfo($key);
+               if ( !$info )
+               {
+                       return FALSE;
+               }
+               $mem  = MEMBER::createFromId($info->vmember);
+               if ( !$mem )
+               {
+                       return FALSE;
+               }
+               if ( $info->vtype == 'addresschange' )
+               {
+                       return TRUE;
+               }
+               return FALSE;
+       }
+       
+       /**
+        * 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;
+       }
+       
+       /**
+        * 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       $onclick
+        * 
+        */
+       private function customHelp($id, $tplName = '', $url = '', $iconURL = '', $alt = '', $title = '', $onclick = '')
+       {
+               echo self::customHelpHtml($id, $tplName, $url, $iconURL, $alt, $title, $onclick);
+       }
+       
+       /**
+        * 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       $onclick
+        * 
+        */
+       static function customHelplink($id, $tplName = '', $url = '', $title = '', $onclick = '')
+       {
+               global $CONF;
+               
+               $templates = array();
+               
+               if ( $tplName )
+               {
+                       $templates = Template::read($tplName);
+               }
+               
+               if ( !array_key_exists('ADMIN_CUSTOMHELPLINK_ANCHOR', $templates) || empty($templates['ADMIN_CUSTOMHELPLINK_ANCHOR']) )
+               {
+                       $template = "<a href=\"<%helpurl%>#<%helptarget%>\" title=\"<%title%>\" <%onclick%>>\n";
+               }
+               else
+               {
+                       $template = $templates['ADMIN_CUSTOMHELPLINK_ANCHOR'];
+               }
+               
+               if ( empty($url) )
+               {
+                       $url = $CONF['AdminURL'] . 'documentation/customHelp.html';
+               }
+               
+               if ( empty($onclick) )
+               {
+                       $onclick = 'onclick="if (event &amp;&amp; event.preventDefault) event.preventDefault(); return help(this.href);"';
+               }
+               elseif ( preg_match('#^onclick#', $onclick) )
+               {
+                       $onclick = $onclick;
+               }
+               else
+               {
+                       $onclick = 'onclick="' . $onclick . '"';
+               }
+               
+               $data = array(
+                       'helpurl'               => $url,
+                       'helptarget'    => $id,
+                       'onclick'               => $onclick,
+                       'title'                 => (isset($title) && !empty($title)) ? $title : _HELP_TT,
+               );
+               return Template::fill($template, $data);
+       }
+       
+       /**
+        * 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;
+               
+               $templates = array();
+               
+               if ( $tplName )
+               {
+                       $templates = Template::read($tplName);
+               }
+               if ( !array_key_exists('ADMIN_CUSTOMHELPLINK_ICON', $templates) || !empty($templates['ADMIN_CUSTOMHELPLINK_ICON']) )
+               {
+                       $template = "<img src=\"<%iconurl%>\" <%width%><%height%>alt=\"<%alt%>\" title=\"<%title%>\" /></a>\n";
+               }
+               else
+               {
+                       $template = $templates['ADMIN_CUSTOMHELPLINK_ICON'];
+               }
+               
+               if ( empty($iconURL) )
+               {
+                       $iconURL = $CONF['AdminURL'] . 'documentation/icon-help.gif';
+               }
+               
                if ( function_exists('getimagesize') )
                {
                        $size   = getimagesize($iconURL);
                        $width  = 'width="'  . $size[0] . '" ';
                        $height = 'height="' . $size[1] . '" ';
                }
+               
                $data = array(
                        'iconurl'       => $iconURL,
                        'width'         => $width,
@@ -4065,13 +5610,15 @@ class AdminActions extends BaseActions
                        'alt'           => (isset($alt) && !empty($alt))         ? $alt   : _HELP_TT,
                        'title'         => (isset($title) && !empty($title)) ? $title : _HELP_TT,
                );
-               $icon = TEMPLATE::fill($template, $data);
+               
+               $icon = Template::fill($template, $data);
                $help = self::customHelplink($id, $tplName, $url, $title, $onclick);
+               
                return $help . $icon;
        }
        
        /**
-        * Actions::input_yesno
+        * AdminActions::input_yesno
         * 
         * @param               $name
         * @param               $checkedval
@@ -4084,7 +5631,7 @@ class AdminActions extends BaseActions
         * @param               $templateName
         * @param               $showlist
         */
-       private function input_yesno($name,
+       public function input_yesno($name,
                                                                $checkedval,
                                                                $tabindex        = 0,
                                                                $value1    = 1,
@@ -4103,17 +5650,17 @@ class AdminActions extends BaseActions
                
                if ( $name == 'admin' )
                {
-                       if ( array_key_exists('INPUTYESNO_TEMPLATE_ADMIN', $templates) && !empty($templates['INPUTYESNO_TEMPLATE_ADMIN']) )
-                       {
-                               $template = $templates['INPUTYESNO_TEMPLATE_ADMIN'];
-                       }
-                       else
+                       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'];
+                       }
                }
                else
                {
@@ -4162,27 +5709,317 @@ class AdminActions extends BaseActions
                }
                else
                {
-                       echo TEMPLATE::fill($template, $dat);
+                       echo Template::fill($template, $dat);
                }
                return;
        }
        
        /**
-        * AdminActions::parse_text()
-        * Parse text
+        * AdminActions::existsNewPlugin()
+        * Check exists new plugin
+        * 
+        * @param       void
+        * @return      boolean exists or not
+        */
+       private function existsNewPlugin()
+       {
+               global $DIR_PLUGINS;
+               
+               $query = "SELECT * FROM %s;";
+               $query = sprintf($query, sql_table('plugin'));
+               $res  = DB::getResult($query);
+               
+               $installed = array();
+               foreach( $res as $row )
+               {
+                       $installed[] = $row['pfile'];
+               }
+               
+               $files = scandir($DIR_PLUGINS);
+               
+               $candidates = array();
+               foreach ( $files as $file )
+               {
+                       if ( preg_match("#^(NP_.*)\.php$#", $file, $matches) )
+                       {
+                               if ( !in_array($matches[1], $installed) )
+                               {
+                                       $candidates[] = $matches[1];
+                               }
+                       }
+               }
+               $this->newPlugCandidates = $candidates;
+               return (count($candidates) > 0);
+       }
+       
+       /**
+        * AdminActions::pagehead()
+        * Output admin page head
         * 
-        * FIXME: is this really needed?
+        * @param       void
+        * @return      void
+        */
+       public function parse_pagehead()
+       {
+               global $member, $nucleus, $CONF, $manager;
+               
+               $content = $this->parser->skin->getContentFromDB('pagehead');
+               if ( !$content )
+               {
+                       $extrahead = Admin::$extrahead;
+                       $data = array(
+                               'extrahead'     => &$extrahead,
+                               'action'        =>  Admin::$action
+                       );
+                       $manager->notify('AdminPrePageHead', $data);
+                       
+                       $baseUrl = Entity::hsc($CONF['SkinsURL']);
+                       
+                       /*
+                        * TODO: obsoleted
+                       if ( !array_key_exists('AdminCSS', $CONF) )
+                       {
+                               DB::execute("INSERT INTO " . sql_table('config') . " VALUES ('AdminCSS', 'original')");
+                               $CONF['AdminCSS'] = 'original';
+                       }
+                       */
+                       
+                       /* HTTP 1.1 application for no caching */
+                       header("Cache-Control: no-cache, must-revalidate");
+                       header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
+                       
+                       $root_element = 'html';
+                       $charset = i18n::get_current_charset();
+                       $locale = preg_replace('#_#', '-', i18n::get_current_locale());
+                       $xml_version_info = self::$xml_version_info;
+                       $formal_public_identifier = self::$formal_public_identifier;
+                       $system_identifier = self::$system_identifier;
+                       $xhtml_namespace = self::$xhtml_namespace;
+                       
+                       echo "<?xml version=\"{$xml_version_info}\" encoding=\"{$charset}\" ?>\n";
+                       echo "<!DOCTYPE {$root_element} PUBLIC \"{$formal_public_identifier}\" \"{$system_identifier}\">\n";
+                       echo "<{$root_element} xmlns=\"{$xhtml_namespace}\" xml:lang=\"{$locale}\" lang=\"{$locale}\">\n";
+                       echo "<head>\n";
+                       echo '<title>' . Entity::hsc($CONF['SiteName']) . " - Admin</title>\n";
+                       /*
+                        * TODO: obsoleted
+                       echo "<link rel=\"stylesheet\" title=\"Nucleus Admin Default\" type=\"text/css\" href=\"{$baseUrl}admin/defaultadmin/styles/admin_{$CONF["AdminCSS"]}.css\" />\n";
+                       */
+                       echo "<link rel=\"stylesheet\" title=\"Nucleus Admin Default\" type=\"text/css\" href=\"{$baseUrl}admin/defaultadmin/styles/addedit.css\" />\n";
+                       echo "<script type=\"text/javascript\" src=\"{$baseUrl}javascripts/edit.js\"></script>\n";
+                       echo "<script type=\"text/javascript\" src=\"{$baseUrl}javascripts/admin.js\"></script>\n";
+                       echo "<script type=\"text/javascript\" src=\"{$baseUrl}javascripts/compatibility.js\"></script>\n";
+                       echo "{$extrahead}\n";
+                       echo "</head>\n\n";
+                       echo "<body>\n";
+                       echo "<div id=\"adminwrapper\">\n";
+                       echo "<div class=\"header\">\n";
+                       echo '<h1>' . Entity::hsc($CONF['SiteName']) . "</h1>\n";
+                       echo "</div>\n";
+                       echo "<div id=\"container\">\n";
+                       echo "<div id=\"content\">\n";
+                       echo "<div class=\"loginname\">\n";
+                       
+                       if ( !$member->isLoggedIn() )
+                       {
+                               echo '<a href="index.php?action=showlogin" title="Log in">' . _NOTLOGGEDIN . "</a><br />\n";
+                       }
+                       else
+                       {
+                               echo _LOGGEDINAS . ' ' . $member->getDisplayName() ." - <a href='index.php?action=logout'>" . _LOGOUT. "</a><br />\n";
+                               echo "<a href='index.php?action=overview'>" . _ADMINHOME . "</a> - ";
+                       }
+                       
+                       echo "<a href='".$CONF['IndexURL']."'>"._YOURSITE."</a><br />\n";
+                       echo '(';
+                       
+                       if ( !array_key_exists('codename', $nucleus) || empty($nucleus['codename']) )
+                       {
+                               $codenamestring = '';
+                       }
+                       else
+                       {
+                               $codenamestring = ' &quot;' . $nucleus['codename'].'&quot;';
+                       }
+                       
+                       if ( $member->isLoggedIn() && $member->isAdmin() )
+                       {
+                               $checkURL = sprintf(_ADMIN_SYSTEMOVERVIEW_VERSIONCHECK_URL, getNucleusVersion(), getNucleusPatchLevel());
+                               echo '<a href="' . $checkURL . '" title="' . _ADMIN_SYSTEMOVERVIEW_VERSIONCHECK_TITLE . '">Nucleus CMS ' . $nucleus['version'] . $codenamestring . '</a>';
+                               
+                               $newestVersion = getLatestVersion();
+                               $newestCompare = str_replace('/', '.', $newestVersion);
+                               $currentVersion = str_replace(array('/','v'), array('.',''), $nucleus['version']);
+                               
+                               if ( $newestVersion && version_compare($newestCompare, $currentVersion) > 0 )
+                               {
+                                       echo "<br />\n";
+                                       echo '<a style="color:red" href="http://nucleuscms.org/upgrade.php" title="' . _ADMIN_SYSTEMOVERVIEW_LATESTVERSION_TITLE . '">';
+                                       echo _ADMIN_SYSTEMOVERVIEW_LATESTVERSION_TEXT . $newestVersion;
+                                       echo "</a>";
+                               }
+                       }
+                       else
+                       {
+                               echo "Nucleus CMS {$nucleus['version']}{$codenamestring}";
+                       }
+                       echo ')';
+                       echo '</div>';
+               }
+               else
+               {
+                       $this->parser->parse($content);
+               }
+               
+               return;
+       }
+       
+       /**
+        * AdminActionss::pagefoot()
+        * Output admin page foot include quickmenu
         * 
-        * @param       string  $which  constant vallue
+        * @param       void
         * @return      void
         */
-       public function parse_text($which)
+       public function parse_pagefoot()
        {
-               if ( defined($which) )
+               global $action, $member, $manager;
+               
+               $content = $this->parser->skin->getContentFromDB('pagefoot');
+               if ( !$content )
+               {
+                       $data = array(
+                               'action' => self::$action
+                       );
+                       $manager->notify('AdminPrePageFoot', $data);
+                       
+                       if ( $member->isLoggedIn() && ($action != 'showlogin') )
+                       {
+                               echo '<h2>' . _LOGOUT . "</h2>\n";
+                               echo "<ul>\n";
+                               echo '<li><a href="index.php?action=overview">' . _BACKHOME . "</a></li>\n";
+                               echo '<li><a href="index.php?action=logout">' .  _LOGOUT . "</a></li>\n";
+                               echo "</ul>\n";
+                       }
+                       
+                       echo "<div class=\"foot\">\n";
+                       echo '<a href="' . _ADMINPAGEFOOT_OFFICIALURL . '">Nucleus CMS</a> &copy; 2002-' . date('Y') . ' ' . _ADMINPAGEFOOT_COPYRIGHT;
+                       echo '-';
+                       echo '<a href="' . _ADMINPAGEFOOT_DONATEURL . '">' . _ADMINPAGEFOOT_DONATE . "</a>\n";
+                       echo "</div>\n";
+                       
+                       echo "<div id=\"quickmenu\">\n";
+                       
+                       if ( ($action != 'showlogin') && ($member->isLoggedIn()) )
+                       {
+                               echo "<ul>\n";
+                               echo '<li><a href="index.php?action=overview">' . _QMENU_HOME . "</a></li>\n";
+                               echo "</ul>\n";
+                               
+                               echo '<h2>' . _QMENU_ADD . "</h2>\n";
+                               echo "<form method=\"get\" action=\"index.php\">\n";
+                               echo "<p>\n";
+                               echo "<input type=\"hidden\" name=\"action\" value=\"createitem\" />\n";
+                               
+                               $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 %s ORDER BY bname;";
+                                       $query = sprintf($query, sql_table('blog'));
+                               }
+                               else
+                               {
+                                       $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['shorten']    = 10;
+                               $template['shortenel']  = '';
+                               $template['javascript'] = 'onchange="return form.submit()"';
+                               showlist($query, 'select', $template);
+                               
+                               echo "</p>\n";
+                               echo "</form>\n";
+                               
+                               echo "<h2>{$member->getDisplayName()}</h2>\n";
+                               echo "<ul>\n";
+                               echo '<li><a href="index.php?action=editmembersettings">' . _QMENU_USER_SETTINGS . "</a></li>\n";
+                               echo '<li><a href="index.php?action=browseownitems">' . _QMENU_USER_ITEMS . "</a></li>\n";
+                               echo '<li><a href="index.php?action=browseowncomments">' . _QMENU_USER_COMMENTS . "</a></li>\n";
+                               echo "</ul>\n";
+                               
+                               if ( $member->isAdmin() )
+                               {
+                                       echo '<h2>' . _QMENU_MANAGE . "</h2>\n";
+                                       echo "<ul>\n";
+                                       echo '<li><a href="index.php?action=actionlog">' . _QMENU_MANAGE_LOG . "</a></li>\n";
+                                       echo '<li><a href="index.php?action=settingsedit">' . _QMENU_MANAGE_SETTINGS . "</a></li>\n";
+                                       echo '<li><a href="index.php?action=systemoverview">' . _QMENU_MANAGE_SYSTEM . "</a></li>\n";
+                                       echo '<li><a href="index.php?action=usermanagement">' . _QMENU_MANAGE_MEMBERS . "</a></li>\n";
+                                       echo '<li><a href="index.php?action=createnewlog">' . _QMENU_MANAGE_NEWBLOG . "</a></li>\n";
+                                       echo '<li><a href="index.php?action=backupoverview">' . _QMENU_MANAGE_BACKUPS . "</a></li>\n";
+                                       echo '<li><a href="index.php?action=pluginlist">' . _QMENU_MANAGE_PLUGINS . "</a></li>\n";
+                                       echo "</ul>\n";
+                                       
+                                       echo "<h2>" . _QMENU_LAYOUT . "</h2>\n";
+                                       echo "<ul>\n";
+                                       echo '<li><a href="index.php?action=skinoverview">' . _QMENU_LAYOUT_SKINS . "</a></li>\n";
+                                       echo '<li><a href="index.php?action=templateoverview">' . _QMENU_LAYOUT_TEMPL . "</a></li>\n";
+                                       echo '<li><a href="index.php?action=skinieoverview">' . _QMENU_LAYOUT_IEXPORT . "</a></li>\n";
+                                       echo "</ul>\n";
+                               }
+                               
+                               $data = array('options' => array());
+                               
+                               $manager->notify('QuickMenu', $data);
+                               
+                               if ( count($data['options']) > 0 )
+                               {
+                                       echo "<h2>" . _QMENU_PLUGINS . "</h2>\n";
+                                       echo "<ul>\n";
+                                       foreach ( $data['options'] as $option )
+                                       {
+                                               echo '<li><a href="' . Entity::hsc($option['url']) . '" title="' . Entity::hsc($option['tooltip']) . '">' . Entity::hsc($option['title']) . "</a></li>\n";
+                                       }
+                                       echo "</ul>\n";
+                               }
+                       }
+                       else if ( ($action == 'activate') || ($action == 'activatesetpwd') )
+                       {
+                       
+                               echo '<h2>' . _QMENU_ACTIVATE . '</h2>' . _QMENU_ACTIVATE_TEXT;
+                       }
+                       else
+                       {
+                               echo '<h2>' . _QMENU_INTRO . '</h2>' . _QMENU_INTRO_TEXT;
+                       }
+                       
+                       echo "<!-- quickmenu -->\n";
+                       echo "</div>\n";
+                       
+                       echo "<!-- content -->\n";
+                       echo "</div>\n";
+                       
+                       echo "<!-- container -->\n";
+                       echo "</div>\n";
+                       
+                       echo "<!-- adminwrapper -->\n";
+                       echo "</div>\n";
+                       
+                       echo "</body>\n";
+                       echo "</html>\n";
+               }
+               else
                {
-                       echo constant($which);
+                       $this->parser->skin->parse('pagefoot');
+                       exit;
                }
+               
                return;
        }
-
-}
\ No newline at end of file
+}