Exemplo n.º 1
0
    if ($_GET['action'] == 'upload-file') {
        // todo do for rackspace too
        if (isset($_GET['bucket']) && isset($_GET['key']) && isset($_GET['etag'])) {
            if ($_SERVER['HTTP_HOST'] != $demo_domain) {
                $uploaded_file = $APP['fs']->key_url($_GET['bucket'], $_GET['key']);
                $props = array();
                $props['id'] = sha1(rand(1, 100) . time() . $_GET['key']);
                $props['val'] = $uploaded_file;
                $new_string = new strings();
                $new_string->create_raw($props);
                $props = array();
                $props['id_hf'] = $_GET['q'];
                $props['id'] = sha1(rand(30, 50) . $_GET['key'] . $_GET['bucket'] . time());
                $props['str_file'] = $new_string->id;
                $new_hf_file = new hf_file();
                $new_hf_file->create_raw($props);
            }
        }
        // end if
    }
}
// end action (upload new helium file)
if (isset($_GET['action'])) {
    if ($_GET['action'] == 'uhf') {
        $uploaded_file = "";
        // spot-uploaded file as input hf_resource
        // todo do for rackspace too
        if ($APP['fs']->is_aws()) {
            if (isset($_GET['bucket']) && isset($_GET['key']) && isset($_GET['etag'])) {
                // Amazon S3 Upload has already been completed
                $uploaded_file = "https://s3.amazonaws.com/" . $_GET['bucket'] . "/" . $_GET['key'];