]>
Commit | Line | Data |
---|---|---|
ab23a935 VP |
1 | <?php |
2 | ||
3 | ||
fb27b14a | 4 | function generate_html_servermodes($server) |
ab23a935 | 5 | { |
fb27b14a | 6 | include UPATH . "/Classes/class-cmodes.php"; |
ab23a935 | 7 | ?> |
fb27b14a VP |
8 | <table class="table-sm table-responsive caption-top table-hover"> |
9 | <thead> | |
10 | <th>Name</th> | |
11 | <th>Description</th> | |
12 | <th>Requires</th> | |
13 | </thead> | |
14 | <?php | |
15 | ||
16 | foreach ($server->server->features->chanmodes as $set) | |
17 | { | |
18 | if (!$set) | |
19 | break; | |
20 | for ($i = 0; isset($set[$i]); $i++) | |
21 | { | |
22 | $mode = $set[$i]; | |
23 | if (isset(IRCList::$cmodes[$mode])) { | |
24 | ?> | |
25 | <tr> | |
26 | <th><?php echo IRCList::$cmodes[$mode]['name']; ?></th> | |
27 | <td><?php echo IRCList::$cmodes[$mode]['description']; ?></td> | |
28 | <td><div class="badge rounded-pill badge-dark"><?php echo IRCList::$cmodes[$mode]['requires']; ?></div></td> | |
29 | </tr><?php | |
30 | } | |
31 | else { | |
32 | ?> | |
33 | <tr> | |
34 | <th>Unknown</th> | |
35 | <td>Mode "<?php echo $mode; ?>"</td> | |
36 | <td></td> | |
37 | </tr><?php | |
38 | } | |
39 | ||
40 | } | |
41 | } | |
42 | ?> | |
43 | </table><?php | |
44 | } | |
ab23a935 | 45 | |
fb27b14a VP |
46 | function sinfo_conv_version_string($server) : string |
47 | { | |
48 | $string = (isset($server->server->features->software)) ? $server->server->features->software : ""; | |
dca62e70 | 49 | $return = ""; |
2464d35e BM |
50 | $tooltip = ""; |
51 | $badge = ""; | |
52 | $display_string = $string; | |
53 | ||
fb27b14a VP |
54 | if (strlen($string) && strpos($string,"-")) |
55 | { | |
56 | $tok = split($string, "-"); | |
2464d35e | 57 | if (($tok[0] == "UnrealIRCd") && isset($tok[2])) |
792e0ffc | 58 | { |
2464d35e BM |
59 | if ($tok[2] == "git") |
60 | { | |
61 | if (!empty($tok[3])) | |
62 | $badge = "git:".$tok[3]; | |
63 | else | |
64 | $badge = "git"; | |
65 | $tooltip = "Installed from GitHub"; | |
66 | $display_string = $tok[0]."-".$tok[1]."-".$tok[2]; | |
67 | } else if (substr($tok[2],0,2) == "rc") | |
68 | { | |
69 | $tooltip = "Release Candidate/Beta Version"; | |
70 | $badge = "rc"; | |
71 | } else if (strlen($tok[2]) == 9) | |
72 | { | |
73 | /* Guess that this is a commit id :D */ | |
74 | $badge = "git:".$tok[2]; | |
75 | $tooltip = "Installed from GitHub"; | |
76 | $display_string = $tok[0]."-".$tok[1]; | |
77 | } | |
792e0ffc | 78 | } |
2464d35e | 79 | $return = "<span data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"$tooltip\"><code>" . $display_string . "</code> <div class=\"badge rounded-pill badge-dark\">$badge</div></a>"; |
fb27b14a VP |
80 | } |
81 | if ($server->server->ulined) | |
dca62e70 | 82 | $return .= "<div class=\"badge rounded-pill badge-warning\">Services</div>"; |
fb27b14a VP |
83 | return $return; |
84 | } | |
85 | ||
86 | function generate_html_serverinfo($server) | |
87 | { | |
88 | ?> | |
ab23a935 VP |
89 | <table class="table-sm table-responsive caption-top table-hover"> |
90 | <tbody> | |
91 | <tr> | |
92 | <th>Name</th> | |
93 | <td colspan="2"><code><?php echo $server->name; ?></code></td> | |
94 | </tr><tr> | |
95 | <th>Server ID (SID)</th> | |
96 | <td colspan="2"><code><?php echo $server->id; ?></code></td> | |
fb27b14a VP |
97 | </tr><tr> |
98 | <th>Info</th> | |
99 | <td colspan="2"><code><?php echo $server->server->info; ?></code></td> | |
ab23a935 | 100 | </tr><tr> |
fb27b14a VP |
101 | <th>Uplink</th> |
102 | <td colspan="2"><code><?php echo "<a href=\"".BASE_URL."servers/details.php?server=".$server->server->uplink."\">".$server->server->uplink."</a>"; ?></code></td> | |
ab23a935 | 103 | </tr><tr> |
fb27b14a VP |
104 | <th>User count</th> |
105 | <td colspan="2"><code><?php echo $server->server->num_users; ?></code></td> | |
ab23a935 | 106 | </tr><tr> |
fb27b14a VP |
107 | <th>Version</th> |
108 | <td colspan="2"><?php echo sinfo_conv_version_string($server); ?></td> | |
ab23a935 | 109 | </tr> |
ab23a935 VP |
110 | </tbody> |
111 | </table> | |
112 | ||
113 | <?php | |
114 | } | |
115 | function generate_html_modlist($srv) | |
116 | { | |
117 | global $rpc; | |
118 | $modules = $rpc->server()->module_list($srv->id); | |
fb27b14a VP |
119 | if (!$modules || !$modules->list) |
120 | { | |
121 | echo $rpc->error; | |
122 | } else { | |
123 | ?> | |
ab23a935 VP |
124 | |
125 | <table class="table table-sm table-responsive table-hover"> | |
126 | <thead class="table-info"> | |
127 | <th>Name</th> | |
128 | <th>Description</th> | |
129 | <th>Source</th> | |
130 | <th>Author</th> | |
131 | <th>Version</th> | |
132 | </thead> | |
133 | <tbody> | |
134 | <?php | |
fb27b14a VP |
135 | foreach ($modules->list as $module) { |
136 | echo "<tr>\n"; | |
137 | echo "<td><code>$module->name</code></td>"; | |
138 | $desc = $module->description; | |
139 | $short_desc = substr($desc, 0, 70); // truncate to 80 chars | |
140 | if (strlen($desc) > strlen($short_desc)) | |
141 | $short_desc .= "..."; | |
142 | echo "<td><span href='#' data-toggle='tooltip' title=\"$desc\">$short_desc</span></td>"; | |
143 | $source = (!$module->third_party) ? "<div class=\"badge rounded-pill badge-success\">Official</div>" : "<div class=\"badge rounded-pill badge-info\">Third-Party</div>"; | |
144 | echo "<td>$source</td>"; | |
145 | echo "<td>$module->author</td>"; | |
146 | echo "<td>$module->version</td>"; | |
147 | } | |
148 | } | |
ab23a935 VP |
149 | ?> |
150 | </tbody> | |
151 | </table> | |
152 | ||
153 | <?php | |
154 | } |