function buildDirStructure()
 {
     zmgimport('org.zoomfactory.lib.helpers.zmgFileHelper');
     $html_file = "<html><body bgcolor=\"#FFFFFF\"></body></html>";
     $root = zmgEnv::getRootPath();
     $mediapath = $root . DS . zmgFactory::getConfig()->get('filesystem/mediapath');
     $dirs = array($mediapath . $this->dir, $mediapath . $this->dir . DS . 'thumbs', $mediapath . $this->dir . DS . 'viewsize');
     foreach ($dirs as $dir) {
         if (zmgFileHelper::createDir($dir, 0777)) {
             if (!zmgFileHelper::write($dir . DS . 'index.html', $html_file)) {
                 zmgError::throwError(T_('Unable to write to file: ') . $dir . DS . 'index.html');
             }
         } else {
             zmgError::throwError(T_('Unable to create directory: ') . $dir);
         }
     }
     return true;
 }
 function save()
 {
     $content = "<?php\n" . "/**\n" . " * zOOm Media Gallery! - a multi-gallery component\n" . " * \n" . " * @package zmg\n" . " * @author Mike de Boer <mike AT zoomfactory.org>\n" . " * @copyright Copyright &copy; 2007, Mike de Boer. All rights reserved.\n" . " * @license http://www.gnu.org/copyleft/gpl.html GPL\n" . " */\n\n" . "defined('_ZMG_EXEC') or die('Restricted access');\n\n" . "\$zoom_config = array();\n" . "\$zoom_config['date_lch'] = " . time() . ";\n" . $this->_buildMetaBlock() . $this->_buildLocaleBlock() . $this->_buildDatabaseBlock() . $this->_buildFilesystemBlock() . $this->_buildSmartyBlock() . $this->_buildLayoutBlock() . $this->_buildAppBlock() . "\n" . "\$zoom_config['events'] = array();\n\n" . $this->_buildPluginsBlock() . "?>\n";
     //echo $content;
     zmgimport('org.zoomfactory.lib.helpers.zmgFileHelper');
     return zmgFileHelper::write(ZMG_ABS_PATH . DS . 'etc' . DS . 'app.config.php', $content);
 }
 function _cacheManifest(&$doc)
 {
     //TODO: what if the manifest changed? Need to implement proper caching
     //Cache_Lite, maybe?
     if (is_writable($this->cache_dir) && !empty($this->_manifest)) {
         zmgimport('org.zoomfactory.lib.helpers.zmgFileHelper');
         zmgFileHelper::write($this->cache_dir . DS . $this->_active_template . '_tpl.cache', serialize($this->_manifest));
     } else {
         $this->throwError('ZMG cache directory not writable.');
     }
 }