Report abuse

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
  public function __construct($key = null, $secret_key = null, $account_id = null, $assoc_id = null)
  {
    // Instantiate the utilities class.
    $this->util = new $this->utilities_class();

    // Determine the current service.
    $this->service = get_class($this);

    // If both a key and secret key are passed in, use those.
    if ($key && $secret_key)
    {
      $this->key = $key;
      $this->secret_key = $secret_key;      
    }

    // If neither are passed in, look for the constants instead.
    else if (defined('AWS_KEY') && defined('AWS_SECRET_KEY'))
    {
      $this->key = AWS_KEY;
      $this->secret_key = AWS_SECRET_KEY;                       
    }

    // Otherwise set the values to blank and return false.
    else
    {
      throw new TarzanCore_Exception('No valid credentials were used to authenticate with AWS.');
    }

    // If account_id is passed in, use it.
    if ($account_id)
    {
      $this->account_id = $account_id;
    }

    // If not passed in, look for the constant instead
    else if (defined('AWS_ACCOUNT_ID')) 
      {
        $this->account_id = AWS_ACCOUNT_ID; 
      }

    // If assoc_id is passed in, use it.
    if ($assoc_id)
    {
      $this->assoc_id = $assoc_id;
    }

    // If not passed in, look for the constant instead
    else if (defined('AWS_ACCOUNT_ID')) 
      {
        $this->assoc_id = AWS_ASSOC_ID; 
      }    

    return true; 
  }