예제 #1
0
<?php

include "autoload.php";
$digitalOcean = new DigitalOcean();
var_dump($digitalOcean->getAllSlaveDroplets()->getLeastBusyServer());
예제 #2
0
<?php

require_once "functions.php";
try {
    $do = new DigitalOcean("client_id", "api_key");
    $response = $do->droplets();
    print_r($response);
} catch (Exception $e) {
    echo $e->getMessage();
}
예제 #3
0
<?php

require_once "header.inc.php";
?>

<?php 
echo "<div class='large-form-signin'>";
echo "<h3 class='form-signin-heading'><i class='icon-key'></i> Key</h3>";
try {
    $do = new DigitalOcean(do_clientid, do_apikey);
    $response = $do->ssh_key_info($_GET['keyid']);
} catch (Exception $e) {
    echo $e->getMessage();
    exit;
}
echo "<h4>" . $response['name'] . "</h4>";
echo "<p>";
echo "<b>Public Key: </b>" . wordwrap($response['ssh_pub_key'], 20, "\n", true) . "<br>";
echo "</p>";
echo "</div>";
?>
 
<?php 
require_once "footer.inc.php";
예제 #4
0
<?php 
require_once "header.inc.php";
?>

<h3><i class='icon-key'></i> My SSH-Keys</h3>
<div class="row">

<?php 
$do = new DigitalOcean(do_clientid, do_apikey);
$response = $do->ssh_keys();
if ($response) {
    foreach ($response as $item) {
        echo "<div class='col-lg-4'>";
        echo "<a title='" . $item['name'] . "' href='key.php?keyid=" . $item['id'] . "' class='thumbnail' style='text-decoration: none;'>";
        echo "<h1 style='float: left; padding-right: 5px;' id='key'><i class='icon-key'></i></h1>";
        echo "<span id='details'><b>" . $item['name'] . "</b></span><br><br><br>";
        echo "</a>";
        echo "</div>";
    }
}
?>
 
</div>



<?php 
require_once "footer.inc.php";
예제 #5
0
<?php

include 'Model/DigitalOcean.php';
error_reporting(0);
$serverCollection = new SlaveServerCollection();
$digitalocean = new DigitalOcean();
$serverCollection = $digitalocean->getAllSlaveDroplets();
$view = new stdClass();
$view->selectedserver = $serverCollection->getLeastBusyServer();
if (isset($_GET['stream']) && isset($_GET['application'])) {
    $view->application = $_GET['application'];
    $view->stream = $_GET['stream'];
} else {
    $view->application = "bbc1";
    $view->stream = "test";
}
include "View/StreamIframe.phtml";
예제 #6
0
<?php 
require_once "header.inc.php";
?>

	<div class='large-form-signin'>
		<h3 class='form-signin-heading'><i class='icon-cloud'></i> My Status</h3><br>
		<?php 
$do = new DigitalOcean(do_clientid, do_apikey);
$response = $do->droplets_count();
echo "<p><i class='icon-tint'></i> Number of Droplets: <span class='badge'>" . $response . "</span></p>";
?>
	</div>
<?php 
require_once "footer.inc.php";
예제 #7
0
<?php

include "autoload.php";
header('Access-Control-Allow-Origin: *');
error_reporting(4);
$digitalOcean = new DigitalOcean();
$servers = $digitalOcean->getMasterServer();
$view = new stdClass();
$view->streams = array();
foreach ($servers->servers as $server) {
    foreach ($server->nginx->server->application as $application) {
        foreach ($application->live->stream as $stream) {
            if ($stream->name != "test" && $stream->bw_in > 0) {
                $view->streams[] = new Stream($stream, $application->name);
            }
        }
    }
}
function cmp($a, $b)
{
    return strcmp($a->applicationname, $b->applicationname);
}
usort($view->streams, cmp);
echo json_encode($view->streams);
예제 #8
0
<?php 
require_once "header.inc.php";
?>

<h3><i class='icon-tint'></i> My Domains</h3>
<div class="row">

<?php 
$do = new DigitalOcean(do_clientid, do_apikey);
$response = $do->domains();
if ($response) {
    foreach ($response as $item) {
        echo "<div class='col-lg-4'>";
        echo "<a title='" . $item['name'] . "' href='domain.php?domainid=" . $item['id'] . "' class='thumbnail' style='text-decoration: none;'>";
        echo "<h1 style='float: left; padding-right: 5px;' id='glove'><i class='icon-globe'></i></h1>";
        echo "<span id='details'><b>" . $item['name'] . "</b><br><br><br>";
        echo "</a>";
        echo "</div>";
    }
}
?>
 
</div>



<?php 
require_once "footer.inc.php";
예제 #9
0
<?php

require_once "header.inc.php";
?>

<?php 
echo "<div class='large-form-signin'>";
echo "<h3 class='form-signin-heading'><i class='icon-tint'></i> Domain</h3>";
try {
    $do = new DigitalOcean(do_clientid, do_apikey);
    $response = $do->domain_info($_GET['domainid']);
} catch (Exception $e) {
    echo $e->getMessage();
    exit;
}
echo "<h4>" . $response['name'] . "</h4>";
echo "<p>";
echo "<b>TTL: </b>" . $response['ttl'] . "<br>";
echo "</p>";
echo "<h4>Domain Records</h4>";
$r2 = $do->domain_records($_GET['domainid']);
foreach ($r2 as $record) {
    echo "<b>" . $record['record_type'] . "</b>";
    if (!empty($record['name'])) {
        echo " - " . $record['name'];
    }
    echo " - " . $record['data'];
    if (empty($record['priority'])) {
        echo "<br>";
    } else {
        echo " (" . $record['priority'] . ")<br>";