Example #1
0
 /**
  * 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);
 }