function settings_menu_post($aws_acckey, $aws_seckey, $expiry)
 {
     // Save AWS S3 related settings.
     // Returns TRUE if noerrors occurred, otherwise an error message string is returned.
     // -- The Assurer, 2010-12-09.
     if (eStore_as3tp::as3key_update($aws_acckey, $aws_seckey, $expiry) != FALSE) {
         return TRUE;
     }
     return 'An error occurred while updating the AWS S3 related settings.<br />';
 }
示例#2
0
        case FALSE:
            // Malformed URI request...
            $eStore_debug_manager->downloads("Malformed or misconfigured APRTP URI request!", ESTORE_LEVEL_FALURE);
            eStore_dlvs::error(ESTORE_DLVS_APM);
            exit;
        default:
            // Unrecognized URI request...
            $eStore_debug_manager->downloads("Unrecognized eStore_aprtp::generate_url_request() return = {$retVal}", ESTORE_LEVEL_FALURE);
            eStore_dlvs::error(ESTORE_DLVS_APC);
            exit;
    }
}
if (eStore_as3tp::is_as3tp_scheme($file_path)) {
    // Amazon Web Services (AWS) Simple Storage Service (S3) URL request...
    $eStore_debug_manager->downloads("AS3TP URI request = {$file_path}", ESTORE_LEVEL_STATUS);
    $retVal = eStore_as3tp::generate_url_request($file_path, $aws_file_path);
    switch ($retVal) {
        case 1:
            // Unsigned (public) URL request...
        // Unsigned (public) URL request...
        case -1:
            // Signed (private) URL request...
            $eStore_debug_manager->downloads("Dispatching AS3TP URL = {$aws_file_path}", ESTORE_LEVEL_STATUS);
            header("Location: {$aws_file_path}");
            exit;
        case FALSE:
            // Malformed URI request...
            $eStore_debug_manager->downloads("Malformed or misconfigured AS3TP URI request!", ESTORE_LEVEL_FALURE);
            eStore_dlvs::error(ESTORE_DLVS_S3M);
            exit;
        default:
示例#3
0
 function uri_parse($uri_in, &$scheme, &$authority, &$as3_host, &$as3_bucket, &$as3_resource)
 {
     // Returns TRUE if $uri_in is a parsable AWS S3 URI.
     // A parsable URI is of the form described in RFC 3986: Scheme://[Authority@]Path
     // Supported scheme names are: "as3tp" or "as3tps"
     // Supported authorities are: Null (for "private") and "public"
     // Path is: Bucket/Resource path that identifies a unique AWS S3 object.
     // If $uri_in is parsable, the following variables are filled in:
     // $scheme = Transliterated AWS S3 URI scheme that is supported: "as3tp" --> "http" or "as3tps" --> "https"
     // $authority = Optional URI authority.
     // $as3_host = DNS host path to the bucket containing the AWS S3 resource.
     // $as3_bucket = AWS S3 bucket name containing the resource.
     // $as3_resource = The key (folder) & object (file) name contained in the AWS S3 bucket.
     // -- The Assurer, 2010-11-23.
     if (!eStore_as3tp::is_as3tp_scheme($uri_in)) {
         return FALSE;
     }
     // Qualify the scheme.
     // Parse the scheme, access key, secret key, expiry, host, bucket and resource names...
     $uri_regex = '/^as3(.+):\\/\\/(([^@]*)@)?([^\\/]+)\\/(.+)/i';
     if (preg_match_all($uri_regex, $uri_in, $uri_matches) != 1) {
         return FALSE;
     }
     // Parse URI elements.
     $scheme = 'ht' . strtolower($uri_matches[1][0]);
     // URI scheme.
     $authority = $uri_matches[3][0];
     // Optional URI authority.
     $as3_host = $uri_matches[4][0];
     // DNS host path.
     $as3_bucket = preg_replace('/\\.s3\\.amazonaws\\.com$/i', '', $as3_host);
     // Bucket name.
     $as3_resource = str_replace('%2F', '/', rawurlencode($uri_matches[5][0]));
     // Resource name.
     if (!eStore_as3tp::is_as3_bucket_name_valid($as3_bucket)) {
         return FALSE;
     }
     // Validate bucket name.
     return TRUE;
     // No parsing errors occurred.
 }