forked from royhodge/apps
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontract_upload_details.php
More file actions
145 lines (106 loc) · 7.29 KB
/
Copy pathcontract_upload_details.php
File metadata and controls
145 lines (106 loc) · 7.29 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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
<?php
session_start();
ob_start();
require_once('check-login.php');
include ("header-logged-in.php");
?>
<script type="text/javascript" src="js/contract.js"></script>
<div class="container theme-showcase" role="main">
<header class="page-header">
<h2>PrimeContract</h2>
</header>
<div class="row">
<div class="col-md-12">
<section class="panel panel-primary">
<header class="panel-heading">
<h2 class="panel-title">Contract Details</h2>
</header>
<div class="panel-body">
<div class="row">
<div id="output" class="col-md-12">
<?php
require_once('resources.php');
require_once('config.php');
require_once('dbhelper.php');
require_once('helperFunctions.php');
try
{
if (isset($_GET['contractid']))
{
$contractID = $_GET['contractid'];
$uploader_address = $_SESSION['address'];
$dbHelper = new DBHelper();
/// -------------------------CONTRACT DETAILS------------------------ ///
echo "<h3 style='color:#0066cc'><b><u>Contract Details</u></b></h3>";
$dataArr = $dbHelper->getContractDetails($contractID);
echo "<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];
$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 Contract</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></p></div>";
/// ----------------------------------------------------------------- ///
/// -------------------------CONTRACT SIGNERS------------------------ ///
$contractSignersItems = $dbHelper->getContractSignatures($contractID);
echo "<h3 style='color:#0066cc'><b><u>Signers</u></b></h3>";
//echo "<tr><th>"."Signer ID"."</th><th>"."Signer Address"."</th><th>"."Signature"."</th></tr>";
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></div><br/>";
}
/// ----------------------------------------------------------------- ///
}
else
{
throw new Exception("Invalid Contract ID.");
}
}
catch(Exception $e)
{
echo "<h3 style='color:red'>".$e->getMessage()."</h3>";
}
?>
</div>
</div>
</div>
</section>
</div>
</div>
</div>
<?php include ("footer.php");?>