tbrehm
2011-09-26 b31bb1f27f066a2d49f5ab9ee0ca15e985efc788
server/plugins-available/apache2_plugin.inc.php
@@ -289,6 +289,23 @@
         $app->log('Websites cannot be owned by the root user or group.',LOGLEVEL_WARN);
         return 0;
      }
      // Create group and user, if not exist
      $app->uses('system');
      $groupname = escapeshellcmd($data['new']['system_group']);
      if($data['new']['system_group'] != '' && !$app->system->is_group($data['new']['system_group'])) {
         exec('groupadd '.$groupname);
         if($apache_chrooted) $this->_exec('chroot '.escapeshellcmd($web_config['website_basedir']).' groupadd '.$groupname);
         $app->log('Adding the group: '.$groupname,LOGLEVEL_DEBUG);
      }
      $username = escapeshellcmd($data['new']['system_user']);
      if($data['new']['system_user'] != '' && !$app->system->is_user($data['new']['system_user'])) {
         exec('useradd -d '.escapeshellcmd($data['new']['document_root'])." -g $groupname -G sshusers $username -s /bin/false");
         if($apache_chrooted) $this->_exec('chroot '.escapeshellcmd($web_config['website_basedir']).' useradd -d '.escapeshellcmd($data['new']['document_root'])." -g $groupname -G sshusers $username -s /bin/false");
         $app->log('Adding the user: '.$username,LOGLEVEL_DEBUG);
      }
      //* If the client of the site has been changed, we have a change of the document root
      if($this->action == 'update' && $data['new']['document_root'] != $data['old']['document_root']) {
@@ -510,23 +527,6 @@
         exec('chmod -R a+r '.$error_page_path);
         exec('chown -R '.$data['new']['system_user'].':'.$data['new']['system_group'].' '.$error_page_path);
      }  // end copy error docs
      // Create group and user, if not exist
      $app->uses('system');
      $groupname = escapeshellcmd($data['new']['system_group']);
      if($data['new']['system_group'] != '' && !$app->system->is_group($data['new']['system_group'])) {
         exec('groupadd '.$groupname);
         if($apache_chrooted) $this->_exec('chroot '.escapeshellcmd($web_config['website_basedir']).' groupadd '.$groupname);
         $app->log('Adding the group: '.$groupname,LOGLEVEL_DEBUG);
      }
      $username = escapeshellcmd($data['new']['system_user']);
      if($data['new']['system_user'] != '' && !$app->system->is_user($data['new']['system_user'])) {
         exec('useradd -d '.escapeshellcmd($data['new']['document_root'])." -g $groupname -G sshusers $username -s /bin/false");
         if($apache_chrooted) $this->_exec('chroot '.escapeshellcmd($web_config['website_basedir']).' useradd -d '.escapeshellcmd($data['new']['document_root'])." -g $groupname -G sshusers $username -s /bin/false");
         $app->log('Adding the user: '.$username,LOGLEVEL_DEBUG);
      }
      // Set the quota for the user
      if($username != '' && $app->system->is_user($username)) {
@@ -1698,6 +1698,9 @@
         file_put_contents($awstats_conf_dir.'/awstats.'.$data['new']['domain'].'.conf',$content);
         $app->log('Created AWStats config file: '.$awstats_conf_dir.'/awstats.'.$data['new']['domain'].'.conf',LOGLEVEL_DEBUG);
      }
      unlink($data['new']['document_root']."/web/stats/index.html");
      copy("/usr/local/ispconfig/server/conf/awstats_index.php.master",$data['new']['document_root']."/web/stats/index.php");
   }
   
   //* Delete the awstats configuration file