authpartner

Clone or download

Modified Files

M doc.php
+16 −12
--- 'a/doc.php'
+++ b/doc.php
@@ -21,6 +21,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)) {
@@ -66,6 +69,9 @@ $resFile = curl_exec($vhf);
curl_close($vhf);
$resFileNew = explode('¿', $resFile);
$uriRes = json_decode($resFileNew[1]);
+if(isset($uriRes->error)){
+ header("Location: index.php");
+}
$uriDir = array();
$uriFiles = array();
foreach ($uriRes->items as $uriI) {
@@ -75,16 +81,7 @@ foreach ($uriRes->items as $uriI) {
$uriFiles[] = (array) $uriI;
}
}
-if ($uriDir == NULL || $uriFiles == NULL) {
- $x = array_merge($uriDir, $uriFiles);
- foreach ($x as $y) {
- if ($y != NULL) {
- $uriItems[] = $y;
- }
- }
-} else {
- $uriItems = array_merge($uriDir, $uriFiles);
-}
+$uriItems = array_merge($uriDir, $uriFiles);
$uriItemsArray['items'] = $uriItems;
$dataDirectory['directory'] = $uriRes->directory;
$dataF = array_merge($dataDirectory, $uriItemsArray);
@@ -129,7 +126,7 @@ include 'header.php';
<div class="table-responsive">
<table class="table">
<thead style="color:blueviolet;">
- <tr>
+ <tr id="trheading">
<td>Name</td>
<td>Size</td>
<td>Date</td>
@@ -276,11 +273,18 @@ function uriData(id, parent) {
<td>" + result.items[i].uri + "</td>" + dwnldTd + "</tr>";
$("#folderPath").html(uriDataHtml);
});
+ $(".footer").show();
+ $("#trheading").show();
+ if((result.items).length==0){
+ $(".footer").hide();
+ $("#trheading").hide();
+ $("#folderPath").html("<tr><th colspan='4' style='text-align: center;'><h4>No document uploaded yet</h4></br><p>Upload some of your own documents or certificates!</p></th></tr>");
+ }
$("#parent").html("<span onclick=uriData(" + parent + ",null) >" + result.directory + "</span>");
$(".se-pre-con").hide();
}, "json")
.fail(function () {
- $("#folderPath").html("No document available in this folder");
+ $("#folderPath").html("some error found!");
$(".se-pre-con").hide();
});
}
M index.php
+6 −1
--- 'a/index.php'
+++ b/index.php
@@ -52,4 +52,9 @@
</div>
</div><!-- ./ container end
<!-- /.row -->
-<?php include 'footer.php' ?>
\ No newline at end of file
+<?php include 'footer.php' ?>
+<script>
+ $("#alert").fadeTo(2000, 500).slideUp(500, function () {
+ $("#alert").slideUp(5000);
+ });
+</script>
\ No newline at end of file
M uploaddoc.php
+13 −13
--- 'a/uploaddoc.php'
+++ b/uploaddoc.php
@@ -72,6 +72,9 @@ $resFile = curl_exec($vhf);
curl_close($vhf);
$resFileNew = explode('¿', $resFile);
$uriRes = json_decode($resFileNew[1]);
+if(isset($uriRes->error)){
+ header("Location: index.php");
+}
$uriDir = array();
$uriFiles = array();
foreach ($uriRes->items as $uriI) {
@@ -81,16 +84,7 @@ foreach ($uriRes->items as $uriI) {
$uriFiles[] = (array) $uriI;
}
}
-if ($uriDir == NULL || $uriFiles == NULL) {
- $x = array_merge($uriDir, $uriFiles);
- foreach ($x as $y) {
- if ($y != NULL) {
- $uriItems[] = $y;
- }
- }
-} else {
- $uriItems = array_merge($uriDir, $uriFiles);
-}
+$uriItems = array_merge($uriDir, $uriFiles);
$uriItemsArray['items'] = $uriItems;
$dataDirectory['directory'] = $uriRes->directory;
$dataF = array_merge($dataDirectory, $uriItemsArray);
@@ -126,7 +120,6 @@ include 'header.php';
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>";
}
?>
@@ -165,7 +158,7 @@ include 'header.php';
<div class="table-responsive">
<table class="table">
<thead style="color:blueviolet;">
- <tr>
+ <tr id="trheading">
<td>Name</td>
<td>Size</td>
<td>Date</td>
@@ -264,12 +257,19 @@ function uriData(id, parent) {
<td>" + result.items[i].uri + "</td>" + dwnldTd + "</tr>";
$("#folderPath").html(uriDataHtml);
});
+ $(".footer").show();
+ $("#trheading").show();
+ if((result.items).length==0){
+ $(".footer").hide();
+ $("#trheading").hide();
+ $("#folderPath").html("<tr><th colspan='4'style='text-align: center;'><h4>No document uploaded yet</h4></br><p>Upload some of your own documents or certificates!</p></th></tr>");
+ }
$("#filePath").val(result.directory);
$("#parent").html("<span onclick=uriData(" + parent + ",null)>" + result.directory + "</span>");
$(".se-pre-con").hide();
}, "json")
.fail(function () {
- $("#folderPath").html("No document available in this folder");
+ $("#folderPath").html("some error found!");
$(".se-pre-con").hide();
});
}
M uri.php
+1 −17
--- 'a/uri.php'
+++ b/uri.php
@@ -21,13 +21,6 @@ $resFileNew = explode('¿', $uriResissued
$uriRes = json_decode($resFileNew[1]);
$uriDir = array();
$uriFiles = array();
-if ($uriRes->items == 'null') {
- $uriItemsArray['items'] = "Data not available";
- $dataDirectory['directory'] = $uriRes->directory;
- $dataF = json_encode(array_merge($dataDirectory, $uriItemsArray));
- print_r($dataF);
- exit();
-}
foreach ($uriRes->items as $uriI) {
if ($uriI->type == "dir") {
$uriDir[] = (array) $uriI;
@@ -35,16 +28,7 @@ foreach ($uriRes->items as $uriI) {
$uriFiles[] = (array) $uriI;
}
}
-if ($uriDir == NULL || $uriFiles == NULL) {
- $x = array_merge($uriDir, $uriFiles);
- foreach ($x as $y) {
- if ($y != NULL) {
- $uriItems[] = $y;
- }
- }
-} else {
- $uriItems = array_merge($uriDir, $uriFiles);
-}
+$uriItems = array_merge($uriDir, $uriFiles);
$uriItemsArray['items'] = $uriItems;
$dataDirectory['directory'] = $uriRes->directory;
$dataF = json_encode(array_merge($dataDirectory, $uriItemsArray));