/** * Sets auto-configure state. * * @param boolean $state state * * @return void * @throws Engine_Exception, Validation_Exception */ public function set_auto_configure_state($state) { clearos_profile(__METHOD__, __LINE__); $config_value = $state ? 'yes' : 'no'; $file = new File(self::FILE_APP_CONFIG); if ($file->exists()) { $file->delete(); } $file->create('root', 'root', '0644'); $file->add_lines("auto_configure = {$config_value}\n"); }
/** * Sets exception sites. * * @param array $sites exception sites * * @access private * @return void * @throws Engine_Exception */ protected function _set_exception_sites($sites) { clearos_profile(__METHOD__, __LINE__); $file = new File(self::FILE_WHITELISTS_CONFIG . ".tmp", TRUE); if ($file->exists()) { $file->delete(); } $file->create('root', 'root', '0644'); if (empty($sites)) { $lines = array(); } else { $lines[] = "# Please specify one domain per line"; $lines[] = "# ACL definitions"; foreach ($sites as $site) { $lines[] = "acl whitelist_destination_domains dstdomain ." . $site; } $lines[] = ''; $lines[] = '# Access rule'; $lines[] = 'http_access allow whitelist_destination_domains'; $lines[] = 'http_access allow CONNECT whitelist_destination_domains'; } $file->dump_contents_from_array($lines); $file->move_to(self::FILE_WHITELISTS_CONFIG); }