OSDN Git Service

FIX: デフォルトの管理画面スキン以外を画面上で編集できないバグを修正
authorsakamocchi <o-takashi@sakamocchi.jp>
Mon, 21 May 2012 13:22:28 +0000 (22:22 +0900)
committersakamocchi <o-takashi@sakamocchi.jp>
Mon, 21 May 2012 13:22:28 +0000 (22:22 +0900)
AdminActions::parse_editadminskintype()内で、現在管理画面をパースするために使っているSkinクラスのインスタンスを使っていた。skinidからSkinクラスのインスタンスをコンストラクトし、そちらを用いるように修正した。

nucleus/libs/AdminActions.php

index 5aa0fd9..ff0a6ca 100644 (file)
@@ -2522,35 +2522,48 @@ class AdminActions extends BaseActions
        {
                global $CONF, $manager, $member;
                
-               $fNames = $this->parser->skin->getAvailableTypes();
-               $sType  = strtolower(trim(requestVar('type')));
+               static $skin = NULL;
+               static $types = array();
+               
+               if ( $skin == NULL )
+               {
+                       $skinid = intRequestVar('skinid');
+                       $skin = new Skin($skinid, 'AdminActions');
+                       $types = $skin->getAvailableTypes();
+               }
+               
+               $stype = strtolower(trim(requestVar('type')));
+               if ( empty($stype) )
+               {
+                       $stype = $type;
+               }
                
                switch ( $type )
                {
                        case 'id':
-                               echo intRequestVar('skinid');
+                               echo $skin->getID();
                                break;
                        case 'name':
-                               echo Entity::hsc($this->parser->skin->getName());
+                               echo Entity::hsc($skin->getName());
                                break;
                        case 'desc':
-                               echo Entity::hsc($this->parser->skin->getDescription());
+                               echo Entity::hsc($skin->getDescription());
                                break;
                        case 'type':
-                               echo Entity::hsc($this->parser->skin->getContentType());
+                               echo Entity::hsc($skin->getContentType());
                                break;
                        case 'content':
-                               echo Entity::hsc($this->parser->skin->getContentFromDB($sType));
+                               echo Entity::hsc($skin->getContentFromDB($stype));
                                break;
                        case 'skintype':
-                               $skinType = !array_key_exists($sType, $fNames) ? ucfirst($sType) : $fNames[$sType];
-                               echo Entity::hsc($skinType);
+                               $friendly_name = !array_key_exists($stype, $types) ? ucfirst($stype) : $types[$stype];
+                               echo Entity::hsc($friendly_name);
                                break;
                        case 'skintyperaw':
-                               echo Entity::hsc($sType);
+                               echo Entity::hsc($stype);
                                break;
                        case 'prefix':
-                               echo Entity::hsc($this->parser->skin->getIncludePrefix());
+                               echo Entity::hsc($skin->getIncludePrefix());
                                break;
                        case 'mode':
                                $incMode = $skin->getIncludeMode() ? _PARSER_INCMODE_SKINDIR : _PARSER_INCMODE_NORMAL;