A_Stylesheet_Ajax_Actions

Registers new AJAX functions for retrieving/updating the contents of CSS stylesheets.

Defined (1)

The class is defined in the following location(s).

/products/photocrati_nextgen/modules/nextgen_other_options/package.module.nextgen_other_options.php  
  1. class A_Stylesheet_Ajax_Actions extends Mixin 
  2. /** 
  3. * Retrieves the contents of the CSS stylesheet specified 
  4. */ 
  5. function get_stylesheet_contents_action() 
  6. $retval = array(); 
  7. if ($this->object->_authorized_for_stylesheet_action()) { 
  8. $styles = C_NextGen_Style_Manager::get_instance(); 
  9. $cssfile = str_replace('..', '', $this->object->param('cssfile')); 
  10. $abspath = $styles->find_selected_stylesheet_abspath($cssfile); 
  11. $writepath = $styles->get_selected_stylesheet_saved_abspath($this->object->param('cssfile')); 
  12. if (is_readable($abspath)) { 
  13. $retval['contents'] = file_get_contents($abspath); 
  14. $retval['writable'] = is_writable($abspath); 
  15. $retval['abspath'] = $abspath; 
  16. $retval['writepath'] = $writepath; 
  17. } else { 
  18. $retval['error'] = "Could not find stylesheet"; 
  19. } else { 
  20. $retval['error'] = 'Unauthorized'; 
  21. return $retval; 
  22. /** 
  23. * Determines if the request is authorized 
  24. * @return boolean 
  25. */ 
  26. function _authorized_for_stylesheet_action() 
  27. $security = $this->get_registry()->get_utility('I_Security_Manager'); 
  28. $sec_actor = $security->get_current_actor(); 
  29. return $sec_actor->is_allowed('nextgen_edit_style');