/** * Create an Account */ public function createAccount(ServerDBO $serverDBO, HostingServiceDBO $serviceDBO, $domainName, $username, $password) { $CPServerDBO = $this->getCPanelServerDBO($serverDBO); $result = createacct($serverDBO->getHostName(), $CPServerDBO->getUsername(), $CPServerDBO->getAccessHash(), false, $domainName, $username, $password, $serviceDBO->getTitle()); if (null == stristr($result, "wwwacct creation finished")) { throw new SWUserException("[CPANEL_FAILED_TO_CREATE_ACCOUNT]: " . $result); } }
/** * Add Hosting * * Add the HostingServiceDBO to the database */ function add_hosting() { // Prepare HostingServiceDBO for database $service_dbo = new HostingServiceDBO(); $service_dbo->setTitle($this->post['title']); $service_dbo->setDescription($this->post['description']); $service_dbo->setUniqueIP($this->post['uniqueip']); $service_dbo->setDomainRequirement($this->post['domainrequirement']); $service_dbo->setPublic(isset($this->post['public']) ? "Yes" : "No"); // Insert HostingServiceDBO into database add_HostingServiceDBO($service_dbo); // Done $this->gotoPage("services_edit_hosting", null, "hservice=" . $service_dbo->getID()); }
/** * Load multiple HostingServiceDBO's from database * * @param string $filter A WHERE clause * @param string $sortby Field name to sort results by * @param string $sortdir Direction to sort in (ASEC or DESC) * @param int $limit Limit the number of results * @param int $start Record number to start the results at * @return array Array of HostingServiceDBO's */ function &load_array_HostingServiceDBO($filter = null, $sortby = null, $sortdir = null, $limit = null, $start = null) { $DB = DBConnection::getDBConnection(); // Build query $sql = $DB->build_select_sql("hostingservice", "*", $filter, $sortby, $sortdir, $limit, $start); // Run query if (!($result = @mysql_query($sql, $DB->handle()))) { // Query error throw new DBException(mysql_error($DB->handle())); } if (mysql_num_rows($result) == 0) { // No services found throw new DBNoRowsFoundException(); } // Build an array of HostingServiceDBOs from the result set $service_dbo_array = array(); while ($data = mysql_fetch_array($result)) { // Create and initialize a new HostingServiceDBO with the data from the DB $dbo = new HostingServiceDBO(); $dbo->load($data); // Add HostingServiceDBO to array $service_dbo_array[] = $dbo; } return $service_dbo_array; }