tbrehm
2008-12-12 ec09b18c9c44f85ceb6d9e7588a03a221cd1193f
server/plugins-available/apache2_plugin.inc.php
@@ -36,6 +36,19 @@
   // private variables
   var $action = '';
   
   //* This function is called during ispconfig installation to determine
   //  if a symlink shall be created for this plugin.
   function onInstall() {
      global $conf;
      if($conf['services']['web'] == true) {
         return true;
      } else {
         return false;
      }
   }
      
   /*
       This function is called when the plugin is loaded
@@ -300,14 +313,34 @@
      
      if($this->action == 'insert' && $data["new"]["type"] == 'vhost') {
         // Copy the error pages
      if($data["new"]["errordocs"]){
           $error_page_path = escapeshellcmd($data["new"]["document_root"])."/web/error/";
           exec("cp /usr/local/ispconfig/server/conf/error/".substr(escapeshellcmd($conf["language"]),0,2)."/* ".$error_page_path);
           exec("chmod -R +r ".$error_page_path);
      }
         if($data["new"]["errordocs"]){
            $error_page_path = escapeshellcmd($data["new"]["document_root"])."/web/error/";
            if (file_exists("/usr/local/ispconfig/server/conf-custom/error/".substr(escapeshellcmd($conf["language"]),0,2))){
               exec("cp /usr/local/ispconfig/server/conf-custom/error/".substr(escapeshellcmd($conf["language"]),0,2)."/* ".$error_page_path);
            }
            else {
               if (file_exists("/usr/local/ispconfig/server/conf-custom/error/fileNotFound.html")){
                  exec("cp /usr/local/ispconfig/server/conf-custom/error/*.html ".$error_page_path);
               }
               else {
                  exec("cp /usr/local/ispconfig/server/conf/error/".substr(escapeshellcmd($conf["language"]),0,2)."/* ".$error_page_path);
               }
            }
            exec("chmod -R +r ".$error_page_path);
         }
         // copy the standard index page
         exec("cp /usr/local/ispconfig/server/conf/index/standard_index.html_".substr(escapeshellcmd($conf["language"]),0,2)." ".escapeshellcmd($data["new"]["document_root"])."/web/index.html");
         if (file_exists("/usr/local/ispconfig/server/conf-custom/index/standard_index.html_".substr(escapeshellcmd($conf["language"]),0,2))){
            exec("cp /usr/local/ispconfig/server/conf-custom/index/standard_index.html_".substr(escapeshellcmd($conf["language"]),0,2)." ".escapeshellcmd($data["new"]["document_root"])."/web/index.html");
         }
         else {
            if (file_exists("/usr/local/ispconfig/server/conf-custom/index/standard_index.html")){
               exec("cp /usr/local/ispconfig/server/conf-custom/index/standard_index.html ".escapeshellcmd($data["new"]["document_root"])."/web/index.html");
            }
            else {
               exec("cp /usr/local/ispconfig/server/conf/index/standard_index.html_".substr(escapeshellcmd($conf["language"]),0,2)." ".escapeshellcmd($data["new"]["document_root"])."/web/index.html");
            }
         }
         exec("chmod +r ".escapeshellcmd($data["new"]["document_root"])."/web/index.html");
      }
      
@@ -343,6 +376,9 @@
      // Chown and chmod the directories
      exec("chown -R $username:$groupname ".escapeshellcmd($data["new"]["document_root"]));
      
      // make temp direcory writable for the apache user and the website user
      exec("chmod 777 ".escapeshellcmd($data["new"]["document_root"]."/tmp"));
      
      // Create the vhost config file
      $app->load('tpl');