From: indresh singh bhadoria Date: Thu, 13 Jul 2017 22:01:36 +0530 Subject: doc.php,uploaddoc.php,token.php and index.php code clean --- doc.php,uploaddoc.php,token.php and index.php code clean --- --- 'a/doc.php' +++ b/doc.php @@ -29,10 +29,10 @@ if(!$notgettingdata[1]){ header("Location: index.php?message=THIS IS ERROR"); } $getToken = json_decode($notgettingdata[1]); - if (isset($getToken->access_token)) { $access_token = $getToken->access_token; } +$file = "xml/hashKey.xml"; if (isset($access_token)) { $doc = new DOMDocument('1.0'); $doc->formatOutput = true; @@ -49,12 +49,12 @@ if (isset($access_token)) { $title = $root->appendChild($title); $text = $doc->createTextNode($access_token); $text = $title->appendChild($text); - $doc->save("xml/hashKey.xml"); + $doc->save($file); } -if (file_exists("xml/hashKey.xml")) { - $xml = (array) simplexml_load_file("xml/hashKey.xml") or die("Error: Cannot create object"); +if (file_exists($file)) { + $xml = (array) simplexml_load_file($file) or die("Error: Cannot create object"); } else { - echo "xml/hashKey.xml file doesnot exists"; + echo $file. " file doesnot exists"; } $access_token = $xml['access_token']; @@ -86,8 +86,9 @@ foreach ($uriRes->items as $uriI) { $uriFiles[] = (array) $uriI; } } +$item = "items"; $uriItems = array_merge($uriDir, $uriFiles); -$uriItemsArray['items'] = $uriItems; +$uriItemsArray[$item] = $uriItems; $dataDirectory['directory'] = $uriRes->directory; $dataF = array_merge($dataDirectory, $uriItemsArray); @@ -144,10 +145,10 @@ include 'header.php'; '; + echo ''; echo ''; - echo($api_detail['name']); + echo $api_detail['name']; echo ""; } if ($api_detail['type'] == "file") { echo ""; echo ''; - echo($api_detail['name']); + echo $api_detail['name']; echo ""; } ?> - + - + "; @@ -211,14 +212,14 @@ include 'header.php'; '; - echo($issued_detail['name']); + echo $issued_detail['name']; ?> - - + + - + --- 'a/header.php' +++ b/header.php @@ -158,7 +158,6 @@ - --- 'a/index.php' +++ b/index.php @@ -1,11 +1,11 @@ -
" . $message . "
"; --- 'a/tokan.php' +++ b/tokan.php @@ -1,5 +1,5 @@ formatOutput = true; $root = $doc->createElement('maincontent'); @@ -13,12 +13,12 @@ $title = $root->appendChild($title); $text = $doc->createTextNode(""); $text = $title->appendChild($text); - $doc->save("xml/hashKey.xml"); + $doc->save($file); $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"); +if (file_exists($file)) { + $xml = (array) simplexml_load_file($file) or die("Error: Cannot create object"); } else { - echo "xml/hashKey.xml file doesnot exists"; + echo $file. " file doesnot exists"; } header("Location: index.php"); ?> --- 'a/uploaddoc.php' +++ b/uploaddoc.php @@ -32,6 +32,7 @@ $getToken = json_decode($notgettingdata[ if (isset($getToken->access_token)) { $access_token = $getToken->access_token; } +$file = "xml/hashKey.xml"; if (isset($access_token)) { $doc = new DOMDocument('1.0'); $doc->formatOutput = true; @@ -48,12 +49,12 @@ if (isset($access_token)) { $title = $root->appendChild($title); $text = $doc->createTextNode($access_token); $text = $title->appendChild($text); - $doc->save("xml/hashhkey.xml"); + $doc->save($file); } -if (file_exists("xml/hashhkey.xml")) { - $xml = (array) simplexml_load_file("xml/hashhkey.xml") or die("Error: Cannot create object"); +if (file_exists($file)) { + $xml = (array) simplexml_load_file($file) or die("Error: Cannot create object"); } else { - echo "xml/hashhkey.xml file doesnot exists"; + echo $file. " file doesnot exists"; } $access_token = $xml['access_token']; @@ -116,12 +117,13 @@ include 'header.php';
" . $_GET['message'] . "
"; + echo "
" . $_GET[$msg] . "
"; } ?>
@@ -170,8 +172,8 @@ include 'header.php'; '; + echo ''; echo ''; - echo($api_detail['name']); + echo $api_detail['name']; } if ($api_detail['type'] == "file") { echo ""; echo ''; - echo($api_detail['name']); + echo $api_detail['name']; } echo ""; ?> - +