annotate www/info.php @ 2763:78ad0e51b7b5

Improve wizards.txt parser, add functionality for specifying alternative / additional names as some wizards have used more than one. Also other improvements in wizard data handling.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 12 Mar 2024 15:47:58 +0200
parents 164aa519640d
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1646
2cbce82aa3c3 Use full <?php ?> tag, misc cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1620
diff changeset
1 <?php
337
ca191c3a0ce1 Updates and lots of new ugly glue.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
2 require "config.inc.php";
1272
Matti Hamalainen <ccr@tnsp.org>
parents: 1150
diff changeset
3 require "world.inc.php";
337
ca191c3a0ce1 Updates and lots of new ugly glue.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
4 require "common.inc.php";
ca191c3a0ce1 Updates and lots of new ugly glue.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
5
ca191c3a0ce1 Updates and lots of new ugly glue.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
6 /* Page start
ca191c3a0ce1 Updates and lots of new ugly glue.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
7 */
1620
6d620441af7f Rename various functions, and other cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
8 mpPrintPageHeader($pageTitle." - Wizards of the Realm");
1140
3bb8253db932 New website layout and some minor improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 1115
diff changeset
9
1646
2cbce82aa3c3 Use full <?php ?> tag, misc cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1620
diff changeset
10 echo
2cbce82aa3c3 Use full <?php ?> tag, misc cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1620
diff changeset
11 "<h1>Wizards of the Realm</h1>\n".
2cbce82aa3c3 Use full <?php ?> tag, misc cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1620
diff changeset
12 "<div class=\"attnbox\">\n".
1706
Matti Hamalainen <ccr@tnsp.org>
parents: 1687
diff changeset
13 " <b>Notice #1</b>: The area counts are not really accurate, as the database MOSTLY ".
1646
2cbce82aa3c3 Use full <?php ?> tag, misc cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1620
diff changeset
14 "lists areas accessible from outworld. Thus areas only accessible via some ".
1706
Matti Hamalainen <ccr@tnsp.org>
parents: 1687
diff changeset
15 "other fashion MIGHT not be listed. Also, maintainerships of some areas are not ".
1646
2cbce82aa3c3 Use full <?php ?> tag, misc cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1620
diff changeset
16 "clear, and may be credited to wrong wizard(s).\n".
2cbce82aa3c3 Use full <?php ?> tag, misc cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1620
diff changeset
17 " <br />\n".
2cbce82aa3c3 Use full <?php ?> tag, misc cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1620
diff changeset
18 "\n".
2cbce82aa3c3 Use full <?php ?> tag, misc cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1620
diff changeset
19 " <b>Notice #2</b>: Not everyone who has once been immortal is listed. ".
2cbce82aa3c3 Use full <?php ?> tag, misc cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1620
diff changeset
20 "Some purged and/or remorted wizards without known contributions are unlisted.\n".
2cbce82aa3c3 Use full <?php ?> tag, misc cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1620
diff changeset
21 " <br />\n".
2cbce82aa3c3 Use full <?php ?> tag, misc cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1620
diff changeset
22 "\n".
2cbce82aa3c3 Use full <?php ?> tag, misc cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1620
diff changeset
23 " <b>Notice #3</b>: It is certainly possible, that some of this information is ".
2cbce82aa3c3 Use full <?php ?> tag, misc cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1620
diff changeset
24 "incorrect. Sorry for that. Please report to ".burl("Ggr").", if you have Knowledge(tm).\n".
2cbce82aa3c3 Use full <?php ?> tag, misc cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1620
diff changeset
25 "</div>\n".
2cbce82aa3c3 Use full <?php ?> tag, misc cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1620
diff changeset
26 "<hr />\n".
2cbce82aa3c3 Use full <?php ?> tag, misc cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1620
diff changeset
27 "<div style=\"text-align: center;\">\n".
2329
5c04ea63bf29 Use CSS instead of hardcoding style for element.
Matti Hamalainen <ccr@tnsp.org>
parents: 2271
diff changeset
28 " <table class=\"locWizHasInfo\">\n".
1646
2cbce82aa3c3 Use full <?php ?> tag, misc cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1620
diff changeset
29 " <tr>\n".
2271
fa98b657c107 Sync www changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 2050
diff changeset
30 " <td class=\"locWizHasDesc\">Entry has information about the wizard.</td>\n".
fa98b657c107 Sync www changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 2050
diff changeset
31 " <td class=\"locWizHasNoDesc\">No wizard information entry.</td>\n".
1646
2cbce82aa3c3 Use full <?php ?> tag, misc cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1620
diff changeset
32 " </tr>\n".
2cbce82aa3c3 Use full <?php ?> tag, misc cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1620
diff changeset
33 " </table>\n".
2cbce82aa3c3 Use full <?php ?> tag, misc cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1620
diff changeset
34 "</div>\n";
337
ca191c3a0ce1 Updates and lots of new ugly glue.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
35
2033
57ecb49d7b4a Update the apc functions to use apcu_ prefix.
Matti Hamalainen <ccr@tnsp.org>
parents: 2015
diff changeset
36 $locTable = apcu_fetch("info_locTable");
1387
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1334
diff changeset
37 if (empty($locTable))
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1334
diff changeset
38 {
2037
e82ba6f55708 Refactor how the location filtering works internally to use proper LOC flags.
Matti Hamalainen <ccr@tnsp.org>
parents: 2033
diff changeset
39 $locTable = mpParseLocFiles(TRUE);
2033
57ecb49d7b4a Update the apc functions to use apcu_ prefix.
Matti Hamalainen <ccr@tnsp.org>
parents: 2015
diff changeset
40 apcu_store("info_locTable", $locTable, 3600);
1150
02fe48a608d7 Use APC for caching of location and wizard data.
Matti Hamalainen <ccr@tnsp.org>
parents: 1148
diff changeset
41 }
2033
57ecb49d7b4a Update the apc functions to use apcu_ prefix.
Matti Hamalainen <ccr@tnsp.org>
parents: 2015
diff changeset
42 $wizTable = apcu_fetch("wizTable");
1387
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1334
diff changeset
43 if (empty($wizTable))
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1334
diff changeset
44 {
1620
6d620441af7f Rename various functions, and other cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1391
diff changeset
45 $wizTable = mpReadWizInfoFiles();
2033
57ecb49d7b4a Update the apc functions to use apcu_ prefix.
Matti Hamalainen <ccr@tnsp.org>
parents: 2015
diff changeset
46 apcu_store("wizTable", $wizTable, 3600);
1150
02fe48a608d7 Use APC for caching of location and wizard data.
Matti Hamalainen <ccr@tnsp.org>
parents: 1148
diff changeset
47 }
337
ca191c3a0ce1 Updates and lots of new ugly glue.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
48
ca191c3a0ce1 Updates and lots of new ugly glue.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
49
1115
Matti Hamalainen <ccr@tnsp.org>
parents: 1100
diff changeset
50 function wizardSort($a, $b)
Matti Hamalainen <ccr@tnsp.org>
parents: 1100
diff changeset
51 {
Matti Hamalainen <ccr@tnsp.org>
parents: 1100
diff changeset
52 return strcmp($a["name"], $b["name"]);
Matti Hamalainen <ccr@tnsp.org>
parents: 1100
diff changeset
53 }
Matti Hamalainen <ccr@tnsp.org>
parents: 1100
diff changeset
54
Matti Hamalainen <ccr@tnsp.org>
parents: 1100
diff changeset
55
2763
78ad0e51b7b5 Improve wizards.txt parser, add functionality for specifying alternative /
Matti Hamalainen <ccr@tnsp.org>
parents: 2620
diff changeset
56 // Get area counts
1334
73dd95d63e7a Upstream sync.
Matti Hamalainen <ccr@tnsp.org>
parents: 1272
diff changeset
57 foreach ($locTable as $location)
73dd95d63e7a Upstream sync.
Matti Hamalainen <ccr@tnsp.org>
parents: 1272
diff changeset
58 {
2620
164aa519640d Use 'author' instead of 'creator' or 'coder'.
Matti Hamalainen <ccr@tnsp.org>
parents: 2329
diff changeset
59 foreach ($location["authors"] as $wiz)
1334
73dd95d63e7a Upstream sync.
Matti Hamalainen <ccr@tnsp.org>
parents: 1272
diff changeset
60 {
975
af0fc3a965dc Fix all the web-interface PHP crap to work with the new LOC file format. Urgh. This shit could really use some refactoring cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 896
diff changeset
61 $name = $wiz["name"];
2763
78ad0e51b7b5 Improve wizards.txt parser, add functionality for specifying alternative /
Matti Hamalainen <ccr@tnsp.org>
parents: 2620
diff changeset
62
78ad0e51b7b5 Improve wizards.txt parser, add functionality for specifying alternative /
Matti Hamalainen <ccr@tnsp.org>
parents: 2620
diff changeset
63 // Many wizards do not have an entry in wizard info table
975
af0fc3a965dc Fix all the web-interface PHP crap to work with the new LOC file format. Urgh. This shit could really use some refactoring cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 896
diff changeset
64 if (!isset($wizTable[$name]))
2763
78ad0e51b7b5 Improve wizards.txt parser, add functionality for specifying alternative /
Matti Hamalainen <ccr@tnsp.org>
parents: 2620
diff changeset
65 {
78ad0e51b7b5 Improve wizards.txt parser, add functionality for specifying alternative /
Matti Hamalainen <ccr@tnsp.org>
parents: 2620
diff changeset
66 $wizTable[$name] = [
78ad0e51b7b5 Improve wizards.txt parser, add functionality for specifying alternative /
Matti Hamalainen <ccr@tnsp.org>
parents: 2620
diff changeset
67 "name" => $name,
78ad0e51b7b5 Improve wizards.txt parser, add functionality for specifying alternative /
Matti Hamalainen <ccr@tnsp.org>
parents: 2620
diff changeset
68 "names" => [],
78ad0e51b7b5 Improve wizards.txt parser, add functionality for specifying alternative /
Matti Hamalainen <ccr@tnsp.org>
parents: 2620
diff changeset
69 "areas" => 0,
78ad0e51b7b5 Improve wizards.txt parser, add functionality for specifying alternative /
Matti Hamalainen <ccr@tnsp.org>
parents: 2620
diff changeset
70 ];
78ad0e51b7b5 Improve wizards.txt parser, add functionality for specifying alternative /
Matti Hamalainen <ccr@tnsp.org>
parents: 2620
diff changeset
71 }
78ad0e51b7b5 Improve wizards.txt parser, add functionality for specifying alternative /
Matti Hamalainen <ccr@tnsp.org>
parents: 2620
diff changeset
72
1334
73dd95d63e7a Upstream sync.
Matti Hamalainen <ccr@tnsp.org>
parents: 1272
diff changeset
73 $wizTable[$name]["areas"]++;
337
ca191c3a0ce1 Updates and lots of new ugly glue.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
74 }
ca191c3a0ce1 Updates and lots of new ugly glue.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
75 }
ca191c3a0ce1 Updates and lots of new ugly glue.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
76
2763
78ad0e51b7b5 Improve wizards.txt parser, add functionality for specifying alternative /
Matti Hamalainen <ccr@tnsp.org>
parents: 2620
diff changeset
77 // Make alphabetically sorted table of wizards
78ad0e51b7b5 Improve wizards.txt parser, add functionality for specifying alternative /
Matti Hamalainen <ccr@tnsp.org>
parents: 2620
diff changeset
78 foreach ($wizTable as $name => $data)
78ad0e51b7b5 Improve wizards.txt parser, add functionality for specifying alternative /
Matti Hamalainen <ccr@tnsp.org>
parents: 2620
diff changeset
79 $alphaTable[$name[0]][$name] = $data;
337
ca191c3a0ce1 Updates and lots of new ugly glue.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
80
2763
78ad0e51b7b5 Improve wizards.txt parser, add functionality for specifying alternative /
Matti Hamalainen <ccr@tnsp.org>
parents: 2620
diff changeset
81 ksort($alphaTable, SORT_STRING);
337
ca191c3a0ce1 Updates and lots of new ugly glue.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
82
2763
78ad0e51b7b5 Improve wizards.txt parser, add functionality for specifying alternative /
Matti Hamalainen <ccr@tnsp.org>
parents: 2620
diff changeset
83 // Print wizards alphabetically per first character of name
78ad0e51b7b5 Improve wizards.txt parser, add functionality for specifying alternative /
Matti Hamalainen <ccr@tnsp.org>
parents: 2620
diff changeset
84 foreach ($alphaTable as $alpha => $data)
78ad0e51b7b5 Improve wizards.txt parser, add functionality for specifying alternative /
Matti Hamalainen <ccr@tnsp.org>
parents: 2620
diff changeset
85 if (count($data) > 0)
78ad0e51b7b5 Improve wizards.txt parser, add functionality for specifying alternative /
Matti Hamalainen <ccr@tnsp.org>
parents: 2620
diff changeset
86 {
78ad0e51b7b5 Improve wizards.txt parser, add functionality for specifying alternative /
Matti Hamalainen <ccr@tnsp.org>
parents: 2620
diff changeset
87 usort($data, "wizardSort");
2015
135b2b595e2c Trailing whitespace cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 1891
diff changeset
88
2763
78ad0e51b7b5 Improve wizards.txt parser, add functionality for specifying alternative /
Matti Hamalainen <ccr@tnsp.org>
parents: 2620
diff changeset
89 $letter = strtoupper($alpha);
78ad0e51b7b5 Improve wizards.txt parser, add functionality for specifying alternative /
Matti Hamalainen <ccr@tnsp.org>
parents: 2620
diff changeset
90 echo "<h3><a id=\"ch".$letter."\"></a>".$letter."</h3>\n";
78ad0e51b7b5 Improve wizards.txt parser, add functionality for specifying alternative /
Matti Hamalainen <ccr@tnsp.org>
parents: 2620
diff changeset
91 echo "<div class=\"locTable\">\n";
337
ca191c3a0ce1 Updates and lots of new ugly glue.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
92
2763
78ad0e51b7b5 Improve wizards.txt parser, add functionality for specifying alternative /
Matti Hamalainen <ccr@tnsp.org>
parents: 2620
diff changeset
93 foreach ($data as $name => $wizard)
78ad0e51b7b5 Improve wizards.txt parser, add functionality for specifying alternative /
Matti Hamalainen <ccr@tnsp.org>
parents: 2620
diff changeset
94 {
78ad0e51b7b5 Improve wizards.txt parser, add functionality for specifying alternative /
Matti Hamalainen <ccr@tnsp.org>
parents: 2620
diff changeset
95 echo
78ad0e51b7b5 Improve wizards.txt parser, add functionality for specifying alternative /
Matti Hamalainen <ccr@tnsp.org>
parents: 2620
diff changeset
96 " <div class=\"locWizard ".
78ad0e51b7b5 Improve wizards.txt parser, add functionality for specifying alternative /
Matti Hamalainen <ccr@tnsp.org>
parents: 2620
diff changeset
97 (isset($wizard["desc"]) ? "locWizHasDesc" : "locWizHasNoDesc")."\">".
78ad0e51b7b5 Improve wizards.txt parser, add functionality for specifying alternative /
Matti Hamalainen <ccr@tnsp.org>
parents: 2620
diff changeset
98 "<a href=\"loc.php?a=".$wizard["name"]."\">".$wizard["name"]."</a>";
337
ca191c3a0ce1 Updates and lots of new ugly glue.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
99
2763
78ad0e51b7b5 Improve wizards.txt parser, add functionality for specifying alternative /
Matti Hamalainen <ccr@tnsp.org>
parents: 2620
diff changeset
100 if ($wizard["areas"] > 0)
78ad0e51b7b5 Improve wizards.txt parser, add functionality for specifying alternative /
Matti Hamalainen <ccr@tnsp.org>
parents: 2620
diff changeset
101 echo " <span class=\"locWizNumAreas\">(".$wizard["areas"].")</span>";
1387
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1334
diff changeset
102
1677
9d51b4138e7d CSS updates and related code changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 1646
diff changeset
103 echo "</div>\n";
337
ca191c3a0ce1 Updates and lots of new ugly glue.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
104 }
ca191c3a0ce1 Updates and lots of new ugly glue.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
105
2763
78ad0e51b7b5 Improve wizards.txt parser, add functionality for specifying alternative /
Matti Hamalainen <ccr@tnsp.org>
parents: 2620
diff changeset
106 echo "</div>\n";
1387
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1334
diff changeset
107 }
2763
78ad0e51b7b5 Improve wizards.txt parser, add functionality for specifying alternative /
Matti Hamalainen <ccr@tnsp.org>
parents: 2620
diff changeset
108
78ad0e51b7b5 Improve wizards.txt parser, add functionality for specifying alternative /
Matti Hamalainen <ccr@tnsp.org>
parents: 2620
diff changeset
109 echo
78ad0e51b7b5 Improve wizards.txt parser, add functionality for specifying alternative /
Matti Hamalainen <ccr@tnsp.org>
parents: 2620
diff changeset
110 "<p><b>".count($wizTable)."</b> wizards.</p>\n".
78ad0e51b7b5 Improve wizards.txt parser, add functionality for specifying alternative /
Matti Hamalainen <ccr@tnsp.org>
parents: 2620
diff changeset
111 "</div>\n"; // end of contents div
78ad0e51b7b5 Improve wizards.txt parser, add functionality for specifying alternative /
Matti Hamalainen <ccr@tnsp.org>
parents: 2620
diff changeset
112
78ad0e51b7b5 Improve wizards.txt parser, add functionality for specifying alternative /
Matti Hamalainen <ccr@tnsp.org>
parents: 2620
diff changeset
113 // Print out the alpha link index
78ad0e51b7b5 Improve wizards.txt parser, add functionality for specifying alternative /
Matti Hamalainen <ccr@tnsp.org>
parents: 2620
diff changeset
114 mpPrintExtraBoxAlphaList("ch", $alphaTable);
1387
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1334
diff changeset
115
2050
431c149e8882 Fix page layout.
Matti Hamalainen <ccr@tnsp.org>
parents: 2037
diff changeset
116 mpPrintPageFooter(FALSE);
1387
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1334
diff changeset
117 ?>