authpartner
Clone or download
Merge branch 'develop' of https://openforge.gov.in/plugins/git/digitallocker/development_auth_partner_sm_app
Modified Files
--- 'a/browse.php'
+++ b/browse.php
@@ -3,7 +3,7 @@
$fileBrowse = $_FILES['fileUpload']['tmp_name'];
$filePath = $_POST['filePath'] . "/" . $_FILES['fileUpload']['name'];
$access_token = $_POST['accesstoken'];
-$fileContent = file_get_contents($fileBrowse);
+$fileContent = trim(file_get_contents($fileBrowse));
$finfo = new \finfo(FILEINFO_MIME_TYPE);
$mime = $finfo->buffer($fileContent);
$client_secret = $config['client_secret_upload'];
@@ -23,7 +23,13 @@ curl_setopt($ch, CURLOPT_TCP_NODELAY, 1)
curl_setopt($ch, CURLOPT_HTTPHEADER, $ur);
$output = curl_exec($ch);
curl_close($ch);
-header("Location: uploaddoc.php?code=".$_POST['code']."&state=".$_POST['state']); /* Redirect browser */
+$outputData = explode('¿', $output);
+$data = (array) json_decode($outputData[1]);
+if (isset($data['size'])) {
+ $message = "File Uploaded Successfully";
+} else {
+ $message = "File Not Uploaded Successfully";
+}
+header("Location: uploaddoc.php?code=".$_POST['code']."&state=".$_POST['state']."&message=".$message); /* Redirect browser */
exit();
-
?>
\ No newline at end of file
--- 'a/doc.php'
+++ b/doc.php
@@ -1,4 +1,7 @@
<?php
+if(isset($_GET['error'])){
+header("Location: index.php");
+}
include 'config.php';
$code = $_GET['code'];
$state = $_GET['state'];
@@ -21,6 +24,9 @@ curl_setopt($vh, CURLOPT_RETURNTRANSFER,
$result = curl_exec($vh);
curl_close($vh);
$notgettingdata = explode('¿', $result);
+if(!$notgettingdata[1]){
+header("Location: index.php");
+}
$getToken = json_decode($notgettingdata[1]);
if (isset($getToken->access_token)) {
@@ -154,19 +160,19 @@ include 'header.php';
<?php
if (($api_detail['type']) == "dir") {
echo '<td onclick="uriData(' . $api_detail['id'] . ',' . $api_detail['parent'] . ')">';
- echo '<img src="images/folder.svg"></img>';
- echo($api_detail['name']);
+ echo '<img src="images/folder.svg" style="margin-right:10px;"></img>';
+ echo ($api_detail['name']);
echo "</td>";
}
if ($api_detail['type'] == "file") {
echo "<td>";
- echo '<img src="images/file.svg"></img>';
+ echo '<img src="images/file.svg" style="margin-right:10px;"></img>';
echo($api_detail['name']);
echo "</td>";
}
?>
<td><?php echo($api_detail['size']); ?></td>
- <td><?php echo($api_detail['date']); ?></td>
+ <td><?php echo date("d-m-Y", strtotime($api_detail['date'])); ?></td>
<?php if ($api_detail['type'] == "file") { ?>
<td>
<i onclick="download('<?php echo($api_detail['uri'] . ',' . $api_detail['name']); ?>')" class="fa fa-download"> </i>
@@ -182,7 +188,7 @@ include 'header.php';
</table>
<div class="footer">
<a class="btn btn-default" style="float: right; margin-left: 10px; border-radius:5px;" href="payment.php">Complete Payment</a>
- <a class="btn btn-default" style="float: right; border-radius:5px;" href="index.php">Cancel</a>
+ <a class="btn btn-default" style="float: right; border-radius:5px;" href="tokan.php">Cancel</a>
</div>
</div>
</div>
@@ -208,7 +214,7 @@ include 'header.php';
?>
<tr><td>
<?php
- echo '<img src="images/issuedfile.png"></img>';
+ echo '<img src="images/issuedfile.png" style="margin-right:10px;"></img>';
echo($issued_detail['name']);
?>
</td>
@@ -226,7 +232,7 @@ include 'header.php';
</table>
<div class="footer">
<a class="btn btn-default" style="float: right; margin-left: 10px; border-radius:5px;" href="payment.php">Complete Payment</a>
- <a class="btn btn-default" style="float: right; border-radius:5px;" href="index.php">Cancel</a>
+ <a class="btn btn-default" style="float: right; border-radius:5px;" href="tokan.php">Cancel</a>
</div>
</div>
</div>
@@ -262,11 +268,11 @@ function uriData(id, parent) {
$.each(result.items, function (i, l) {
if (result.items[i].type == "file") {
console.log(result.items);
- fileOrFolder = '<img src="images/file.svg"></img>';
+ fileOrFolder = '<img src="images/file.svg" style="margin-right:10px;"></img>';
onclickFnc = "onclick='thisIsNotAFolder()'";
dwnldTd = "<td><i onclick = 'download(\"" + result.items[i].uri + "\",\"" + result.items[i].name + "\");'; class='fa fa-download'> </i></td>";
} else {
- fileOrFolder = '<img src="images/folder.svg"></img>';
+ fileOrFolder = '<img src="images/folder.svg" style="margin-right:10px;"></img>';
onclickFnc = "onclick='uriData(" + result.items[i].id + "," + result.items[i].parent + ")'";
dwnldTd = "<td></td>";
}
@@ -278,7 +284,7 @@ function uriData(id, parent) {
$(".se-pre-con").hide();
}, "json")
.fail(function () {
- $("#folderPath").html("No document available in this folder");
+ $("#folderPath").html("No Document Available In This Folder");
$(".se-pre-con").hide();
});
}
--- 'a/download.php'
+++ b/download.php
@@ -18,5 +18,4 @@ $binarydata = base64_encode($urFile);
$arr = array($mime,$binarydata);
echo json_encode($arr);
-
?>
--- 'a/header.php'
+++ b/header.php
@@ -40,7 +40,7 @@
.dropdown{
margin:6px 16px;
color:#fff !important;
- cursor: pointer; cursor: hand;
+ cursor: pointer; cursor: hand;
}
.dropdown-submenu {
@@ -52,7 +52,7 @@
.dropdown-menu>li{
margin-left: -15px;
- cursor: pointer; cursor: hand;
+ cursor: pointer; cursor: hand;
}
</style>
</head>
@@ -107,7 +107,6 @@
<li><a tabindex="-1" >Basic Banking Course</a></li><hr>
<li><a tabindex="-1" >Life Certificate (LIC)</a></li><hr>
<li><a tabindex="-1" >Pin Pad Device Payment Service</a></li>
-
</ul>
</div>
</li>
@@ -118,7 +117,7 @@
<li><a tabindex="-1" href="https://digilocker.gov.in/public/register">Open Digilocker Account</a>
</li><hr>
<li>
- <span><form action = "<?php echo $config['code_download']?>" method = "GET" role="form">
+ <span><form action = "<?php echo $config['code_download'] ?>" method = "GET" role="form">
<div class="form-group has-success" style="display:none">
<label class="control-label" for="inputSuccess">Response Type</label>
<input type="text" class="form-control" name = "response_type" value="code">
--- 'a/payment.php'
+++ b/payment.php
@@ -49,10 +49,9 @@
</div>
<div class='form-row'>
<div class='col-md-12 form-group' style="text-align: center;">
- <a class=" col-md-12 btn btn-default"style="margin-top: 10px;" href="index.php">Pay</a>
+ <a class=" col-md-12 btn btn-default"style="margin-top: 10px;" href="tokan.php">Pay</a>
</div>
</div>
-
<div class='form-row'>
<div class='col-md-12 error form-group hide'>
<div class='alert-danger alert'>
--- /dev/null
+++ b/tokan.php
@@ -0,0 +1,25 @@
+<?php
+
+ $doc = new DOMDocument('1.0');
+ $doc->formatOutput = true;
+ $root = $doc->createElement('maincontent');
+ $root = $doc->appendChild($root);
+ $title = $doc->createElement('code');
+ $title = $root->appendChild($title);
+ $enclosure = $doc->createAttribute('num');
+ $enclosure->value = "";
+ $title->appendChild($enclosure);
+ $title = $doc->createElement('access_token');
+ $title = $root->appendChild($title);
+ $text = $doc->createTextNode("");
+ $text = $title->appendChild($text);
+ $doc->save("xml/hashKey.xml");
+ $doc->save("xml/hashhKey.xml");
+if (file_exists("xml/hashKey.xml")) {
+ $xml = (array) simplexml_load_file("xml/hashKey.xml") or die("Error: Cannot create object");
+} else {
+ echo "xml/hashKey.xml file doesnot exists";
+}
+header("Location: index.php");
+?>
+
--- 'a/uploaddoc.php'
+++ b/uploaddoc.php
@@ -1,4 +1,7 @@
<?php
+if(isset($_GET['error'])){
+header("Location: index.php");
+}
include 'config.php';
$code = $_GET['code'];
$state = $_GET['state'];
@@ -21,6 +24,9 @@ curl_setopt($vh, CURLOPT_RETURNTRANSFER,
$result = curl_exec($vh);
curl_close($vh);
$notgettingdata = explode('¿', $result);
+if(!$notgettingdata[1]){
+header("Location: index.php");
+}
$getToken = json_decode($notgettingdata[1]);
if (isset($getToken->access_token)) {
@@ -114,6 +120,20 @@ include 'header.php';
<div class="row">
<div class="col-lg-12">
<div class="container">
+ <?php
+ if (isset($_GET['message'])) {
+ $alert = "red";
+ if ($_GET['message'] == "File Uploaded Successfully") {
+ $alert = "green";
+ }
+ //echo "<div style='background:" . $alert . "' class='alert'>" . $_GET['message'] . "</div>";
+ echo "<div class='alert' id='alert' style='color:" . $alert . "'> <button type='button' class='close' data-dismiss='alert'>x</button>" . $_GET['message'] . "</div>";
+ }
+ ?>
+ </div>
+ </div>
+ <div class="col-lg-12">
+ <div class="container">
<ul class="nav nav-tabs">
<li class="active"><a data-toggle="tab" href="#uploadeddocument"><img src="images/uploaded_files.png">Uploaded Document</a></li>
</ul>
@@ -143,55 +163,55 @@ include 'header.php';
</div>
</div>
<div class="table-responsive">
- <table class="table">
- <thead style="color:blueviolet;">
- <tr>
- <td>Name</td>
- <td>Size</td>
- <td>Date</td>
- <td id="tdUri" style="display:none;">URI</td>
- </tr>
- </thead>
- <tbody id="folderPath">
- <?php
- foreach ((array) ($dataF['items']) as $api_detail) {
- if (isset($api_detail['id'])) {
- $api_detail['id'] = $api_detail['id'];
- $api_detail['parent'] = $api_detail['parent'];
- } else {
- $api_detail['id'] = "";
- }
- ?>
+ <table class="table">
+ <thead style="color:blueviolet;">
<tr>
- <?php
- if (($api_detail['type']) == "dir") {
- echo '<td onclick="uriData(' . $api_detail['id'] . ',' . $api_detail['parent'] . ')">';
- echo '<img src="images/folder.svg"></img>';
- echo($api_detail['name']);
- }
- if ($api_detail['type'] == "file") {
- echo "<td>";
- echo '<img src="images/file.svg"></img>';
- echo($api_detail['name']);
+ <td>Name</td>
+ <td>Size</td>
+ <td>Date</td>
+ <td id="tdUri" style="display:none;">URI</td>
+ </tr>
+ </thead>
+ <tbody id="folderPath">
+ <?php
+ foreach ((array) ($dataF['items']) as $api_detail) {
+ if (isset($api_detail['id'])) {
+ $api_detail['id'] = $api_detail['id'];
+ $api_detail['parent'] = $api_detail['parent'];
+ } else {
+ $api_detail['id'] = "";
}
- echo "</td>";
?>
- <td><?php echo($api_detail['size']); ?></td>
- <td><?php echo($api_detail['date']); ?></td>
- <?php if ($api_detail['type'] == "file") { ?>
- <?php }
- ?>
- </tr>
- <?php }
- ?>
- </tbody>
- </table>
- <div class="footer">
- <a class="btn btn-default" style="float: right; margin-left: 10px; border-radius:5px;" href="payment.php">Complete Payment</a>
- <a class="btn btn-default" style="float: right; border-radius:5px;" href="index.php">Cancel</a>
+ <tr>
+ <?php
+ if (($api_detail['type']) == "dir") {
+ echo '<td onclick="uriData(' . $api_detail['id'] . ',' . $api_detail['parent'] . ')">';
+ echo '<img src="images/folder.svg" style="margin-right:10px;"></img>';
+ echo($api_detail['name']);
+ }
+ if ($api_detail['type'] == "file") {
+ echo "<td>";
+ echo '<img src="images/file.svg" style="margin-right:10px;"></img>';
+ echo($api_detail['name']);
+ }
+ echo "</td>";
+ ?>
+ <td><?php echo($api_detail['size']); ?></td>
+ <td><?php echo date("d-m-Y", strtotime($api_detail['date'])); ?></td>
+ <?php if ($api_detail['type'] == "file") { ?>
+ <?php }
+ ?>
+ </tr>
+ <?php }
+ ?>
+ </tbody>
+ </table>
+ <div class="footer">
+ <a class="btn btn-default" style="float: right; margin-left: 10px; border-radius:5px;" href="payment.php">Complete Payment</a>
+ <a class="btn btn-default" style="float: right; border-radius:5px;" href="tokan.php">Cancel</a>
+ </div>
</div>
</div>
- </div>
</div>
</div>
</section>
@@ -211,7 +231,7 @@ $(document).on('change', "#fileUpload",
});
$("#filePath").val("");
function uriData(id, parent) {
-
+
$("#folderPath").empty();
$("#fileUpload").val("");
$("#filePath").val("");
@@ -230,15 +250,17 @@ function uriData(id, parent) {
$.each(result.items, function (i, l) {
if (result.items[i].type == "file") {
console.log(result.items);
- fileOrFolder = '<img src="images/file.svg"></img>';
+ fileOrFolder = '<img src="images/file.svg" style="margin-right:10px;"></img>';
onclickFnc = "onclick='thisIsNotAFolder()'";
dwnldTd = "<td onclick = 'download(\"" + result.items[i].uri + "\",\"" + result.items[i].name + "\");';></td>";
} else {
- fileOrFolder = '<img src="images/folder.svg"></img>';
+ fileOrFolder = '<img src="images/folder.svg" style="margin-right:10px;"></img>';
onclickFnc = "onclick='uriData(" + result.items[i].id + "," + result.items[i].parent + ")'";
dwnldTd = "<td></td>";
}
- uriDataHtml += "<tr><td " + onclickFnc + ">" + fileOrFolder + result.items[i].name + "</td><td>" + result.items[i].size + "</td><td>" + result.items[i].date + "</td>\n\
+ var date = new Date(result.items[i].date);
+ var dateformate = date.getDate()+'-'+(date.getMonth()+1) + '-' + date.getFullYear();
+ uriDataHtml += "<tr><td " + onclickFnc + ">" + fileOrFolder + result.items[i].name + "</td><td>" + result.items[i].size + "</td><td>" + dateformate + "</td>\n\
<td>" + result.items[i].uri + "</td>" + dwnldTd + "</tr>";
$("#folderPath").html(uriDataHtml);
});
@@ -253,4 +275,7 @@ function uriData(id, parent) {
}
$(".se-pre-con").fadeOut("slow");
</script>
+<script>
+ $("#alert").fadeTo(2000, 500).slideUp(500, function(){ $("#alert").slideUp(5000); });
+</script>
</html>
\ No newline at end of file