Browse code

Created repository.

DoubleBastionAdmin authored on 26/01/2022 20:32:42
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,174 @@
1
+<?php
2
+/**
3
+ *  Copyright (C) 2021  Double Bastion LLC
4
+ *
5
+ *  This file is part of Roundpin, which is licensed under the
6
+ *  GNU Affero General Public License Version 3.0. The license terms
7
+ *  are detailed in the "LICENSE.txt" file located in the root directory.
8
+ */
9
+
10
+define('RESTRICTED', TRUE);
11
+
12
+include 'install-signup-check.php';
13
+
14
+if ($installcheck == true) {
15
+
16
+ session_start();
17
+
18
+ if ($_SESSION['validateaccess'] == "accessallowed") {
19
+
20
+   if(isset($_POST['submitadminbttn'])) {
21
+
22
+     if (isset($_POST['adminuser']) && $_POST['adminuser'] != '' && isset($_POST['adminuserpassword']) &&
23
+         $_POST['adminuserpassword'] != '' && isset($_POST['adminuseremail']) && $_POST['adminuseremail'] != '') {
24
+
25
+         $adminuser = $_POST['adminuser'];
26
+         $adminuserpass = password_hash($_POST['adminuserpassword'], PASSWORD_DEFAULT);
27
+         $adminuseremail = $_POST['adminuseremail'];
28
+
29
+         define('ACCESSCONST', TRUE);
30
+
31
+         require('db-connect.php');
32
+
33
+         // Create table for Roundpin users
34
+         $query1 = " CREATE TABLE IF NOT EXISTS app_users (
35
+		        id                      INT UNSIGNED AUTO_INCREMENT  PRIMARY KEY,
36
+                        userrole                VARCHAR (150) DEFAULT NULL,
37
+		        username                VARCHAR (150) DEFAULT NULL,
38
+		        password                VARCHAR (250) DEFAULT NULL,
39
+		        emailaddress            VARCHAR (150) DEFAULT NULL,
40
+		        registered              SMALLINT      DEFAULT NULL,
41
+		        token                   VARCHAR (150) DEFAULT NULL,
42
+		        temporarypass           VARCHAR (50)  DEFAULT NULL,
43
+		        wss_server              VARCHAR (150) DEFAULT NULL,
44
+		        web_socket_port         INT           DEFAULT NULL,
45
+		        server_path             VARCHAR (10)  DEFAULT NULL,
46
+		        profile_name            VARCHAR (100) DEFAULT NULL,
47
+		        sip_username            VARCHAR (100) DEFAULT NULL,
48
+		        sip_password            VARCHAR (250) DEFAULT NULL,
49
+		        stun_server             VARCHAR (300) DEFAULT NULL,
50
+		        audio_output_id         VARCHAR (100) DEFAULT NULL,
51
+		        video_src_id            VARCHAR (500) DEFAULT NULL,
52
+		        video_height            VARCHAR (10)  DEFAULT NULL,
53
+		        frame_rate              SMALLINT      DEFAULT NULL,
54
+		        aspect_ratio            VARCHAR (10)  DEFAULT NULL,
55
+		        video_orientation       VARCHAR (100) DEFAULT NULL,
56
+		        audio_src_id            VARCHAR (500) DEFAULT NULL,
57
+		        auto_gain_control       VARCHAR (10)  DEFAULT NULL,
58
+		        echo_cancellation       VARCHAR (10)  DEFAULT NULL,
59
+		        noise_suppression       VARCHAR (10)  DEFAULT NULL,
60
+		        ring_output_id          VARCHAR (100) DEFAULT NULL,
61
+                        video_conf_extension    VARCHAR (100) DEFAULT NULL,
62
+                        video_conf_window_width VARCHAR (10)  DEFAULT NULL,
63
+		        profile_picture         LONGTEXT      DEFAULT NULL,
64
+		        notifications           SMALLINT      DEFAULT NULL,
65
+                        use_roundcube           SMALLINT      DEFAULT NULL,
66
+                        rcdomain                VARCHAR (300) DEFAULT NULL,
67
+                        rcbasicauthuser         VARCHAR (300) DEFAULT NULL,
68
+                        rcbasicauthpass         VARCHAR (300) DEFAULT NULL,
69
+                        rcuser                  VARCHAR (300) DEFAULT NULL,
70
+                        rcpassword              VARCHAR (300) DEFAULT NULL,
71
+                        enabled                 SMALLINT      DEFAULT NULL
72
+		     ); ";
73
+
74
+         $result1 = $mysqli->query($query1);
75
+
76
+         $userrole = 'superadmin';
77
+         $registeredcheck = 1;
78
+         $enabled = 1;
79
+
80
+         $query2 = $mysqli->prepare("INSERT INTO app_users (userrole, username, password, emailaddress, registered, enabled) VALUES (?, ?, ?, ?, ?, ?);");
81
+         $query2->bind_param("ssssii", $userrole, $adminuser, $adminuserpass, $adminuseremail, $registeredcheck, $enabled);
82
+         $query2->execute();
83
+
84
+         // Create table for contacts of Roundpin users
85
+         $query3 = " CREATE TABLE IF NOT EXISTS contacts (
86
+		          id                INT UNSIGNED AUTO_INCREMENT  PRIMARY KEY,
87
+		          user_id           INT UNSIGNED      NOT NULL,
88
+		          contact_name      VARCHAR (300)     DEFAULT NULL,
89
+		          contact_desc      VARCHAR (300)     DEFAULT NULL,
90
+		          extension_number  VARCHAR (50)      DEFAULT NULL,
91
+		          contact_mobile    VARCHAR (50)      DEFAULT NULL,
92
+		          contact_num1      VARCHAR (50)      DEFAULT NULL,
93
+		          contact_num2      VARCHAR (50)      DEFAULT NULL,
94
+		          contact_fax       VARCHAR (50)      DEFAULT NULL,
95
+		          contact_email     VARCHAR (300)     DEFAULT NULL,
96
+                          profile_picture_c LONGTEXT          DEFAULT NULL,
97
+                          groups            VARCHAR (1500)    DEFAULT NULL,
98
+                          date_added        DATETIME          DEFAULT NULL,
99
+                          date_modified     DATETIME          DEFAULT NULL,
100
+                          CONSTRAINT `fk_user_id` FOREIGN KEY (`user_id`) REFERENCES `app_users` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT
101
+                     ); ";
102
+
103
+         $result3 = $mysqli->query($query3);
104
+
105
+         // Create table for external users of video conference
106
+         $query4 = " CREATE TABLE IF NOT EXISTS external_users (
107
+		          id                 INT UNSIGNED  AUTO_INCREMENT  PRIMARY KEY,
108
+		          userid             INT UNSIGNED      NOT NULL,
109
+		          exten_for_external VARCHAR (150)     DEFAULT NULL,
110
+		          exten_for_ext_pass VARCHAR (2000)    DEFAULT NULL,
111
+		          conf_access_link   LONGTEXT          DEFAULT NULL,
112
+		          CONSTRAINT `fk_userid` FOREIGN KEY (`userid`) REFERENCES `app_users` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT
113
+                     ); ";
114
+         $result4 = $mysqli->query($query4);
115
+
116
+         $_SESSION['validateaccess'] = "noaccessallowed";
117
+
118
+         $_SESSION['instcompleteaccess'] = "instaccess";
119
+
120
+         header("Location: roundpin-inst-complete.php");
121
+
122
+     }
123
+  }
124
+
125
+?>
126
+
127
+<html>
128
+
129
+<head>
130
+  <title>Roundpin Setup</title>
131
+
132
+  <link rel="stylesheet" href="css/setup.min.css">
133
+  <script type="text/javascript" src="js/jquery-3.3.1.min.js"></script>
134
+  <script type="text/javascript" src="js/roundpin-setup.min.js"></script>
135
+
136
+</head>
137
+
138
+<body>
139
+
140
+  <div id="mainarea">
141
+
142
+    <img class="logosetuppage" src="images/login-logo.svg" />
143
+
144
+    <h3 style="text-align:center;">Roundpin Setup</h3><br>
145
+
146
+    <img class="setupStage" src="images/roundpin-setup-stages-2.svg" />
147
+
148
+    <form id="admincredform" action="" method="POST">
149
+
150
+       <label for="adminuser" class="fieldlabels">Superadmin username:</label><br>
151
+       <input type="text" id="adminuser" class="textinput" name="adminuser"/><br><br>
152
+
153
+       <label for="adminuserpassword" class="fieldlabels">Superadmin password:</label><br>
154
+       <input type="password" id="adminuserpassword" class="textinput" name="adminuserpassword" title="The password should be
155
+       at least 10 characters long, it should contain at least one letter, at least one digit and at least one special character"/><br><br>
156
+
157
+       <label for="adminuseremail" class="fieldlabels">Superadmin email address:</label><br>
158
+       <input type="text" id="adminuseremail" class="textinput" name="adminuseremail"/><br><br>
159
+
160
+       <input type="submit" id="submitadminbttn" name="submitadminbttn" value="Submit" />
161
+
162
+   </form>
163
+
164
+  </div>
165
+
166
+</body>
167
+
168
+</html>
169
+
170
+<?php
171
+ }
172
+}
173
+
174
+?>