Sfoglia il codice sorgente

Ticket #4752 - Templates: Loading indicator don't stop after saving.

AntonLV 2 anni fa
parent
commit
3d8c2950a9
2 ha cambiato i file con 13 aggiunte e 3 eliminazioni
  1. 8 1
      studio/classes/BxDolStudioOptions.php
  2. 5 2
      studio/options.php

+ 8 - 1
studio/classes/BxDolStudioOptions.php

@@ -64,7 +64,14 @@ class BxDolStudioOptions extends BxDol
             if(is_array($mixedCategory))
                 $this->sCategory = $mixedCategory;
             else if(is_string($mixedCategory)) {
-                $this->sCategory = json_decode($mixedCategory);
+                //--- Serialized array
+                if(preg_match('/^a:[\d+]:\{/', $mixedCategory))
+                    $this->sCategory = json_decode($mixedCategory, true);
+
+                //--- Comma separated list
+                if(empty($this->sCategory) && strpos($mixedCategory, ',') !== false)
+                    $this->sCategory = explode(',', $mixedCategory);
+
                 if(empty($this->sCategory))
                     $this->sCategory = $mixedCategory;
             }

+ 5 - 2
studio/options.php

@@ -19,8 +19,11 @@ bx_require_authentication(true);
 $sType = bx_get('type');
 $sType = $sType !== false ? bx_process_input($sType) : '';
 
-$mixedCategory = bx_get('category');
-$mixedCategory = $mixedCategory !== false ? bx_process_input($mixedCategory) : '';
+$mixedCategory = '';
+if(($mixedCategory = bx_get('category')) !== false)
+    $mixedCategory = bx_process_input($mixedCategory);
+if(!$mixedCategory && ($mixedCategory = bx_get('categories')) !== false)
+    $mixedCategory = bx_process_input($mixedCategory);
 
 $oOptions = new BxTemplStudioOptions($sType, $mixedCategory);