| | |
| | | if($data["new"]["type"] != "vhost" && $data["new"]["parent_domain_id"] > 0) { |
| | | // This is not a vhost, so we need to update the parent record instead. |
| | | $parent_domain_id = intval($data["new"]["parent_domain_id"]); |
| | | $tmp = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$parent_domain_id); |
| | | $tmp = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$parent_domain_id." AND active = 'y'"); |
| | | $data["new"] = $tmp; |
| | | $data["old"] = $tmp; |
| | | } |
| | |
| | | |
| | | // Check if the directories are there and create them if nescessary. |
| | | if(!is_dir($data["new"]["document_root"]."/web")) exec("mkdir -p ".$data["new"]["document_root"]."/web"); |
| | | if(!is_dir($data["new"]["document_root"]."/log")) exec("mkdir -p ".$data["new"]["document_root"]."/log"); |
| | | if(!is_dir($data["new"]["document_root"]."/web/error")) exec("mkdir -p ".$data["new"]["document_root"]."/web/error"); |
| | | //if(!is_dir($data["new"]["document_root"]."/log")) exec("mkdir -p ".$data["new"]["document_root"]."/log"); |
| | | if(!is_dir($data["new"]["document_root"]."/ssl")) exec("mkdir -p ".$data["new"]["document_root"]."/ssl"); |
| | | if(!is_dir($data["new"]["document_root"]."/cgi-bin")) exec("mkdir -p ".$data["new"]["document_root"]."/cgi-bin"); |
| | | |
| | | // Create the symlink for the logfiles |
| | | if(!is_link($data["new"]["document_root"]."/log")) exec("ln -s /var/log/ispconfig/httpd/".$data["new"]["domain"]." ".$data["new"]["document_root"]."/log"); |
| | | |
| | | // TODO: Create the symlinks |
| | | |
| | | // Copy the error pages |
| | | $error_page_path = escapeshellcmd($data["new"]["web_document_root"])."/web/error/"; |
| | | exec("copy /usr/local/ispconfig/server/conf/error/".escapeshellcmd($conf["language"])."/* ".$error_page_path); |
| | | |
| | | // Create group and user, if not exist |
| | | $app->uses("system"); |
| | |
| | | } |
| | | |
| | | // get alias domains (co-domains and subdomains) |
| | | $aliases = $app->db->queryAllRecords("SELECT * FROM web_domain WHERE parent_domain_id = ".$data["new"]["domain_id"]); |
| | | $aliases = $app->db->queryAllRecords("SELECT * FROM web_domain WHERE parent_domain_id = ".$data["new"]["domain_id"]." AND active = 'y'"); |
| | | $server_alias = ''; |
| | | if(is_array($aliases)) { |
| | | foreach($aliases as $alias) { |
| | |
| | | } |
| | | } |
| | | $tpl->setVar('alias',trim($server_alias)); |
| | | if(count($rewrite_rules) > 0) { |
| | | $tpl->setVar('rewrite_enabled',1); |
| | | } else { |
| | | $tpl->setVar('rewrite_enabled',0); |
| | | } |
| | | $tpl->setLoop('redirects',$rewrite_rules); |
| | | |
| | | $vhost_file = escapeshellcmd($web_config["vhost_conf_dir"].'/'.$data["new"]["domain"].'.vhost'); |