Ejemplo n.º 1
0
    $o = opendir($directory);
    while ($r = readdir($o)) {
        if ($r != "." && $r != ".." && $r != ".DS_Store") {
            if (is_dir($directory . $r)) {
                $subdirectories[] = $r;
            } else {
                $files[] = $r;
            }
        }
    }
} else {
    // If we're at ../ on the root of a container, go back to listing containers
    if ($_POST["directory"] == "../" && $postcontainer) {
        $postcontainer = false;
    }
    $cloud = new BigTreeCloudStorage($location);
    if (!$postcontainer) {
        $containers = $cloud->listContainers();
    } else {
        $subdirectories[] = "..";
        $container = $cloud->getContainer($_POST["container"]);
        if (!$postdirectory) {
            $folder = $container["tree"];
        } else {
            $folder = $cloud->getFolder($container, $postdirectory);
        }
        foreach ($folder["folders"] as $name => $contents) {
            $subdirectories[] = $name;
        }
        foreach ($folder["files"] as $file) {
            $files[] = $file["name"];
Ejemplo n.º 2
0
<?php

$storage = new BigTreeStorage();
$storage->Settings->Service = $_POST["service"];
$cloud = new BigTreeCloudStorage($_POST["service"]);
if ($_POST["container"]) {
    $storage->Settings->Container = $_POST["container"];
    // If we're using Rackspace, we need to explicitly CDN enable this container.
    if ($_POST["service"] == "rackspace") {
        BigTree::cURL($cloud->RackspaceCDNEndpoint . "/" . $_POST["container"], "", array(CURLOPT_PUT => true, CURLOPT_HTTPHEADER => array("X-Auth-Token: " . $cloud->Settings["rackspace"]["token"], "X-Cdn-Enabled: true")));
    }
} else {
    // We're only going to try to get a unique bucket 10 times to prevent an infinite loop
    $x = 0;
    $success = false;
    while (!$success && $x < 10) {
        $container = $cms->urlify(uniqid("bigtree-container-", true));
        $success = $cloud->createContainer($container, true);
        $x++;
    }
    if ($success) {
        $storage->Settings->Container = $container;
    } else {
        $admin->growl("Developer", "Failed to create container.", "error");
        BigTree::redirect(DEVELOPER_ROOT . "cloud-storage/");
    }
}
$container = $cloud->getContainer($storage->Settings->Container);
if ($container === false) {
    $admin->growl("Developer", "Failed to read container.", "error");
    BigTree::redirect(DEVELOPER_ROOT . "cloud-storage/");
Ejemplo n.º 3
0
<?php

$storage = new BigTreeStorage();
if ($_POST["service"] != "local") {
    $cloud = new BigTreeCloudStorage($_POST["service"]);
    $containers = $cloud->listContainers();
    if ($containers === false) {
        $admin->growl("Developer", "Invalid Cloud Storage Setup: " . ucwords($_POST["service"]), "error");
        BigTree::redirect(DEVELOPER_ROOT . "cloud-storage/");
    } else {
        $service_names = array("amazon" => "Amazon S3", "rackspace" => "Rackspace Cloud Files", "google" => "Google Cloud Storage");
        ?>
<div class="container">
	<form method="post" action="<?php 
        echo DEVELOPER_ROOT;
        ?>
cloud-storage/set-container/">
		<input type="hidden" name="service" value="<?php 
        echo htmlspecialchars($_POST["service"]);
        ?>
" />
		<summary><h2><?php 
        echo $service_names[$_POST["service"]];
        ?>
</h2></summary>
		<section>
			<label>Existing Container/Bucket <small>(this should be used exclusively by BigTree, if left blank BigTree will make its own)</small></label>
			<select name="container">
				<option></option>
				<?php 
        foreach ($containers as $container) {