Exemplo n.º 1
0
 /**
  * Get Data
  *
  * @return array value => description
  */
 function getData()
 {
     // Query IPDBO's
     $ips = array();
     try {
         // Convery to an array: hosting ID => hosting service name
         $ipDBOs = load_array_IPAddressDBO();
         foreach ($ipDBOs as $ipDBO) {
             $ips[$ipDBO->getIP()] = $ipDBO->getHostnameIP();
         }
     } catch (DBNoRowsFoundException $e) {
     }
     return $ips;
 }
 /**
  * Initialize the Table
  *
  * @param array $params Parameters from the {form_table} tag
  */
 public function init($params)
 {
     parent::init($params);
     // Build a where clause
     $where = isset($this->serverID) ? sprintf("serverid='%d'", $this->serverID) : null;
     // Load the IP Address pool
     try {
         // Build the table
         $IPAddresses = load_array_IPAddressDBO($where);
         foreach ($IPAddresses as $dbo) {
             // Put the row into the table
             $this->data[] = array("ipaddress" => $dbo->getIP(), "ipaddressstring" => $dbo->getIPString(), "server" => $dbo->getServerID(), "hostname" => $dbo->getHostName(), "isAvailable" => $dbo->isAvailable(), "accountname" => $dbo->getAccountName(), "service" => $dbo->getServiceTitle());
         }
     } catch (DBNoRowsFoundException $e) {
     }
 }
/**
 * Delete HostingServicePurchaseDBO from database
 *
 * @param HostingServicePurchaseDBO &$dbo HostingServicePurchaseDBO to delete
 * @return True on success
 */
function delete_HostingServicePurchaseDBO(&$dbo)
{
    $DB = DBConnection::getDBConnection();
    // Release any IP Addresses assigned to this purchase
    try {
        $ip_dbo_array = load_array_IPAddressDBO("purchaseid = " . $dbo->getID());
        foreach ($ip_dbo_array as $ip_dbo) {
            // Remove IP address from this purchase
            $ip_dbo->setPurchaseID(0);
            update_IPAddressDBO($ip_dbo);
        }
    } catch (DBNoRowsFoundException $e) {
    }
    // Build DELETE query
    $sql = $DB->build_delete_sql("hostingservicepurchase", "id = " . $dbo->getID());
    // Run query
    if (!mysql_query($sql, $DB->handle())) {
        throw new DBException(mysql_error($DB->handle()));
    }
}
Exemplo n.º 4
0
 /**
  * Get IP Addresses
  *
  * Returns an array of IPAddressDBO's assigned to this server
  *
  * @return array Array of IPAddressDBO's
  */
 function getIPAddresses()
 {
     try {
         load_array_IPAddressDBO("serverid=" . $this->getID());
     } catch (DBNoRowsFoundException $e) {
         return array();
     }
 }