@@ -35,7 +35,7 @@ class dropbox
3535 const  HTTP_1  = '1.1 ' ;
3636 const  LINE_END  = "\r\n" ;
3737
38-  const  DEBUG  = false ;
38+  const  DEBUG  = true ;
3939
4040 //Array that should contain the consumer secret and 
4141 //key which should be passed into the constructor. 
@@ -266,14 +266,14 @@ public function revisions($path, array $params = array(), $root='dropbox')
266266 * Restore a file or folder to a previous revision. 
267267 * 
268268 * @param string $path The path to the file or folder in question 
269-  * @param string $revision The revision  to revert to. 
269+  * @param string $revision The rev hash  to revert to. 
270270 * @param string $root (optional) Either 'dropbox' or 'sandbox' 
271271 * @return a response object 
272272 **/ 
273273 public  function  restore ($ path$ revision$ root'dropbox ' )
274274 {
275275 $ pathstr_replace ('  ' , '%20 ' , $ path
276-  return  $ this _post_request ("/restore/ {$ root/ {$ path"  ,  array ( ' rev ' => $ revision) );
276+  return  $ this _post_request ("/restore/ {$ root/ {$ path? rev= { $ revision}"  );
277277 }
278278
279279 /** 
@@ -377,7 +377,7 @@ public function move($from, $to, $root='dropbox')
377377 // Below are the private methods used to create and send the requests to the dropbox api server. 
378378 //////////////////////////////////////////////////////////////////////////////////////////////// 
379379
380-  private  function  _post_request ($ uriarray   $ data$ specialhostfalse )
380+  private  function  _post_request ($ uri$ data =  false , $ specialhostfalse )
381381 {
382382 $ request"POST  {$ uri HTTP/ " .self ::HTTP_1 .self ::LINE_END ;
383383 $ hostself ::HOST ;
@@ -392,7 +392,7 @@ private function _post_request($uri, array $data, $specialhost = false)
392392 $ header$ this _build_header ($ url'POST ' , $ requestself ::LINE_END , $ extra
393393 if (self ::DEBUG )error_log ($ header
394394
395-  $ response$ this _connect ($ url$ header$ data
395+  $ response$ this _connect ($ url$ header' POST ' ,  $ data
396396 return  json_decode ($ response
397397 }
398398
@@ -406,7 +406,7 @@ private function _content_request($uri, $destination)
406406 $ header$ this _build_header ($ url'GET ' , $ requestself ::LINE_END , array ('Host ' =>$ specialhost
407407 if (self ::DEBUG )error_log ($ header
408408
409-  $ this _connect ($ url$ headerfalse , $ destination
409+  $ this _connect ($ url$ header' GET ' ,  false , $ destination
410410 }
411411
412412 private  function  _response_request ($ uri
@@ -418,7 +418,7 @@ private function _response_request($uri)
418418 $ header$ this _build_header ($ url'GET ' , $ requestself ::LINE_END );
419419 if (self ::DEBUG )error_log ($ header
420420
421-  $ response$ this _connect ($ url$ headerfalse );
421+  $ response$ this _connect ($ url$ header' GET ' 
422422 return  json_decode ($ response
423423 }
424424
@@ -436,14 +436,15 @@ private function _build_header($url, $method, $prepend, $append, $overwrite = ar
436436 return  $ str
437437 }
438438
439-  private  function  _connect ($ url$ header$ postdatafalse , $ destinationfalse )
439+  private  function  _connect ($ url$ header$ request ,  $ postdatafalse , $ destinationfalse )
440440 {
441441 $ chcurl_init ($ url
442442 curl_setopt ($ chCURLOPT_HTTPAUTH , CURLAUTH_BASIC  ) ;
443443 curl_setopt ($ chCURLOPT_SSLVERSION ,3 );
444444 curl_setopt ($ chCURLOPT_SSL_VERIFYPEER , FALSE );
445445 curl_setopt ($ chCURLOPT_SSL_VERIFYHOST , 2 );
446446 curl_setopt ($ chCURLOPT_RETURNTRANSFER , true );
447+  curl_setopt ($ chCURLOPT_CUSTOMREQUEST , $ request
447448 curl_setopt ($ chCURLOPT_HTTPHEADER , explode (self ::LINE_END , $ header
448449 curl_setopt ($ chCURLINFO_HEADER_OUT , true );
449450
@@ -454,6 +455,13 @@ private function _connect($url, $header, $postdata = false, $destination = false
454455 }
455456
456457 $ responsecurl_exec ($ ch
458+  
459+  if (self ::DEBUG )
460+  {
461+  error_log (print_r (curl_getinfo ($ chtrue ));
462+  error_log ($ response
463+  }
464+  
457465 //If the specified a destination and the request went OK write the file. 
458466 if ($ destinationfalse  && curl_getinfo ($ chCURLINFO_HTTP_CODE ) == '200 ' )
459467 {
0 commit comments