From 0e062081cb0a21740698379428932634f2c01b06 Mon Sep 17 00:00:00 2001 From: Marcus Hill Date: Mon, 8 May 2023 10:50:53 +0100 Subject: [PATCH 1/2] Client Portal - Allow primary + accounting/billing contacts to see quotes - Allow primary + technical contacts to see docs --- portal/document.php | 78 +++++++++++++++++++++++++++ portal/documents.php | 85 +++++++++++++++++++++++++++++ portal/portal_header.php | 8 +++ portal/quotes.php | 112 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 283 insertions(+) create mode 100644 portal/document.php create mode 100644 portal/documents.php create mode 100644 portal/quotes.php diff --git a/portal/document.php b/portal/document.php new file mode 100644 index 00000000..56ab981e --- /dev/null +++ b/portal/document.php @@ -0,0 +1,78 @@ +set('URI.AllowedSchemes', ['data' => true, 'src' => true, 'http' => true, 'https' => true]); +$purifier = new HTMLPurifier($purifier_config); + + +// Check for a document ID +if (!isset($_GET['id']) && !intval($_GET['id'])) { + header("Location: documents.php"); + exit(); +} + +$document_id = intval($_GET['id']); +$sql_document = mysqli_query($mysqli, "SELECT document_id, document_name, document_content FROM documents WHERE document_id = $document_id AND document_client_id = $session_client_id AND document_template = 0 LIMIT 1"); + +$row = mysqli_fetch_array($sql_document); + +$document_id = intval($row['document_id']); +$document_name = htmlentities($row['document_name']); +$document_content = $purifier->purify($row['document_content']); + +?> + +
+
+ + " alt="..." height="50" width="50" class="img-circle img-responsive"> + + + + + + +
+ +
+

Welcome, !

+
+
+ +
+ +
+ +
+ +
+ +
+
+

+ +
+
+ +
+ +
+ + + + +
+
+ + " alt="..." height="50" width="50" class="img-circle img-responsive"> + + + + + + +
+ +
+

Welcome, !

+
+
+ +
+ +
+ +
+ +
+ + + + + + + + + + + + + + + + + + + +
NameCreated
+ + +
+ +
+ +
+ + + " href="invoices.php">Invoices + + + + diff --git a/portal/quotes.php b/portal/quotes.php new file mode 100644 index 00000000..61db7b36 --- /dev/null +++ b/portal/quotes.php @@ -0,0 +1,112 @@ + + +
+
+ + " alt="..." height="50" width="50" class="img-circle img-responsive"> + + + + + + +
+ +
+

Welcome, !

+
+
+ +
+ +
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
#ScopeAmountDateStatus
"> + + + +
+ +
+ +
+ + + Date: Mon, 8 May 2023 10:54:40 +0100 Subject: [PATCH 2/2] Codesmell --- portal/document.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/portal/document.php b/portal/document.php index 56ab981e..519b0bf1 100644 --- a/portal/document.php +++ b/portal/document.php @@ -14,7 +14,7 @@ if ($session_contact_id !== $session_client_primary_contact_id && !$session_cont } //Initialize the HTML Purifier to prevent XSS -require("../plugins/htmlpurifier/HTMLPurifier.standalone.php"); +require_once("../plugins/htmlpurifier/HTMLPurifier.standalone.php"); $purifier_config = HTMLPurifier_Config::createDefault(); $purifier_config->set('URI.AllowedSchemes', ['data' => true, 'src' => true, 'http' => true, 'https' => true]); $purifier = new HTMLPurifier($purifier_config);