| | |
| | | parent::__construct($app); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Removes www from Domains name |
| | | * |
| | | * @param $filename the file to read |
| | | * @return $sxe a SimpleXMLElement handle |
| | | */ |
| | | public function getMainDomain($domain) { |
| | | if (substr($domain, 0, 4) == 'www.') $domain = substr($domain, 4); |
| | | return $domain; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Reads in a package metadata file and registers it's namespaces |
| | |
| | | //* Create the mysql database user if not existing |
| | | $tmp = $app->db->queryOneRecord("SELECT database_user_id FROM web_database_user WHERE database_user = ?", $settings['main_database_login']); |
| | | if(!$tmp) { |
| | | $tmppw = $app->db->queryOneRecord("SELECT PASSWORD(?) as `crypted`", $settings['main_database_password']); |
| | | $insert_data = array("sys_userid" => $websrv['sys_userid'], |
| | | "sys_groupid" => $websrv['sys_groupid'], |
| | | "sys_perm_user" => 'riud', |
| | |
| | | "server_id" => 0, |
| | | "database_user" => $settings['main_database_login'], |
| | | "database_user_prefix" => $dbuser_prefix, |
| | | "database_password" => "PASSWORD('" . $settings['main_database_password'] . "')" |
| | | "database_password" => $tmppw['crypted'] |
| | | ); |
| | | $mysql_db_user_id = $app->db->datalogInsert('web_database_user', $insert_data, 'database_user_id'); |
| | | } |
| | |
| | | $app->uses('tools_sites'); |
| | | |
| | | $webserver_id = 0; |
| | | $websrv = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain = ?", $settings['main_domain']); |
| | | $websrv = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain = ?", $this->getMainDomain($settings['main_domain'])); |
| | | if(!empty($websrv)) $webserver_id = $websrv['server_id']; |
| | | $customerid = $this->getCustomerIDFromDomain($settings['main_domain']); |
| | | $customerid = $this->getCustomerIDFromDomain($this->getMainDomain($settings['main_domain'])); |
| | | |
| | | if(empty($settings) || empty($webserver_id)) return false; |
| | | |
| | |
| | | if(in_array($postinput['main_domain'], $domains)) |
| | | { |
| | | $docroot = $app->db->queryOneRecord("SELECT document_root FROM web_domain |
| | | WHERE domain = ?", $postinput['main_domain']); |
| | | WHERE domain = ?", $this->getMainDomain($postinput['main_domain'])); |
| | | $new_path = $docroot['document_root']; |
| | | if(substr($new_path, -1) != '/') $new_path .= '/'; |
| | | $new_path .= $main_location; |
| | | |
| | | // Get the $customerid which belongs to the selected domain |
| | | $customerid = $this->getCustomerIDFromDomain($postinput['main_domain']); |
| | | $customerid = $this->getCustomerIDFromDomain($this->getMainDomain($postinput['main_domain'])); |
| | | |
| | | // First get all domains used for an install, then their loop them |
| | | // and get the corresponding document roots as well as the defined |