includes/pageutils.php
changeset 334 c72b545f1304
parent 328 dc838fd61a06
child 335 67bd3121a12e
equal deleted inserted replaced
333:32429702305e 334:c72b545f1304
  1606    * @return string JSON string with an array containing a list of themes
  1606    * @return string JSON string with an array containing a list of themes
  1607    */
  1607    */
  1608    
  1608    
  1609   function getstyles()
  1609   function getstyles()
  1610   {
  1610   {
  1611     $json = new Services_JSON(SERVICES_JSON_LOOSE_TYPE);
       
  1612     
  1611     
  1613     if ( !preg_match('/^([a-z0-9_-]+)$/', $_GET['id']) )
  1612     if ( !preg_match('/^([a-z0-9_-]+)$/', $_GET['id']) )
  1614       return $json->encode(false);
  1613       return enano_json_encode(false);
  1615     
  1614     
  1616     $dir = './themes/' . $_GET['id'] . '/css/';
  1615     $dir = './themes/' . $_GET['id'] . '/css/';
  1617     $list = Array();
  1616     $list = Array();
  1618     // Open a known directory, and proceed to read its contents
  1617     // Open a known directory, and proceed to read its contents
  1619     if (is_dir($dir)) {
  1618     if (is_dir($dir)) {
  1629         closedir($dh);
  1628         closedir($dh);
  1630       }
  1629       }
  1631     }
  1630     }
  1632     else
  1631     else
  1633     {
  1632     {
  1634       return($json->encode(Array('mode' => 'error', 'error' => $dir.' is not a dir')));
  1633       return(enano_json_encode(Array('mode' => 'error', 'error' => $dir.' is not a dir')));
  1635     }
  1634     }
  1636     
  1635     
  1637     return $json->encode($list);
  1636     return enano_json_encode($list);
  1638   }
  1637   }
  1639   
  1638   
  1640   /**
  1639   /**
  1641    * Assembles a Javascript app with category information
  1640    * Assembles a Javascript app with category information
  1642    * @param $page_id the page ID
  1641    * @param $page_id the page ID
  2186    */
  2185    */
  2187    
  2186    
  2188   function acl_json($parms = '{ }')
  2187   function acl_json($parms = '{ }')
  2189   {
  2188   {
  2190     global $db, $session, $paths, $template, $plugins; // Common objects
  2189     global $db, $session, $paths, $template, $plugins; // Common objects
  2191     $json = new Services_JSON(SERVICES_JSON_LOOSE_TYPE);
  2190     $parms = enano_json_decode($parms);
  2192     $parms = $json->decode($parms);
       
  2193     $ret = PageUtils::acl_editor($parms);
  2191     $ret = PageUtils::acl_editor($parms);
  2194     $ret = $json->encode($ret);
  2192     $ret = enano_json_encode($ret);
  2195     return $ret;
  2193     return $ret;
  2196   }
  2194   }
  2197   
  2195   
  2198   /**
  2196   /**
  2199    * A non-Javascript frontend for the ACL API.
  2197    * A non-Javascript frontend for the ACL API.