forked from royhodge/apps
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontract_details.php
More file actions
118 lines (84 loc) · 4.6 KB
/
Copy pathcontract_details.php
File metadata and controls
118 lines (84 loc) · 4.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<?php
session_start();
ob_start();
require_once('check-login.php');
require_once('resources.php');
require_once('config.php');
require_once('dbhelper.php');
require_once('helperFunctions.php');
try
{
if (isset($_GET['contractid']))
{
$dbHelper = new DBHelper();
$contractID = $_GET['contractid'];
$uploader_address = $_SESSION['address'];
/// -------------------------CONTRACT DETAILS------------------------ ///
echo "<h3 style='color:#0066cc'><b><u>Contract Details</u></b></h3>";
$dataArr = $dbHelper->getContractDetails($contractID);
echo "<p><div class='table-responsive scrollable has-scrollbar scrollable-content ' data-plugin-scrollable><table class='table table-bordered table-hover table-condensed mb-none'>";
echo "<tr><th style='border-style: ridge'>"."Contract ID"."</th><td style='border-style: ridge;'>".$contractID."</td></tr>";
foreach ($dataArr as $key => $value) {
if ($key!='file_hex') {
echo "<tr><th style='border-style: ridge;'>".Literals::CONTRACT_DETAILS_FIELD_DESC[$key]."</th><td style='border-style: ridge;'>".$value."</td></tr>";
}
}
$contractFileItem = $dbHelper->getContractFileStreamItem($contractID);
$vOut_n = $contractFileItem['vout'];
$fileTxId = $contractFileItem['txid'];
$publisher = $contractFileItem['publishers'][0];
// $downloadFormHTML = "<form action='vault_file_download.php' method='post'>"."<input type='hidden' name='txid' value='".$txId."' />";
// $downloadFormHTML .= ($vOut_n != -1) ? "<input type='hidden' name='v_n' value='".$vOut_n."' />" : "";
// $downloadFormHTML .= "<input type='submit' class='btn blue' value='Click here' />";
$downloadLinkHTML = "<a target='_new' href='contract_file_download.php?";
$downloadLinkHTML .= "txid=".$fileTxId;
$downloadLinkHTML .= ($vOut_n != -1) ? "&v_n=".$vOut_n : "";
$downloadLinkHTML .= "&publisher=".$publisher;
$downloadLinkHTML .= "' class='mb-xs mt-xs mr-xs btn btn-success'>Download file</a>";
echo "<tr>";
if ($dbHelper->hasCreatedTheContract($contractID, $_SESSION['user_name']))
{
echo "<td colspan=2 style='border-style: ridge;'>".$downloadLinkHTML." <a class='mb-xs mt-xs mr-xs btn btn-primary' href='contract_invite.php?contractid=".$contractID."'>Invite Signees</a></td>";
}
else
{
echo "<td colspan=2 style='border-style: ridge;'>".$downloadLinkHTML."</td>";
}
echo "</tr>";
echo "</table></div></p>";
/// ----------------------------------------------------------------- ///
/// -------------------------CONTRACT SIGNERS------------------------ ///
$contractSignersItems = $dbHelper->getContractSignatures($contractID);
echo "<h3 style='color:#0066cc'><b><u>Signers</u></b></h3>";
foreach ($contractSignersItems as $contractSignersItem)
{
echo "<div class='table-responsive scrollable has-scrollbar scrollable-content' data-plugin-scrollable><table class='table table-bordered table-hover table-condensed mb-none'>";
$dataHex = $dbHelper->getDataFromDataItem($contractSignersItem['data']);
$dataArr = json_decode(hex2bin($dataHex));
foreach ($dataArr as $key => $value) {
echo "<tr>";
echo "<th style='border-style: ridge'>".Literals::CONTRACT_SIGNATURES_FIELD_DESC[$key]."</th>";
echo "<td style='border-style: ridge'>".$value."</td>";
echo "</tr>";
if ($key == Literals::CONTRACT_SIGNATURES_FIELD_NAMES['SIGNER_ADDRESS']) {
echo "<tr>";
echo "<th style='border-style: ridge'>"."Public Key"."</th>";
echo "<td style='border-style: ridge'>".$dbHelper->getUserPublicKeyFromUserAddress($value)."</td>";
echo "</tr>";
}
}
echo "</table></p>";
}
/// ----------------------------------------------------------------- ///
}
else
{
throw new Exception("Invalid Contract ID.");
}
}
catch(Exception $e)
{
echo "<h3 style='color:red'>".$e->getMessage()."</h3>";
}
ob_end_flush();
?>