3 require_once "../inc/common.php";
6 $uri = $_SERVER['REQUEST_URI'];
7 $tok = split($uri, "/");
9 for ($i=0; isset($tok[$i]); $i++
)
11 if ($tok[$i] == "settings" && strstr($tok[$i +
1], "install.php"))
15 for($j=0; $j < $i; $j++
)
17 strcat($base_url,$tok[$j]);
18 strcat($base_url,"/");
23 if (!strlen($base_url))
25 define('BASE_URL', $base_url);
27 $writable = (is_writable("../config/")) ? true: false;
32 <div
class="media-body">
34 <meta name
="viewport" content
="width=device-width, initial-scale=1">
35 <meta name
="HandheldFriendly" content
="true">
39 <!-- Latest compiled
and minified CSS
-->
40 <link rel
="stylesheet" href
="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/css/bootstrap.min.css">
42 <!-- Font Awesome JS
-->
43 <script defer src
="https://use.fontawesome.com/releases/v6.2.1/js/solid.js" integrity
="sha384-tzzSw1/Vo+0N5UhStP3bvwWPq+uvzCMfrN1fEFe+xBmv1C/AtVX5K0uZtmcHitFZ" crossorigin
="anonymous"></script
>
44 <script defer src
="https://use.fontawesome.com/releases/v6.2.1/js/fontawesome.js" integrity
="sha384-6OIrr52G08NpOFSZdxxz1xdNSndlD4vdcf/q2myIUVO0VsqaGHJsB0RaBE01VTOY" crossorigin
="anonymous"></script
>
46 <!-- Font Awesome icons
-->
47 <link rel
="stylesheet" href
="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.1/css/all.min.css">
48 <script src
="../js/unrealircd-admin.js"></script
>
49 <title
>UnrealIRCd Panel
</title
>
50 <link rel
="icon" type
="image/x-icon" href
="<?php echo get_config("base_url
"); ?>img/favicon.ico">
52 <script src
="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity
="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin
="anonymous"></script
>
54 <script src
="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.0/umd/popper.min.js" integrity
="sha384-cs/chFZiN24E4KMATLdqdvsezGxaGsi4hLGOzlXwp5UZB1LY//20VyM2taTB4QvJ" crossorigin
="anonymous"></script
>
56 <script src
="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js" integrity
="sha384-uefMccjFJAIv6A+rW+L4AHf99KvxDjWSu1z9VI8SKNVmz4sk7buKt/6v9KI65qnm" crossorigin
="anonymous"></script
>
60 <body role
="document">
62 <div
class="container mt-4"><div
class="row justify-content-center"><img src
="../img/unreal.jpg" width
="35px" height
="35px" style
="margin-right: 15px"><h3
>UnrealIRCd Admin Panel Configuration
and Setup
</h3
></div
></div
>
65 if (isset($config['unrealircd']) && empty($config['unrealircd']['host']))
67 ?><br
><div
class="container"><?php Message
::Fail("You're already configured!"); ?>
69 <a
class="text-center btn btn-primary" href
="<?php echo BASE_URL; ?>">Take me home
!</a
>
74 elseif (isset($_POST) && !empty($_POST))
76 ?><br
><div
class="container"><?php
77 $opts = (object)$_POST;
79 $config["unrealircd"] = [
80 "rpc_user" => $opts->rpc_user
,
81 "rpc_password" => $opts->rpc_password
,
82 "host"=>$opts->rpc_iphost
,
83 "port"=>$opts->rpc_port
,
84 "tls_verify_cert"=>isset($opts->rpc_ssl
)?true:false,
87 /* And write the new config */
91 Great
! Everything has been completely set up
for you
. You can now browse the admin panel
.<br
><br
>
92 <a
class="text-center btn btn-primary" href
="<?php echo get_config("base_url
"); ?>">Let
's go!</a></div>
105 <div id="page2" class="container">
106 <h5>RPC Uplink Information</h5>
108 Let's get you linked with UnrealIRCd
.
110 If you don
't have your credentials, you will need to create them. This is done in your <code>unrealircd.conf</code> <div id="rpc_instructions" class="ml-4 btn btn-sm btn-info">View instructions</div>
112 <div class="form-group">
113 <label for="rpc_iphost">Hostname or IP</label>
114 <input name="rpc_iphost" type="text" class="revalidation-needed-rpc form-control" id="rpc_iphost" aria-describedby="hostname_help" value="127.0.0.1">
115 <small id="hostname_help" class="form-text text-muted">The hostname or IP address of your UnrealIRCd server. You should use <code>127.0.0.1</code> for the same machine.</small>
117 <div class="form-group">
118 <label for="rpc_port">Server Port</label>
119 <input name="rpc_port" type="text" class="revalidation-needed-rpc form-control" id="rpc_port" aria-describedby="port_help" value="8600">
120 <small id="port_help" class="form-text text-muted">The port which you designated for RPC connections in your <code>unrealircd.conf</code></small>
122 <div class="form-group form-check">
123 <input name="rpc_ssl" type="checkbox" class="revalidation-needed-rpc form-check-input" value="ssl" id="rpc_ssl">
124 <label class="form-check-label" for="rpc_ssl">My UnrealIRCd server is on a different machine, verify the TLS connection.</label>
126 <div class="form-group">
127 <label for="rpc_username">Username</label>
128 <input name="rpc_user" type="text" class="revalidation-needed-rpc form-control" id="rpc_user" aria-describedby="username_help">
129 <small id="username_help" class="form-text text-muted">The name of your <code>rpc-user</code> block as defined in your <code>unrealircd.conf</code></small>
131 <div class="form-group">
132 <label for="rpc_password">Password</label>
133 <input name="rpc_password" type="password" class="revalidation-needed-rpc form-control" id="rpc_password">
135 <div class="text-center">
136 <button id="page2_next" type="submit" class="btn btn-primary ml-3">Submit</div>
137 <div id="page2_test_connection" class="btn btn-primary ml-3">Test connection</div>
144 let BASE_URL = '<?php
echo get_config("base_url"); ?>';
146 let page2 = document.getElementById('page2
');
147 let rpc_instructions = document.getElementById('rpc_instructions
');
149 let rpc_host = document.getElementById('rpc_iphost
');
150 let rpc_port = document.getElementById('rpc_port
');
151 let rpc_user = document.getElementById('rpc_user
');
152 let rpc_pass = document.getElementById('rpc_password
');
153 let rpc_tls = document.getElementById('rpc_ssl
');
155 let page2_back = document.getElementById('page2_back
');
156 let page2_next = document.getElementById('page2_next
');
157 let test_conn = document.getElementById('page2_test_connection
');
159 rpc_instructions.addEventListener('click
', e => {
160 window.open("https://www.unrealircd.org/docs/UnrealIRCd_webpanel#Configuring_UnrealIRCd");
163 page2_next.addEventListener('click
', e => {
164 page2.style.display = 'none
';
165 page3.style.display = '';
166 sql_form.style.display = 'none
';
169 revalidate_rpc = document.querySelectorAll('.revalidation
-needed
-rpc
');
170 for (let i = 0; i < revalidate_rpc.length; i++)
172 revalidate_rpc[i].addEventListener('input
', e => {
173 page2_next.style.display = 'none
';
174 test_conn.innerHTML = 'Test connection
';
175 test_conn.style.display = '';
176 test_conn.classList.remove('disabled
');
180 /* The RPC connection tester! */
181 test_conn.addEventListener('click
', e => {
182 test_conn.classList.add('disabled
');
183 test_conn.innerHTML = "Checking...";
184 fetch(BASE_URL + 'api
/installation2
.php
?method
=rpc
&host
='+rpc_host.value+'&port
='+rpc_port.value+'&user
='+rpc_user.value+'&password
='+rpc_pass.value+'&tls_verify
='+rpc_tls.checked)
185 .then(response => response.json())
189 // do something with the JSON data
190 test_conn.innerHTML = "Success!";
191 setTimeout(function() {
192 test_conn.style.display = 'none
';
193 page2_next.style.display = '';
198 test_conn.innerHTML = "Failed!";
199 setTimeout(function() {
200 test_conn.innerHTML = "Test connection";
201 test_conn.classList.remove('disabled
');
206 test_conn.innerHTML = "Failed!";
207 setTimeout(function() {
208 test_conn.innerHTML = "Test connection";
209 test_conn.classList.remove('disabled
');