-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdashboard.php
More file actions
80 lines (68 loc) · 2.61 KB
/
Copy pathdashboard.php
File metadata and controls
80 lines (68 loc) · 2.61 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
<?php
require 'assets/auth.php';
#session_start();
include ('./assets/header.php');
include('./db.php');
header('Content-Type: text/html; charset=utf-8');
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
if (!isset($_SESSION['user_id']) || !isset($_SESSION['company_id'])) {
die("Access denied. Please log in.");
}
$company_id = $_SESSION['company_id'];
try {
// Fetch company info
$stmt = $pdo->prepare("SELECT name, directory_id FROM companies WHERE id = ?");
$stmt->execute([$company_id]);
$company = $stmt->fetch();
if (!$company) {
die("Company not found.");
}
$company_name = $company['name'];
$directory_id = $company['directory_id'];
$json_path = __DIR__ . "/$directory_id/prod/applications.json";
// Load applications.json
$applications = [];
if (file_exists($json_path)) {
$json_data = file_get_contents($json_path);
$applications = json_decode($json_data, true);
}
} catch (PDOException $e) {
die("Database error: " . $e->getMessage());
}
?>
<!DOCTYPE html>
<html lang="sv">
<head>
<meta charset="UTF-8">
<title><?= htmlspecialchars($company_name) ?> - Dashboard</title>
</head>
<body>
<div class="content">
<h1>Welcome to <?= htmlspecialchars($company_name) ?>'s Dashboard</h1>
<h2>Start by configuring your applications list, dont forget to press save in the top right corner!</h2>
<p><a href="/configure2.php">➤ Configure your Applications</a></p>
<h2>Show applications to install (PowerShell):</h2>
<div class="code-container">
<pre><code id="code-block-install">irm <?= DEPLOYSMART_BASE_URL ?>/deploy.php?ID=<?= htmlspecialchars($directory_id, ENT_QUOTES, 'UTF-8') ?></code></pre>
<button class="copy-btn" onclick="copyToClipboard('code-block-install')">📋 Copy</button>
</div>
<h2>Run on already deployed machine to install/update applications (PowerShell):</h2>
<div class="code-container">
<pre><code id="code-block-update">irm <?= DEPLOYSMART_BASE_URL ?>/deploy.php?DS=<?= htmlspecialchars($directory_id, ENT_QUOTES, 'UTF-8') ?> | iex</code></pre>
<button class="copy-btn" onclick="copyToClipboard('code-block-update')">📋 Copy</button>
<script>
function copyToClipboard(codeId) {
const code = document.getElementById(codeId).innerText;
navigator.clipboard.writeText(code).then(() => {
alert("Copied to clipboard!");
});
}
</script>
</div>
<p>For full/fresh deployment trough autounattended.xml, you will need to wait for us to generate that for your specific deployment.</p>
</div>
</body>
<?php include('./assets/footer.php'); ?>
</html>