if (!empty($name) && !empty($url) && !empty($membership) && !empty($has_public_acl)) { $valid = true; if (!(stristr($url, "http://") || stristr($url, "https://")) || substr($url, -1) != "/") { $valid = false; register_error(elgg_echo("subsite_manager:action:subsites:new:error:validate:url:invalid")); } elseif (get_site_by_url($url)) { $valid = false; register_error(elgg_echo("subsite_manager:action:subsites:new:error:validate:url:duplicate")); } if ($valid) { $url = strtolower($url); $site = new Subsite(); $site->name = $name; $site->description = $description; $site->url = $url; if (!($guid = $site->save())) { register_error(elgg_echo("IOException:UnableToSaveNew", array(get_class($site)))); $site = null; } else { $site = get_entity($guid); $site->createACL(); // set default language $lan = get_config("language", $CONFIG->site_guid); set_config("language", $lan, $site->getGUID()); // set default access set_config("default_access", $site->getACL(), $site->getGUID()); // default allow registration set_config("allow_registration", true, $site->getGUID()); // enable simple cache datalist_set("simplecache_enabled_" . $site->getGUID(), 1); // enable file path cache