store_token($access_token, "access"); delete_token($_GET['oauth_token']); } // checks if access token is required if (!$dropbox->IsAuthorized()) { // redirect user to dropbox auth page $return_url = "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME'] . "?auth_callback=1"; $auth_url = $dropbox->BuildAuthorizeUrl($return_url); $request_token = $dropbox->GetRequestToken(); store_token($request_token, $request_token['t']); die("Authentication required. <a href='{$auth_url}'>Click here.</a>"); } echo "<pre>"; echo "<b>Account:</b>\r\n"; print_r($dropbox->GetAccountInfo()); $files = $dropbox->GetFiles("", false); if (empty($files)) { $dropbox->UploadFile("leonidas.jpg"); $files = $dropbox->GetFiles("", false); } echo "\r\n\r\n<b>Files:</b>\r\n"; print_r(array_keys($files)); if (!empty($files)) { $file = reset($files); $test_file = "test_download_" . basename($file->path); echo "<img src='" . $dropbox->GetLink($file, false) . "'/></br>"; echo "\r\n\r\n<b>Meta data of <a href='" . $dropbox->GetLink($file) . "'>{$file->path}</a>:</b>\r\n"; print_r($dropbox->GetMetadata($file->path)); echo "{$test_file}</br>"; echo "\r\n\r\n<b>Downloading {$file->path}:</b>\r\n"; print_r($dropbox->DownloadFile($file, $test_file));
$output = "="; # no update needed } else { if(islocked($lockfile)) { # is this process running already? die("!"); # abort! abort! } else { # there's an update lock($lockfile); # prevent clashes by locking file_put_contents($dropbox_sync_hash, $hash); $files = $dropbox->GetFiles($sync_directory, true); } } # - - - - - - - - - - - - - if(!empty($files)){ foreach ($files as $file) { $download = true; $filepath = str_replace($sync_directory, "", $file->path); $filecheck[] = $filepath;
store_token($access_token, "access"); delete_token($_GET['oauth_token']); } // checks if access token is required if (!$dropbox->IsAuthorized()) { // redirect user to dropbox auth page $return_url = "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME'] . "?auth_callback=1"; $auth_url = $dropbox->BuildAuthorizeUrl($return_url); $request_token = $dropbox->GetRequestToken(); store_token($request_token, $request_token['t']); die("Authentication required. <a href='{$auth_url}'>Click here.</a>"); } if ($uploadOk == 2) { $dropbox->UploadFile($target_file); } $files = $dropbox->GetFiles("", true); ?> <html> <head> <title>Dropbox Images</title> <style type="text/css"> .submitLink { background-color: transparent; text-decoration: underline; border: none; color: blue; cursor: pointer; } table, td, th{ border: 1px solid black; text-align : left;
store_token($access_token, "access"); delete_token($_GET['oauth_token']); } // checks if access token is required if (!$dropbox->IsAuthorized()) { // redirect user to dropbox auth page $return_url = "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME'] . "?auth_callback=1"; $auth_url = $dropbox->BuildAuthorizeUrl($return_url); $request_token = $dropbox->GetRequestToken(); store_token($request_token, "access"); die("Authentication required. <a href='{$auth_url}'>Click here.</a>"); } echo "<pre>"; echo "<b>Account:</b>\r\n"; print_r($dropbox->GetAccountInfo()); $files = $dropbox->GetFiles("", False); echo "\r\n\r\n<b>Files:</b>\r\n"; // print_r(array_keys($files)); // print_r($files); foreach ($files as $file) { echo "NAME : " . basename($file->path) . "<br>"; echo "PATH : " . $file->path . "<br>"; echo "LAST MODIFIED : " . $file->modified . "<br>"; if ($file->is_dir) { echo "<a href='#'>Open Folder</a><br>"; } else { echo "SIZE : " . $file->size . "<br>"; echo "<a href='download.php?dbxPath=" . $file->path . "'>Download</a> <a href='" . $dropbox->GetLink($file->path) . "'>Share</a> "; echo " <a href='delete.php?dbxPath=" . $file->path . "'>Delete</a>"; } echo "<br>";