From: indresh Date: Thu, 19 Apr 2018 11:09:19 +0530 Subject: Merge branch 'develop' of https://openforge.gov.in/plugins/git/digitallocker/development_auth_partner_sm_app into develop --- Merge branch 'develop' of https://openforge.gov.in/plugins/git/digitallocker/development_auth_partner_sm_app into develop --- --- 'a/browse.php' +++ b/browse.php @@ -23,8 +23,7 @@ curl_setopt($ch, CURLOPT_TCP_NODELAY, 1) curl_setopt($ch, CURLOPT_HTTPHEADER, $ur); $output = curl_exec($ch); curl_close($ch); -$outputData = explode('¿', $output); -$data = (array) json_decode($outputData[1]); +$data = (array) json_decode($output); if (isset($data['size'])) { $message = "File Uploaded Successfully"; } else { --- 'a/doc.php' +++ b/doc.php @@ -17,18 +17,14 @@ $post = array( $vh = curl_init($url); curl_setopt($vh, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($vh, CURLOPT_POST, true); -curl_setopt($vh, CURLOPT_TIMEOUT, 30); //timeout after 30 seconds +curl_setopt($vh, CURLOPT_TIMEOUT, 30); curl_setopt($vh, CURLOPT_POSTFIELDS, $post); curl_setopt($vh, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($vh, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($vh, CURLOPT_RETURNTRANSFER, true); $result = curl_exec($vh); curl_close($vh); -$notgettingdata = explode('¿', $result); -if(!$notgettingdata[1]){ -header("Location: index.php?message=THIS IS ERROR"); -} -$getToken = json_decode($notgettingdata[1]); +$getToken = json_decode($result); if (isset($getToken->access_token)) { $access_token = $getToken->access_token; } @@ -64,16 +60,15 @@ $headers = array( ); $urlFile = $config['file_uri']; $vhf = curl_init($urlFile); -curl_setopt($vhf, CURLOPT_TIMEOUT, 30); //timeout after 30 seconds +curl_setopt($vhf, CURLOPT_TIMEOUT, 30); curl_setopt($vhf, CURLOPT_HTTPHEADER, $headers); curl_setopt($vhf, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($vhf, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($vhf, CURLOPT_RETURNTRANSFER, true); $resFile = curl_exec($vhf); curl_close($vhf); -$resFileNew = explode('¿', $resFile); -$uriRes = json_decode($resFileNew[1]); -if(isset($uriRes->error) || !$resFileNew){ +$uriRes = json_decode($resFile); +if(isset($uriRes->error) || !$resFile){ header("Location: index.php?message=".$uriRes->error_description); exit; } @@ -91,14 +86,13 @@ $uriItems = array_merge($uriDir, $uriFil $uriItemsArray[$item] = $uriItems; $dataDirectory['directory'] = $uriRes->directory; $dataF = array_merge($dataDirectory, $uriItemsArray); - $headers = array( 'Authorization: Bearer ' . $access_token //'Authorization: Basic '. base64_encode("$username:$password") ); $urlissued = $config['issued_doc_url']; $vhi = curl_init($urlissued); -curl_setopt($vhi, CURLOPT_TIMEOUT, 30); //timeout after 30 seconds +curl_setopt($vhi, CURLOPT_TIMEOUT, 30); curl_setopt($vhi, CURLOPT_HTTPHEADER, $headers); curl_setopt($vhi, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($vhi, CURLOPT_SSL_VERIFYHOST, 0); @@ -106,8 +100,7 @@ curl_setopt($vhi, CURLOPT_RETURNTRANSFER $resissued = curl_exec($vhi); $resissuedErr = curl_error($vhi); curl_close($vhi); -$issuedNew = explode('¿', $resissued); -$dataI = json_decode($issuedNew[1], TRUE); +$dataI = json_decode($resissued, TRUE); include 'header.php'; ?> --- 'a/download.php' +++ b/download.php @@ -2,11 +2,10 @@ include 'config.php'; $headers = array( 'Authorization: Bearer ' . $_POST['accesstoken'] - //'Authorization: Basic '. base64_encode("$username:$password") ); $uriFile = $config['download_file_uri'] . $_POST['uri']; $uri = curl_init($uriFile); -curl_setopt($uri, CURLOPT_TIMEOUT, 30); //timeout after 30 seconds +curl_setopt($uri, CURLOPT_TIMEOUT, 30); curl_setopt($uri, CURLOPT_HTTPHEADER, $headers); curl_setopt($uri, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($uri, CURLOPT_SSL_VERIFYHOST, 0); --- 'a/uploaddoc.php' +++ b/uploaddoc.php @@ -17,18 +17,14 @@ $post = array( $vh = curl_init($url); curl_setopt($vh, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($vh, CURLOPT_POST, true); -curl_setopt($vh, CURLOPT_TIMEOUT, 30); //timeout after 30 seconds +curl_setopt($vh, CURLOPT_TIMEOUT, 30); curl_setopt($vh, CURLOPT_POSTFIELDS, $post); curl_setopt($vh, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($vh, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($vh, CURLOPT_RETURNTRANSFER, true); $result = curl_exec($vh); curl_close($vh); -$notgettingdata = explode('¿', $result); -if(!$notgettingdata[1]){ -header("Location: index.php?message=THIS IS ERROR"); -} -$getToken = json_decode($notgettingdata[1]); +$getToken = json_decode($result); if (isset($getToken->access_token)) { $access_token = $getToken->access_token; } @@ -64,16 +60,15 @@ $headers = array( ); $urlFile = $config['file_uri']; $vhf = curl_init($urlFile); -curl_setopt($vhf, CURLOPT_TIMEOUT, 30); //timeout after 30 seconds +curl_setopt($vhf, CURLOPT_TIMEOUT, 30); curl_setopt($vhf, CURLOPT_HTTPHEADER, $headers); curl_setopt($vhf, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($vhf, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($vhf, CURLOPT_RETURNTRANSFER, true); $resFile = curl_exec($vhf); curl_close($vhf); -$resFileNew = explode('¿', $resFile); -$uriRes = json_decode($resFileNew[1]); -if(isset($uriRes->error) || !$resFileNew){ +$uriRes = json_decode($resFile); +if(isset($uriRes->error) || !$resFile){ header("Location: index.php?message=".$uriRes->error_description); exit; } --- 'a/uri.php' +++ b/uri.php @@ -1,24 +1,20 @@ items as $uriI) {