/** * Add Server * * Create a new ServerDBO and store it in the database */ function add_server() { // Create a new Server DBO $server_dbo = new ServerDBO(); $server_dbo->setHostName($this->post['hostname']); $server_dbo->setLocation($this->post['location']); // Add ServerDBO to database add_ServerDBO($server_dbo); // Success $this->setMessage(array("type" => "[SERVER_ADDED]")); $this->gotoPage("services_view_server", null, "server=" . $server_dbo->getID()); }
/** * Get CPanel Server DBO * * Given a server DBO, retrieves the associated CPanel Server DBO * * @param ServerDBO The server to query */ protected function getCPanelServerDBO(ServerDBO $serverDBO) { return load_CPanelServerDBO($serverDBO->getID()); }
/** * Load multiple ServerDBO'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_ServerDBO($filter = null, $sortby = null, $sortdir = null, $limit = null, $start = null) { $DB = DBConnection::getDBConnection(); // Build query $sql = $DB->build_select_sql("server", "*", $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 $server_dbo_array = array(); while ($data = mysql_fetch_array($result)) { // Create and initialize a new ServerDBO with the data from the DB $dbo = new ServerDBO(); $dbo->load($data); // Add ServerDBO to array $server_dbo_array[] = $dbo; } return $server_dbo_array; }