Skip to content

Commit

Permalink
Prevent examples from running in CLI mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben Tadiar committed Jan 27, 2012
1 parent 2894058 commit 9b5417c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion examples/bootstrap.php
Expand Up @@ -5,6 +5,11 @@
* @link https://github.com/BenTheDesigner/Dropbox/tree/master/examples
*/

// Prevent access via command line interface
if (PHP_SAPI === 'cli') {
exit('bootstrap.php must not be run via the command line interface');
}

// Don't allow direct access to the boostrap
if(basename($_SERVER['REQUEST_URI']) == 'bootstrap.php'){
exit('bootstrap.php does nothing on its own. Please see the examples provided');
Expand All @@ -27,7 +32,7 @@
$callback = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];

// Instantiate the required Dropbox objects
$encrypter = new \Dropbox\OAuth\Storage\Encrypter('12345678901234567890123456789012');
$encrypter = new \Dropbox\OAuth\Storage\Encrypter('XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX');
$storage = new \Dropbox\OAuth\Storage\Session($encrypter);
$OAuth = new \Dropbox\OAuth\Consumer\Curl($key, $secret, $storage, $callback);
$dropbox = new \Dropbox\API($OAuth);

0 comments on commit 9b5417c

Please sign in to comment.