Initial commit

ZnoteX / Commit #5

Commit Initial commit

Alex Alex committed 01/10/2026 09:20 main Full upload
481 files +128,311 -0
A layouts/default/views/auction_wrong_engine.php +1-0 View file
@@ -0,0 +1,1 @@
1+<p><?= t('auc.wrong_engine') ?></p>
A layouts/default/views/bans.php +109-0 View file
@@ -0,0 +1,109 @@
1+<?php
2+/**
3+ * Public ban list.
4+ *
5+ * Prepared by bans.php:
6+ * $bansSupported false when this engine has no readable ban tables
7+ * $accountBans [name, reason, banned_at, expires_at]
8+ * $nameLocks [name, reason, at]
9+ * $ipBanCount number of active address bans, shown as a count only
10+ */
11+
12+/** "3 days left", "permanent", or "expired". */
13+function znote_ban_remaining(int $expires): string {
14+ if ($expires <= 0) {
15+ return t('bans.permanent');
16+ }
17+
18+ $left = $expires - time();
19+ if ($left <= 0) {
20+ return t('bans.expired');
21+ }
22+
23+ $days = intdiv($left, 86400);
24+ $hours = intdiv($left % 86400, 3600);
25+
26+ if ($days > 0) {
27+ return t('bans.days_left', ['n' => $days]);
28+ }
29+ if ($hours > 0) {
30+ return t('bans.hours_left', ['n' => $hours]);
31+ }
32+
33+ return t('bans.less_hour');
34+}
35+?>
36+<div class="znx-acct">
37+
38+<div class="znx-acct-head"><?= t('bans.title') ?></div>
39+
40+<?php if (!$bansSupported): ?>
41+
42+ <div class="znx-empty-box"><?= t('bans.unsupported') ?></div>
43+
44+<?php else: ?>
45+
46+ <div class="znx-acct-info">
47+ <?= t('bans.intro') ?>
48+ <?php if ($ipBanCount > 0): ?>
49+ <?= t('bans.ip_count', ['count' => (int)$ipBanCount]) ?>
50+ <?php endif; ?>
51+ </div>
52+
53+ <div class="znx-acct-head"><?= t('bans.accounts') ?></div>
54+ <?php if ($accountBans): ?>
55+ <div class="znx-acct-table-wrap">
56+ <table class="znx-acct-table">
57+ <tr class="yellow">
58+ <td><?= t('common.character') ?></td>
59+ <td><?= t('common.reason') ?></td>
60+ <td><?= t('bans.banned') ?></td>
61+ <td><?= t('common.status') ?></td>
62+ </tr>
63+ <?php foreach ($accountBans as $ban): ?>
64+ <tr>
65+ <td>
66+ <a href="characterprofile.php?name=<?= urlencode($ban['name']) ?>">
67+ <?= htmlspecialchars($ban['name'], ENT_QUOTES, 'UTF-8') ?>
68+ </a>
69+ </td>
70+ <td><?= htmlspecialchars($ban['reason'], ENT_QUOTES, 'UTF-8') ?></td>
71+ <td><?= htmlspecialchars(getClock($ban['banned_at'], true), ENT_QUOTES, 'UTF-8') ?></td>
72+ <td><?= htmlspecialchars(znote_ban_remaining($ban['expires_at']), ENT_QUOTES, 'UTF-8') ?></td>
73+ </tr>
74+ <?php endforeach; ?>
75+ </table>
76+ </div>
77+ <?php else: ?>
78+ <div class="znx-empty-box"><?= t('bans.none') ?></div>
79+ <?php endif; ?>
80+
81+ <div class="znx-acct-head"><?= t('bans.namelocks') ?></div>
82+ <?php if ($nameLocks): ?>
83+ <div class="znx-acct-table-wrap">
84+ <table class="znx-acct-table">
85+ <tr class="yellow">
86+ <td><?= t('common.character') ?></td>
87+ <td><?= t('common.reason') ?></td>
88+ <td><?= t('bans.locked') ?></td>
89+ </tr>
90+ <?php foreach ($nameLocks as $lock): ?>
91+ <tr>
92+ <td>
93+ <a href="characterprofile.php?name=<?= urlencode($lock['name']) ?>">
94+ <?= htmlspecialchars($lock['name'], ENT_QUOTES, 'UTF-8') ?>
95+ </a>
96+ </td>
97+ <td><?= htmlspecialchars($lock['reason'], ENT_QUOTES, 'UTF-8') ?></td>
98+ <td><?= htmlspecialchars(getClock($lock['at'], true), ENT_QUOTES, 'UTF-8') ?></td>
99+ </tr>
100+ <?php endforeach; ?>
101+ </table>
102+ </div>
103+ <?php else: ?>
104+ <div class="znx-empty-box"><?= t('bans.no_namelocks') ?></div>
105+ <?php endif; ?>
106+
107+<?php endif; ?>
108+
109+</div><!-- .znx-acct -->
A layouts/default/views/blank.php +4-0 View file
@@ -0,0 +1,4 @@
1+<?php ?>
2+
3+<h1><?= t('blank.title') ?></h1>
4+<p><?= t('blank.text') ?></p>
A layouts/default/views/buypoints.php +1-0 View file
@@ -0,0 +1,1 @@
1+<?php theme_include('parts/buypoints-modern.php'); ?>
A layouts/default/views/changelog.php +26-0 View file
@@ -0,0 +1,26 @@
1+<?php
2+/**
3+ * Public changelog.
4+ *
5+ * Prepared by changelog.php: $changelogs - newest first, or an empty array.
6+ */
7+?>
8+<h1><?= t('changelog.title') ?></h1>
9+
10+<?php if ($changelogs): ?>
11+ <table id="changelogTable">
12+ <tr class="yellow">
13+ <td><?= t('changelog.header') ?></td>
14+ </tr>
15+ <?php foreach ($changelogs as $changelog): ?>
16+ <tr>
17+ <td>
18+ <b><?= htmlspecialchars(getClock((int)($changelog['time'] ?? 0), true, true), ENT_QUOTES, 'UTF-8') ?></b><br>
19+ <?= znote_bbcode_raw($changelog['text']) ?>
20+ </td>
21+ </tr>
22+ <?php endforeach; ?>
23+ </table>
24+<?php else: ?>
25+ <h2><?= t('changelog.none') ?></h2>
26+<?php endif; ?>
A layouts/default/views/changepassword.php +45-0 View file
@@ -0,0 +1,45 @@
1+<?php
2+/**
3+ * Change password.
4+ *
5+ * Prepared by changepassword.php:
6+ * $formState 'success' | 'errors' | 'form'
7+ * $errors array of messages, when $formState is 'errors'
8+ *
9+ * The password write happens in changepassword.php, never here.
10+ */
11+?>
12+<div class="znx-acct">
13+
14+<div class="znx-acct-head"><?= t('changepw.title') ?></div>
15+
16+<?php if ($formState === 'success'): ?>
17+
18+ <div class="znx-acct-info znx-editchar-notice znx-editchar-notice--ok"><?= t('changepw.success') ?><br><?= t('changepw.relogin') ?></div>
19+
20+<?php else: ?>
21+
22+ <?php if ($formState === 'errors'): ?>
23+ <div class="znx-acct-info znx-editchar-notice znx-editchar-notice--error"><?= output_errors($errors) ?></div>
24+ <?php endif; ?>
25+
26+ <form action="" method="post" class="znx-editchar-box">
27+ <div class="znx-settings-field">
28+ <label><?= t('changepw.current') ?></label>
29+ <input type="password" name="current_password" class="znx-acct-select">
30+ </div>
31+ <div class="znx-settings-field">
32+ <label><?= t('changepw.new') ?></label>
33+ <input type="password" name="new_password" class="znx-acct-select">
34+ </div>
35+ <div class="znx-settings-field">
36+ <label><?= t('changepw.new_again') ?></label>
37+ <input type="password" name="new_password_again" class="znx-acct-select">
38+ </div>
39+ <?php Token::create(); ?>
40+ <button type="submit" class="znx-acct-btn"><?= t('changepw.title') ?></button>
41+ </form>
42+
43+<?php endif; ?>
44+
45+</div><!-- .znx-acct -->
A layouts/default/views/character_search.php +15-0 View file
@@ -0,0 +1,15 @@
1+<?php
2+
3+?>
4+<h1><?= t('char.search_title') ?></h1>
5+<form action="characterprofile.php" method="get">
6+ <ul>
7+ <li>
8+ <?= t('char.search_name') ?><br>
9+ <input type="text" name="name" autofocus>
10+ </li>
11+ <li>
12+ <input type="submit" value="<?= t('char.search_submit') ?>">
13+ </li>
14+ </ul>
15+</form>
A layouts/default/views/contact.php +13-0 View file
@@ -0,0 +1,13 @@
1+<?php ?>
2+
3+<div class="znx-acct">
4+
5+<div class="znx-acct-head"><?= t('contact.title') ?></div>
6+<?php $contactInfo = trim((string)($config['contact_info'] ?? '')); ?>
7+<?php if ($contactInfo !== ''): ?>
8+ <div class="znx-acct-info"><?= nl2br(htmlspecialchars($contactInfo, ENT_QUOTES, 'UTF-8')) ?></div>
9+<?php else: ?>
10+ <div class="znx-empty-box"><?= t('contact.text') ?></div>
11+<?php endif; ?>
12+
13+</div><!-- .znx-acct -->
A layouts/default/views/createcharacter.php +79-0 View file
@@ -0,0 +1,79 @@
1+<?php
2+/**
3+ * Create character.
4+ *
5+ * Prepared by createcharacter.php:
6+ * $formState 'success' | 'errors' | 'form'
7+ * $errors array of messages, when $formState is 'errors'
8+ *
9+ * The character creation happens in createcharacter.php, never here.
10+ */
11+?>
12+<div class="znx-acct">
13+
14+<div class="znx-acct-head"><?= t('createchar.title') ?></div>
15+
16+<?php if ($formState === 'success'): ?>
17+
18+ <div class="znx-acct-info znx-editchar-notice znx-editchar-notice--ok"><?= t('createchar.success') ?></div>
19+
20+<?php else: ?>
21+
22+ <?php if ($formState === 'errors'): ?>
23+ <div class="znx-acct-info znx-editchar-notice znx-editchar-notice--error"><?= output_errors($errors) ?></div>
24+ <?php endif; ?>
25+
26+ <form action="" method="post" class="znx-editchar-box">
27+ <div class="znx-settings-field">
28+ <label><?= t('createchar.name') ?></label>
29+ <input type="text" name="name" class="znx-acct-select">
30+ </div>
31+ <div class="znx-settings-field">
32+ <!-- Available vocations to select from when creating character -->
33+ <label><?= t('createchar.vocation') ?></label>
34+ <select name="selected_vocation" class="znx-acct-select">
35+ <?php foreach ($config['available_vocations'] as $id) { ?>
36+ <option value="<?php echo $id; ?>"><?php echo vocation_id_to_name($id); ?></option>
37+ <?php } ?>
38+ </select>
39+ </div>
40+ <div class="znx-settings-field">
41+ <!-- Available genders to select from when creating character -->
42+ <label><?= t('createchar.gender') ?></label>
43+ <select name="selected_gender" class="znx-acct-select">
44+ <option value="1"><?= t('createchar.male') ?></option>
45+ <option value="0"><?= t('createchar.female') ?></option>
46+ </select>
47+ </div>
48+ <?php
49+ $available_towns = $config['available_towns'];
50+ if (count($available_towns) > 1):
51+ ?>
52+ <div class="znx-settings-field">
53+ <!-- Available towns to select from when creating character -->
54+ <label><?= t('createchar.town') ?></label>
55+ <select name="selected_town" class="znx-acct-select">
56+ <?php
57+ foreach ($available_towns as $tid):
58+ ?>
59+ <option value="<?php echo $tid; ?>"><?php echo town_id_to_name($tid); ?></option>
60+ <?php
61+ endforeach;
62+ ?>
63+ </select>
64+ </div>
65+ <?php
66+ else:
67+ ?>
68+ <input type="hidden" name="selected_town" value="<?php echo end($available_towns); ?>">
69+ <?php
70+ endif;
71+
72+ /* Form file */
73+ Token::create();
74+ ?>
75+ <button type="submit" class="znx-acct-btn"><?= t('createchar.title') ?></button>
76+ </form>
77+<?php endif; ?>
78+
79+</div><!-- .znx-acct -->
A layouts/default/views/creatures.php +70-0 View file
@@ -0,0 +1,70 @@
1+<?php
2+/**
3+ * Creature library.
4+ *
5+ * Prepared by creatures.php: $creatures, $creatureRaces, $creatureSearch,
6+ * $creatureRace, $creatureError. Nothing is read from disk here.
7+ */
8+?>
9+<div class="znx-acct">
10+
11+<div class="znx-acct-head"><?= t('creatures.title') ?></div>
12+
13+<?php if ($creatureError !== ''): ?>
14+
15+ <div class="znx-empty-box"><?= htmlspecialchars($creatureError, ENT_QUOTES, 'UTF-8') ?></div>
16+
17+<?php else: ?>
18+
19+ <form action="" method="get" class="znx-acct-toolbar">
20+ <div class="znx-acct-toolbar__field">
21+ <input type="text" name="search" placeholder="<?= t('creatures.placeholder') ?>" class="znx-acct-select"
22+ value="<?= htmlspecialchars($creatureSearch, ENT_QUOTES, 'UTF-8') ?>">
23+ </div>
24+ <div class="znx-acct-toolbar__field">
25+ <select name="race" class="znx-acct-select">
26+ <option value=""><?= t('creatures.all_races') ?></option>
27+ <?php foreach ($creatureRaces as $race): ?>
28+ <option value="<?= htmlspecialchars($race, ENT_QUOTES, 'UTF-8') ?>"
29+ <?= $race === $creatureRace ? 'selected' : '' ?>>
30+ <?= htmlspecialchars(ucfirst($race), ENT_QUOTES, 'UTF-8') ?>
31+ </option>
32+ <?php endforeach; ?>
33+ </select>
34+ </div>
35+ <div class="znx-acct-toolbar__submit"><button type="submit" class="znx-acct-btn"><?= t('common.search') ?></button></div>
36+ <?php if ($creatureSearch !== '' || $creatureRace !== ''): ?>
37+ <div class="znx-acct-toolbar__submit"><a href="creatures.php" class="znx-acct-edit-btn"><?= t('common.clear') ?></a></div>
38+ <?php endif; ?>
39+ </form>
40+
41+ <div class="znx-acct-info"><?= count($creatures) ?> creature<?= count($creatures) === 1 ? '' : 's' ?>.</div>
42+
43+ <?php if ($creatures): ?>
44+ <div class="znx-acct-table-wrap">
45+ <table class="znx-acct-table">
46+ <tr class="yellow">
47+ <td>Name</td>
48+ <td>Race</td>
49+ <td>Health</td>
50+ <td><?= t('creatures.experience') ?></td>
51+ <td>Speed</td>
52+ </tr>
53+ <?php foreach ($creatures as $creature): ?>
54+ <tr>
55+ <td><?= htmlspecialchars($creature['name'], ENT_QUOTES, 'UTF-8') ?></td>
56+ <td><?= htmlspecialchars(ucfirst($creature['race']), ENT_QUOTES, 'UTF-8') ?></td>
57+ <td><?= number_format($creature['health']) ?></td>
58+ <td><?= number_format($creature['experience']) ?></td>
59+ <td><?= number_format($creature['speed']) ?></td>
60+ </tr>
61+ <?php endforeach; ?>
62+ </table>
63+ </div>
64+ <?php else: ?>
65+ <div class="znx-empty-box"><?= t('creatures.no_match') ?></div>
66+ <?php endif; ?>
67+
68+<?php endif; ?>
69+
70+</div><!-- .znx-acct -->
A layouts/default/views/credits.php +104-0 View file
@@ -0,0 +1,104 @@
1+<?php ?>
2+
3+<div class="znx-acct">
4+
5+<div class="znx-acct-head">ZnoteX</div>
6+<div class="znx-acct-info"><?= t('credits.znotex_text') ?></div>
7+
8+<div class="znx-acct-head"><?= t('credits.maintained') ?></div>
9+<div class="developers">
10+ <div class="developer">
11+ <div class="avatar"><img src="<?php echo $creditsMaintainer['avatar']; ?>" alt="<?= t('credits.avatar_of', ['name' => $creditsMaintainer['login']]) ?>"></div>
12+ <p class="username"><a href="<?php echo $creditsMaintainer['url']; ?>" target="_blank" rel="noopener"><?php echo $creditsMaintainer['login']; ?></a>
13+ <br><?php echo $creditsMaintainer['role']; ?></p>
14+ </div>
15+</div>
16+
17+<div class="znx-acct-head">Znote AAC</div>
18+<div class="znx-acct-info">
19+ <p><?= t('credits.znote_text') ?></p>
20+ <p><?= t('credits.ot_website') ?> <a href="https://otland.net/members/znote.5993/">Znote</a> <?= t('credits.from_community') ?> <a href="https://otland.net">otland.net</a>.</p>
21+ <p><?= t('credits.opensource') ?></p>
22+</div>
23+
24+<div class="znx-acct-head"><?= t('credits.developers') ?></div>
25+<?php // If CURL isn't enabled show default version.
26+if(!function_exists('curl_version')):
27+ ?>
28+ <p><a href="https://github.com/Znote/ZnoteAAC/graphs/contributors"><?= t('credits.full_list') ?></a>.</p>
29+<?php else:
30+ // CURL enabled. Lets create an API web request to github.
31+ $request = curl_init();
32+ curl_setopt($request, CURLOPT_URL, 'https://api.github.com/repos/Znote/ZnoteAAC/contributors');
33+ curl_setopt($request, CURLOPT_RETURNTRANSFER, 1);
34+ curl_setopt($request, CURLOPT_USERAGENT, 'ZnoteAAC'); // GitHub requires user agent header.
35+ curl_setopt($request, CURLOPT_SSL_VERIFYPEER, false);
36+
37+ // Load contributors and close the request.
38+ $developers = json_decode((string)curl_exec($request), true); // Sorted by contributions.
39+ curl_close($request);
40+ if (!is_array($developers)) $developers = array();
41+ ?>
42+ <div class="developers">
43+ <?php foreach ($developers as $developer): ?>
44+ <div class="developer">
45+ <div class="avatar"><img src="<?php echo $developer['avatar_url']; ?>" alt="<?= t('credits.avatar_of', ['name' => $developer['login']]) ?>"></div>
46+ <p class="username"><a href="<?php echo $developer['html_url']; ?>"><?php echo $developer['login']; ?></a>
47+ <br><?= t('credits.updates') ?> <?php echo $developer['contributions']; ?></p>
48+ </div>
49+ <?php endforeach; ?>
50+ </div>
51+ <style type="text/css">
52+ /* Credits.php specific CSS alterations */
53+ .developers {
54+ width: 100%;
55+ }
56+ .developers:after {
57+ content: '';
58+ display: block;
59+ clear: both;
60+ }
61+ .developer {
62+ width: calc(20% - 16px);
63+ float: left;
64+ padding: 0 8px 16px;
65+ }
66+ .developer img {
67+ width: 100%;
68+ }
69+ .username {
70+ margin: 8px 0 0;
71+ text-align: center;
72+ overflow: hidden;
73+ }
74+ </style>
75+ <?php
76+endif;
77+?>
78+
79+<div class="znx-acct-head"><?= t('credits.thanks') ?></div>
80+<div class="znx-acct-info">
81+ <a href="https://otland.net/members/chris.13882/">Chris</a> - <?= t('credits.thanks_chris') ?>
82+ <br><a href="https://otland.net/members/kiwi-dan.152/">Kiwi Dan</a> - <?= t('credits.thanks_kiwidan') ?>
83+ <br><a href="https://otland.net/members/amoaz.26626/">Amoaz</a> - <?= t('credits.thanks_amoaz') ?>
84+ <br><a href="https://otland.net/members/evan.40401/">Evan</a>, <a href="https://otland.net/members/gremlee.12075/">Gremlee</a> - <?= t('credits.thanks_evan_gremlee') ?>
85+ <br><a href="https://otland.net/members/att3.98289/">ATT3</a> - <?= t('credits.thanks_att3') ?>
86+ <br><a href="https://otland.net/members/mark.1/">Mark</a> - <?= t('credits.thanks_mark') ?>
87+ <br><a href="https://github.com/tedbro">Tedbro</a>, <a href="https://github.com/exura">Exura</a>, <a href="https://github.com/PrinterLUA">PrinterLUA</a> - <?= t('credits.thanks_bugreporters') ?>
88+ <br><a href="https://github.com/Nottinghster">Nottinghster</a> - <?= t('credits.thanks_nottinghster') ?>
89+</div>
90+<style>
91+.contributors {
92+ margin-top: 10px;
93+ padding: 5px;
94+ border: 1px solid rgb(184, 184, 184);
95+ display: inline-flex;
96+ width: 100%;
97+}
98+.contributor {
99+ padding: 10px;
100+ text-align: center;
101+}
102+</style>
103+
104+</div><!-- .znx-acct -->
A layouts/default/views/deaths.php +33-0 View file
@@ -0,0 +1,33 @@
1+<?php
2+?>
3+<div class="znx-acct">
4+
5+<div class="znx-acct-head"><?= t('deaths.latest') ?></div>
6+
7+<?php if ($deaths): ?>
8+<div class="znx-acct-table-wrap">
9+<table id="deathsTable" class="znx-acct-table">
10+ <tr class="yellow">
11+ <th><?= t('killers.victim') ?></th>
12+ <th><?= t('common.time') ?></th>
13+ <th><?= t('killers.killer') ?></th>
14+ </tr>
15+ <?php foreach ($deaths as $death) {
16+ echo '<tr>';
17+ echo "<td>". t('deaths.at_level', ['level' => $death['level']]) ." <a href='characterprofile.php?name=". $death['victim'] ."'>". $death['victim'] ."</a></td>";
18+ echo "<td>". getClock($death['time'], true) ."</td>";
19+ if ($death['is_player'] == 1) echo "<td>". t('deaths.player') ." <a href='characterprofile.php?name=". $death['killed_by'] ."'>". $death['killed_by'] ."</a></td>";
20+ else if ($death['is_player'] == 0) {
21+ if (znote_server_adapter()->normalizedEngine() === 'TFS_03') echo "<td>". t('deaths.monster') ." ". ucfirst(str_replace("a ", "", $death['killed_by'])) ."</td>";
22+ else echo "<td>". t('deaths.monster') ." ". ucfirst($death['killed_by']) ."</td>";
23+ }
24+ else echo "<td>". $death['killed_by'] ."</td>";
25+ echo '</tr>';
26+ } ?>
27+</table>
28+</div>
29+<?php else: ?>
30+<div class="znx-empty-box"><?= t('deaths.none') ?></div>
31+<?php endif; ?>
32+
33+</div><!-- .znx-acct -->
A layouts/default/views/downloads.php +41-0 View file
@@ -0,0 +1,41 @@
1+<?php ?>
2+
3+<div class="znx-acct">
4+
5+<div class="znx-acct-head"><?= t('downloads.title') ?></div>
6+
7+<?php foreach (znote_download_entries_by_section() as $section => $entries): ?>
8+ <div class="znx-acct-head"><?= htmlspecialchars(ucwords(str_replace('_', ' ', $section)), ENT_QUOTES, 'UTF-8') ?></div>
9+ <div class="znx-dl-grid">
10+ <?php foreach ($entries as $entry): ?>
11+ <div class="znx-dl-card">
12+ <?php if ($entry['image'] !== ''): ?>
13+ <img src="<?= htmlspecialchars($entry['image'], ENT_QUOTES, 'UTF-8') ?>" alt="">
14+ <?php endif; ?>
15+ <span class="znx-dl-card__label"><?= htmlspecialchars($entry['label'], ENT_QUOTES, 'UTF-8') ?></span>
16+ <?php if ($entry['description'] !== ''): ?>
17+ <span class="znx-dl-card__desc"><?= htmlspecialchars($entry['description'], ENT_QUOTES, 'UTF-8') ?></span>
18+ <?php endif; ?>
19+ <a href="<?= htmlspecialchars($entry['url'], ENT_QUOTES, 'UTF-8') ?>" class="znx-dl-card__btn"><?= t('downloads.download') ?></a>
20+ </div>
21+ <?php endforeach; ?>
22+ </div>
23+<?php endforeach; ?>
24+
25+<div class="znx-acct-head"><?= t('downloads.howto') ?></div>
26+<div class="znx-editchar-box">
27+ <ol class="znx-dl-steps">
28+ <li>
29+ <a href="<?php echo $config['client_download']; ?>"><?= t('downloads.download') ?></a> <?= t('downloads.step1') ?>
30+ </li>
31+ <li>
32+ <?= t('downloads.step5') ?> <strong>Apply</strong>.
33+ </li>
34+ </ol>
35+ <div class="znx-dl-register">
36+ <span><?= t('downloads.step5b') ?></span>
37+ <a href="register.php" class="znx-dl-card__btn"><?= t_default('downloads.register_cta', 'Register Account') ?></a>
38+ </div>
39+</div>
40+
41+</div><!-- .znx-acct -->
A layouts/default/views/failed.php +3-0 View file
@@ -0,0 +1,3 @@
1+<?php ?>
2+<h1><?= t('failed.title') ?></h1>
3+<p><?= t('failed.text') ?></p>
A layouts/default/views/faq.php +29-0 View file
@@ -0,0 +1,29 @@
1+<?php
2+/**
3+ * Public FAQ.
4+ *
5+ * Prepared by faq.php: $faqEntries, each ['question', 'answer'], in the
6+ * order set at Admin Panel > Settings > Content > FAQ questions.
7+ */
8+?>
9+<style>
10+.faq-entry { border: 1px solid #ccc; margin-bottom: 6px; padding: 6px 10px; }
11+.faq-entry summary { cursor: pointer; font-weight: bold; }
12+.faq-entry p { margin: 8px 0 2px; }
13+</style>
14+<h1><?= t('faq.title') ?></h1>
15+
16+<?php if ($faqEntries): ?>
17+ <?php foreach ($faqEntries as $entry):
18+ $question = trim((string)($entry['question'] ?? ''));
19+ $answer = trim((string)($entry['answer'] ?? ''));
20+ if ($question === '') continue;
21+ ?>
22+ <details class="faq-entry">
23+ <summary><?= h($question) ?></summary>
24+ <p><?= nl2br(h($answer)) ?></p>
25+ </details>
26+ <?php endforeach; ?>
27+<?php else: ?>
28+ <h2><?= t('faq.none') ?></h2>
29+<?php endif; ?>
A layouts/default/views/gallery.php +1-0 View file
@@ -0,0 +1,1 @@
1+<?php theme_include('parts/gallery-modern.php'); ?>
A layouts/default/views/guilds.php +46-0 View file
@@ -0,0 +1,46 @@
1+<?php
2+?>
3+<style type="text/css">
4+ #guildsTable tr {
5+ cursor: pointer;
6+ }
7+</style>
8+<div class="znx-acct">
9+
10+<div class="znx-acct-head"><?= t('nav.guilds') ?></div>
11+
12+<div class="znx-acct-table-wrap">
13+<table id="guildsTable" class="znx-acct-table">
14+ <tr class="yellow">
15+ <th><?= t('guild.logo_label') ?></th>
16+ <th><?= t('common.description') ?></th>
17+ <th><?= t('guild.data') ?></th>
18+ </tr>
19+ <?php
20+ foreach ($guilds as $guild) {
21+ if ($guild['total'] >= 1) {
22+ $url = url("guilds.php?name=". $guild['name']);
23+ ?>
24+ <tr class="special" onclick="javascript:window.location.href='<?php echo $url; ?>'">
25+ <td style="width: 100px;">
26+ <img style="max-height: 100px; margin: auto; display: block;"
27+ src="<?php logo_exists($guild['name']); ?>">
28+ </td>
29+ <td>
30+ <b><?php echo $guild['name']; ?></b>
31+ <?php if (strlen($guild['motd']) > 0) echo '<br>'.$guild['motd']; ?>
32+ </td>
33+ <td>
34+ <?php echo "Total members: ".$guild['level']['players']; ?>
35+ <br><?php echo "Average level: ".$guild['level']['avg'].""; ?>
36+ <br><?php echo "Guild level: ".$guild['level']['total']; ?>
37+ </td>
38+ </tr>
39+ <?php
40+ }
41+ }
42+ ?>
43+</table>
44+</div>
45+
46+</div><!-- .znx-acct -->
A layouts/default/views/guildwar.php +191-0 View file
@@ -0,0 +1,191 @@
1+<?php
2+
3+if (!empty($_GET['warid'])) {
4+ $warid = (int)$_GET['warid']; // Sanitizing GET.
5+
6+ if (in_array(znote_server_adapter()->normalizedEngine(), array('TFS_02', 'OTHIRE', 'TFS_10'), true)) $war = get_guild_war($warid);
7+ else if (znote_server_adapter()->normalizedEngine() === 'TFS_03') $war = get_guild_war03($warid);
8+ else die("Can't recognize TFS version. It has to be either TFS_02 or TFS_03. Correct this in config.php");
9+
10+ if ($war != false) {
11+ // Kills data for this specific war entry
12+ if (in_array(znote_server_adapter()->normalizedEngine(), array('TFS_02', 'OTHIRE', 'TFS_10'), true)) $kills = get_war_kills($warid);
13+ else if (znote_server_adapter()->normalizedEngine() === 'TFS_03') $kills = get_war_kills03($warid);
14+ ?>
15+ <h1><?php echo $war['name1']; ?> - <?= t('guildwar.versus') ?> - <?php echo $war['name2']; ?></h1>
16+
17+ <?php
18+ // Collecting <ul> data:
19+ $guild1 = $war['guild1'];
20+ $g1c = 0; // kill count
21+
22+ $guild2 = $war['guild2'];
23+ $g2c = 0; // kill count
24+
25+ if (in_array(znote_server_adapter()->normalizedEngine(), array('TFS_02', 'OTHIRE', 'TFS_10'), true)) {
26+ foreach (($kills ? $kills : array()) as $kill) {
27+ if ($kill['killerguild'] == $guild1)
28+ $g1c++;
29+ else
30+ $g2c++;
31+ }
32+
33+ $green = false;
34+ if ($g1c > $g2c) {
35+ $leading = $war['name1'];
36+ $green = true;
37+ } else if ($g2c > $g1c) $leading = $war['name2'];
38+ else $leading = t('guildwar.tie');
39+ }
40+ ?>
41+ <ul class="war_list">
42+ <li>
43+ <?= t('guildwar.status', ['status' => $config['war_status'][$war['status']]]) ?>
44+ </li>
45+ <?php if (in_array(znote_server_adapter()->normalizedEngine(), array('TFS_02', 'OTHIRE', 'TFS_10'), true)) { ?>
46+ <li>
47+ <?= t('guildwar.leading', ['guild' => $leading]) ?>
48+ </li>
49+ <li>
50+ <?php
51+ if ($green)
52+ echo t('guildwar.score') .' <font color="green">'. $g1c .'</font>-<font color="red">'. $g2c .'</font>';
53+ else if ($g1c == $g2c)
54+ echo t('guildwar.score') .' <font color="orange">'. $g1c .'</font>-<font color="orange">'. $g2c .'</font>';
55+ else
56+ echo t('guildwar.score') .' <font color="red">'. $g1c .'</font>-<font color="green">'. $g2c .'</font>';
57+ ?>
58+ </li>
59+ <?php } ?>
60+ </ul>
61+ <?php
62+ if (in_array(znote_server_adapter()->normalizedEngine(), array('TFS_02', 'OTHIRE', 'TFS_10'), true)) {
63+ ?>
64+ <table id="guildwarTable" class="table table-striped table-hover">
65+ <tr class="yellow">
66+ <th><?= t('guildwar.killerguild') ?></th>
67+ <th><?= t('guildwar.killer') ?></th>
68+ <th><?= t('guildwar.victim') ?></th>
69+ <th><?= t('guildwar.time') ?></th>
70+ </tr>
71+ <?php
72+ foreach (($kills ? $kills : array()) as $kill) {
73+ echo '<tr>';
74+ //echo '<td>'. get_guild_name($kill['killerguild']) .'</td>';
75+ echo '<td><a href="guilds.php?name='. get_guild_name($kill['killerguild']) .'">'. get_guild_name($kill['killerguild']) .'</a></td>';
76+ echo '<td><a href="characterprofile.php?name='. $kill['killer'] .'">'. $kill['killer'] .'</a></td>';
77+ echo '<td><a href="characterprofile.php?name='. $kill['target'] .'">'. $kill['target'] .'</a></td>';
78+ echo '<td>'. getClock($kill['time'], true) .'</td>';
79+ echo '</tr>';
80+ }
81+ ?>
82+ </table>
83+ <?php
84+ }
85+ if (znote_server_adapter()->normalizedEngine() === 'TFS_03') {
86+ // BORROWED FROM GESIOR (and ported to work on Znote AAC).
87+ $main_content = "";
88+ $deaths = gesior_sql_death($warid);
89+ if($deaths !== false)
90+ {
91+ //die(print_r($deaths));
92+ foreach($deaths as $death)
93+ {
94+ $killers = gesior_sql_killer((int)$death['id']);
95+ $count = count($killers); $i = 0;
96+
97+ $others = false;
98+ $main_content .= date("j M Y, H:i", $death['date']) . " <span style=\"font-weight: bold; color: " . ($death['enemy'] == $war['guild_id'] ? "red" : "lime") . ";\">+</span>
99+<a href=\"characterprofile.php?name=" . urlencode($death['name']) . "\"><b>".$death['name']."</b></a> ";
100+ foreach($killers as $killer)
101+ {
102+ $i++;
103+ if($killer['is_war'] != 0)
104+ {
105+ if($i == 1)
106+ $main_content .= t('guildwar.killed_by', ['level' => $death['level']]) ." ";
107+ else if($i == $count && $others == false)
108+ $main_content .= " ". t('guildwar.and_by') ." ";
109+ else
110+ $main_content .= ", ";
111+ if($killer['player_exists'] == 0)
112+ $main_content .= "<a href=\"characterprofile.php?name=".urlencode($killer['player_name'])."\">";
113+
114+ $main_content .= $killer['player_name'];
115+ if($killer['player_exists'] == 0)
116+ $main_content .= "</a>";
117+ }
118+ else
119+ $others = true;
120+
121+ if($i == $count)
122+ {
123+ if($others == true)
124+ $main_content .= " ". t('guildwar.few_others');
125+ $main_content .= ".<br />";
126+ }
127+ }
128+ }
129+ }
130+ else
131+ $main_content .= "<center>". t('guildwar.no_frags') ."</center>";
132+ echo $main_content;
133+ // END BORROWED FROM GESIOR
134+ }
135+ }
136+
137+} else {
138+ // Display current wars.
139+
140+ // Fetch list of wars
141+ if (in_array(znote_server_adapter()->normalizedEngine(), array('TFS_02', 'OTHIRE', 'TFS_10'), true)) $wardata = get_guild_wars();
142+ else if (znote_server_adapter()->normalizedEngine() === 'TFS_03') $wardata = get_guild_wars03();
143+ else die("Can't recognize TFS version. It has to be either TFS_02 or TFS_03. Correct this in config.php");
144+ //echo $wardata[0]['name1'];
145+ //die(var_dump($wardata));
146+ if ($wardata != false) {
147+ // kills data
148+ $killsdata = array(); // killsdata[guildid] => array(warid) => array info about the selected war entry
149+ foreach ($wardata as $wars) {
150+ if (in_array(znote_server_adapter()->normalizedEngine(), array('TFS_02', 'OTHIRE', 'TFS_10'), true)) $killsdata[$wars['id']] = get_war_kills($wars['id']);
151+ else if (znote_server_adapter()->normalizedEngine() === 'TFS_03') $killsdata[$wars['id']] = get_war_kills03($wars['id']);
152+ }
153+ ?>
154+
155+ <table id="guildwarViewTable" class="table table-striped table-hover">
156+ <tr class="yellow">
157+ <th><?= t('guildwar.attacking') ?></th>
158+ <th><?= t('guildwar.deathcount') ?></th>
159+ <th><?= t('guildwar.defending') ?></th>
160+ </tr>
161+ <?php
162+ foreach ($wardata as $wars) {
163+ $guild_1_kills = 0;
164+ $guild_2_kills = 0;
165+ foreach (($killsdata[$wars['id']] ? $killsdata[$wars['id']] : array()) as $kill) {
166+
167+ if ($isOtx && $kill['guild_id'] == $wars['guild1'] || !$isOtx && $kill['killerguild'] == $wars['guild1'])
168+ $guild_1_kills++;
169+ else
170+ $guild_2_kills++;
171+ }
172+ $url = url("guildwar.php?warid=". $wars['id']);
173+ $guildname1 = url("guilds.php?name=". $wars['name1']);
174+ $guildname2 = url("guilds.php?name=". $wars['name2']);
175+ echo '<tr>';
176+ echo '<td><a href="' . $guildname1 . '">'. $wars['name1'] .'</a></td>';
177+ echo '<td>'. $guild_1_kills .' - ' . $guild_2_kills . '</td>';
178+ echo '<td><a href="' . $guildname2 . '">'. $wars['name2'] .'</a></td>';
179+ echo '<td><a href="' . $url . '">'. t('common.view') .'</a></td>';
180+ echo '</tr>';
181+ }
182+ ?>
183+ </table>
184+
185+ <?php
186+ } else {
187+ echo t('guildwar.none');
188+ }
189+}
190+// GET links sample:
191+// guildwar.php?warid=1
A layouts/default/views/guild_create_form.php +7-0 View file
@@ -0,0 +1,7 @@
1+<?php
2+?>
3+<div class="znx-acct-head"><?= t_default('guild.create_heading', 'Create Guild') ?></div>
4+<div class="znx-guild-create">
5+<?php echo $guildCreateFormHtml; ?>
6+</div>
7+
A layouts/default/views/guild_overview.php +6-0 View file
@@ -0,0 +1,6 @@
1+<?php
2+?>
3+<div class="znx-guild-overview">
4+<?php echo $guildOverviewHtml; ?>
5+</div>
6+
A layouts/default/views/helpdesk_list.php +71-0 View file
@@ -0,0 +1,71 @@
1+<?php
2+?>
3+<div class="znx-acct">
4+
5+<div class="znx-acct-head"><?= t('helpdesk.latest') ?></div>
6+<?php if ($tickets !== false): ?>
7+ <div class="znx-acct-table-wrap">
8+ <table class="znx-acct-table">
9+ <tr class="yellow">
10+ <td>ID:</td>
11+ <td><?= t('helpdesk.subject') ?></td>
12+ <td><?= t('helpdesk.creation') ?></td>
13+ <td>Status:</td>
14+ </tr>
15+ <?php
16+ foreach ($tickets as $ticket) {
17+ echo '<tr class="special">';
18+ echo '<td>'. $ticket['id'] .'</td>';
19+ echo '<td><a href="helpdesk.php?view='. $ticket['id'] .'">'. $ticket['subject'] .'</a></td>';
20+ echo '<td>'. getClock($ticket['creation'], true) .'</td>';
21+ echo '<td>'. $ticket['status'] .'</td>';
22+ echo '</tr>';
23+ }
24+ ?>
25+ </table>
26+ </div>
27+<?php endif; ?>
28+
29+<div class="znx-acct-head"><?= t('helpdesk.title') ?></div>
30+<?php if ($helpdeskCreated): ?>
31+ <div class="znx-acct-info"><?= t('helpdesk.created') ?></div>
32+<?php else: ?>
33+ <?php if (empty($errors) === false): ?>
34+ <div class="znx-acct-info znx-editchar-notice znx-editchar-notice--error"><?= output_errors($errors) ?></div>
35+ <?php endif; ?>
36+ <form action="" method="post" class="znx-editchar-box">
37+ <div class="znx-settings-field">
38+ <label>Account Name</label>
39+ <input type="text" name="username" size="40" value="<?php echo $account['name']; ?>" disabled class="znx-acct-select">
40+ </div>
41+ <div class="znx-settings-field">
42+ <label>Email</label>
43+ <input type="text" name="email" size="40" value="<?php echo $account['email']; ?>" disabled class="znx-acct-select">
44+ </div>
45+ <div class="znx-settings-field">
46+ <label><?= t('helpdesk.subject') ?></label>
47+ <input type="text" name="subject" size="40" class="znx-acct-select">
48+ </div>
49+ <div class="znx-settings-field">
50+ <label>Message</label>
51+ <textarea name="message" rows="7" cols="30" class="znx-editchar-textarea"></textarea>
52+ </div>
53+ <?php
54+ if ($config['use_captcha']) {
55+ ?>
56+ <div class="znx-settings-field">
57+ <div class="g-recaptcha" data-sitekey="<?php echo $config['captcha_site_key']; ?>"></div>
58+ </div>
59+ <?php
60+ }
61+ ?>
62+ <?php
63+ /* Form file */
64+ Token::create();
65+ ?>
66+ <input type="hidden" name="username" value="<?php echo $account['name']; ?>">
67+ <button type="submit" class="znx-acct-btn"><?= t('helpdesk.submit') ?></button>
68+ </form>
69+<?php endif; ?>
70+
71+</div><!-- .znx-acct -->
A layouts/default/views/helpdesk_ticket.php +69-0 View file
@@ -0,0 +1,69 @@
1+<?php
2+?>
3+<div class="znx-acct">
4+
5+<div class="znx-acct-head"><?= t('helpdesk.view_ticket') ?>
6+<?php
7+ echo $ticketData['id'];
8+ if ($ticketData['status'] === 'CLOSED') {
9+ echo '<span style="color:red">[' . t('helpdesk.closed') . ']</span>';
10+ }
11+?></div>
12+<div class="znx-acct-table-wrap">
13+<table class="znx-acct-table">
14+ <tr class="yellow">
15+ <th>
16+ <?php
17+ echo getClock($ticketData['creation'], true);
18+ ?>
19+ - <?= t('helpdesk.created_by') ?>
20+ <?php
21+ echo $ticketData['username'];
22+ ?>
23+ </th>
24+ </tr>
25+ <tr>
26+ <td>
27+ <p><?php echo nl2br($ticketData['message']); ?></p>
28+ </td>
29+ </tr>
30+</table>
31+</div>
32+<?php
33+if ($replies !== false) {
34+ foreach($replies as $reply) {
35+ ?>
36+ <div class="znx-acct-table-wrap">
37+ <table class="znx-acct-table">
38+ <tr class="yellow">
39+ <th>
40+ <?php
41+ echo getClock($reply['created'], true);
42+ ?>
43+ - <?= t('helpdesk.posted_by') ?>
44+ <?php
45+ echo $reply['username'];
46+ ?>
47+ </th>
48+ </tr>
49+ <tr>
50+ <td>
51+ <p><?php echo nl2br($reply['message']); ?></p>
52+ </td>
53+ </tr>
54+ </table>
55+ </div>
56+ <?php
57+ }
58+}
59+?>
60+
61+<?php if ($ticketData['status'] !== 'CLOSED') { ?>
62+ <form action="" method="post" class="znx-editchar-box">
63+ <input type="hidden" name="username" value="<?php echo $ticketData['username']; ?>">
64+ <textarea class="znx-editchar-textarea forumReply" name="reply_text"></textarea>
65+ <button type="submit" class="znx-acct-btn"><?= t('helpdesk.reply') ?></button>
66+ </form>
67+<?php } ?>
68+
69+</div><!-- .znx-acct -->
A layouts/default/views/highscores.php +101-0 View file
@@ -0,0 +1,101 @@
1+<?php
2+
3+if ($vocGroups) {
4+ $vocGroup = (is_array($vocGroups[$vocation])) ? $vocGroups[$vocation] : $vocGroups[$vocGroups[$vocation]];
5+ ?>
6+
7+ <div class="znx-acct">
8+
9+ <div class="znx-acct-head"><?= t('highscores.heading', ['what' => skillName($type) .", ". (($vocation === 'all') ? t('vocation.any_lower') : vocation_id_to_name($vocation))]) ?></div>
10+
11+ <form action="" method="GET" class="znx-acct-toolbar">
12+
13+ <div class="znx-acct-toolbar__field">
14+ <select name="type" class="znx-acct-select">
15+ <option value="7" <?php if ($type == 7) echo "selected"; ?>><?= t('skill.experience') ?></option>
16+ <option value="8" <?php if ($type == 8) echo "selected"; ?>><?= t('skill.magic') ?></option>
17+ <option value="5" <?php if ($type == 5) echo "selected"; ?>><?= t('skill.shield') ?></option>
18+ <option value="2" <?php if ($type == 2) echo "selected"; ?>><?= t('skill.sword') ?></option>
19+ <option value="1" <?php if ($type == 1) echo "selected"; ?>><?= t('skill.club') ?></option>
20+ <option value="3" <?php if ($type == 3) echo "selected"; ?>><?= t('skill.axe') ?></option>
21+ <option value="4" <?php if ($type == 4) echo "selected"; ?>><?= t('skill.distance') ?></option>
22+ <option value="6" <?php if ($type == 6) echo "selected"; ?>><?= t('skill.fishing') ?></option>
23+ <option value="9" <?php if ($type == 9) echo "selected"; ?>><?= t('skill.fist') ?></option>
24+ </select>
25+ </div>
26+
27+ <div class="znx-acct-toolbar__field">
28+ <select name="vocation" class="znx-acct-select">
29+ <option value="all" <?php if (!is_int($vocation)) echo "selected"; ?>><?= t('vocation.any') ?></option>
30+ <?php
31+ foreach ($configVocations as $v_id => $v_data) {
32+ if ($v_data['fromVoc'] === false) {
33+ $selected = (is_int($vocation) && $vocation == $v_id) ? " selected $vocation = $v_id" : "";
34+ echo '<option value="'. $v_id .'"'. $selected .'>'. $v_data['name'] .'</option>';
35+ }
36+ }
37+ ?>
38+ </select>
39+ </div>
40+
41+ <div class="znx-acct-toolbar__field">
42+ <select name="page" class="znx-acct-select">
43+ <?php
44+ $pages = ($vocGroup[$type] !== false) ? ceil(min(($highscore['rows'] / $highscore['rowsPerPage']), (count($vocGroup[$type]) / $highscore['rowsPerPage']))) : 1;
45+ for ($i = 0; $i < $pages; $i++) {
46+ $x = $i + 1;
47+ if ($x == $page) echo "<option value='".$x."' selected>". t('highscores.page', ['n' => $x]) ."</option>";
48+ else echo "<option value='".$x."'>". t('highscores.page', ['n' => $x]) ."</option>";
49+ }
50+ ?>
51+ </select>
52+ </div>
53+
54+ <div class="znx-acct-toolbar__submit"><button type="submit" class="znx-acct-btn"><?= t('common.view') ?></button></div>
55+ </form>
56+
57+ <div class="znx-acct-table-wrap">
58+ <table id="highscoresTable" class="znx-acct-table">
59+
60+ <tr class="yellow">
61+ <?php if ($loadOutfits) echo "<td>". t('common.outfit') ."</td>"; ?>
62+ <td><?= t('common.rank') ?></td>
63+ <td><?= t('common.name') ?></td>
64+ <td><?= t('common.vocation') ?></td>
65+ <td><?= t('common.level') ?></td>
66+ <?php if ($type === 7) echo "<td>". t('common.points') ."</td>"; ?>
67+ </tr>
68+
69+ <?php
70+ if ($vocGroup[$type] === false) {
71+ ?>
72+ <tr>
73+ <td colspan="5"><?= t('common.nothing') ?></td>
74+ </tr>
75+ <?php
76+ } else {
77+ for ($i = 0; $i < count($vocGroup[$type]); $i++) {
78+ if (pageCheck($i, $page, $rowsPerPage)) {
79+ $flag = ($loadFlags === true && strlen($vocGroup[$type][$i]['flag']) > 1) ? '<img src="' . $config['country_flags']['server'] . '/' . $vocGroup[$type][$i]['flag'] . '.png"> ' : '';
80+ ?>
81+ <tr>
82+ <?php if ($loadOutfits): ?>
83+ <td class="outfitColumn"><img src="<?php echo $config['show_outfits']['imageServer']; ?>?id=<?php echo $vocGroup[$type][$i]['type']; ?>&addons=<?php echo $vocGroup[$type][$i]['addons']; ?>&head=<?php echo $vocGroup[$type][$i]['head']; ?>&body=<?php echo $vocGroup[$type][$i]['body']; ?>&legs=<?php echo $vocGroup[$type][$i]['legs']; ?>&feet=<?php echo $vocGroup[$type][$i]['feet']; ?>" alt="img"></td>
84+ <?php endif; ?>
85+ <td><?php echo $i+1; ?></td>
86+ <td><?php echo $flag; ?><a href="characterprofile.php?name=<?php echo $vocGroup[$type][$i]['name']; ?>"><?php echo $vocGroup[$type][$i]['name']; ?></a></td>
87+ <td><?php echo vocation_id_to_name($vocGroup[$type][$i]['vocation']); ?></td>
88+ <td><?php echo $vocGroup[$type][$i]['value']; ?></td>
89+ <?php if ($type === 7) echo "<td>". $vocGroup[$type][$i]['experience'] ."</td>"; ?>
90+ </tr>
91+ <?php
92+ }
93+ }
94+ }
95+ ?>
96+ </table>
97+ </div>
98+
99+ </div><!-- .znx-acct -->
100+ <?php
101+}
A layouts/default/views/index.php +89-0 View file
@@ -0,0 +1,89 @@
1+<?php
2+/**
3+ * Front page.
4+ *
5+ * Prepared by index.php:
6+ * $changelogs changelog ticker entries, or false
7+ * $news news articles, or false
8+ * $page, $view pagination state
9+ */
10+
11+ if ($config['allowSubPages'] && ($f = theme_file('sub/index.php')) !== null) include $f;
12+ else {
13+ if ($config['UseChangelogTicker']) {
14+ theme_include('parts/changelog-ticker.php', array('changelogs' => $changelogs ?? false));
15+ }
16+
17+ // Design and present the list
18+ if ($news) {
19+
20+ $total_news = count($news);
21+ $row_news = $total_news / $config['news_per_page'];
22+ $page_amount = ceil($total_news / $config['news_per_page']);
23+ $current = $config['news_per_page'] * $page;
24+
25+
26+ if ($view !== "") { // We want to view a specific news post
27+ $si = false;
28+ if (ctype_digit($view) === false) {
29+ for ($i = 0; $i < count($news); $i++) if ($view === urlencode($news[$i]['title'])) $si = $i;
30+ } else {
31+ for ($i = 0; $i < count($news); $i++) if ((int)$view === (int)$news[$i]['id']) $si = $i;
32+ }
33+
34+ if ($si !== false) {
35+ ?>
36+ <table id="news">
37+ <tr class="yellow">
38+ <td class="zheadline"><?php echo '<a href="?view='.$news[$si]['id'].'">[#'.$news[$si]['id'].']</a> '. getClock($news[$si]['date'], true) .' '. t('news.by') .' <a href="characterprofile.php?name='. $news[$si]['name'] .'">'. $news[$si]['name'] .'</a> - <b>'. znote_bbcode_raw($news[$si]['title']) .'</b>'; ?></td>
39+ </tr>
40+ <tr>
41+ <td>
42+ <p><?php echo znote_bbcode_raw($news[$si]['text']); ?></p>
43+ </td>
44+ </tr>
45+ </table>
46+ <?php
47+ } else {
48+ ?>
49+ <table id="news">
50+ <tr class="yellow">
51+ <td class="zheadline"><?= t('news.not_found') ?></td>
52+ </tr>
53+ <tr>
54+ <td>
55+ <p><?= t('news.not_found_text') ?></p>
56+ </td>
57+ </tr>
58+ </table>
59+ <?php
60+ }
61+
62+ } else { // We want to view latest news or a page of news.
63+
64+ echo '<div class="znx-section-head">' . h(t_default('news.section_title', 'Latest News')) . '</div>';
65+ for ($i = $current; $i < $current + $config['news_per_page']; $i++) {
66+ if (isset($news[$i])) {
67+ ?>
68+ <table id="news">
69+ <tr class="yellow">
70+ <td class="zheadline"><?php echo '<a href="?view='.urlencode($news[$i]['title']).'">'.getClock($news[$i]['date'], true).'</a> '. t('news.by') .' <a href="characterprofile.php?name='. $news[$i]['name'] .'">'. $news[$i]['name'] .'</a> - <b>'. znote_bbcode_raw($news[$i]['title']) .'</b>'; ?></td>
71+ </tr>
72+ <tr>
73+ <td>
74+ <p><?php echo znote_bbcode_raw($news[$i]['text']); ?></p>
75+ </td>
76+ </tr>
77+ </table>
78+ <?php
79+ }
80+ }
81+
82+ theme_include('parts/pagination.php', array('page' => $page, 'page_amount' => $page_amount, 'baseUrl' => 'index.php'));
83+
84+ }
85+
86+ } else {
87+ echo '<div class="znx-empty-box">'. h(t('news.none')) .'</div>';
88+ }
89+ }
A layouts/default/views/items.php +299-0 View file
@@ -0,0 +1,299 @@
1+<?php
2+/**
3+ * Equipable items browser.
4+ *
5+ * Prepared by items.php: $itemsEnabled and $items. Nothing is loaded here.
6+ */
7+?>
8+<?php if (!$itemsEnabled): ?>
9+
10+ <?= t('items.disabled') ?>
11+
12+<?php else: ?>
13+
14+<?php
15+if ($items) {
16+ // Preparing data
17+ $types = array_keys($items);
18+ $itemImg = static function($id){ return function_exists('znote_item_image_url') ? htmlspecialchars(znote_item_image_url((int)$id, 'gif'), ENT_QUOTES) : ''; };
19+
20+ //slotType values and names
21+ if(isset($_GET['slot'])) {
22+ switch($_GET['slot']) {
23+ case 'helmet':
24+ $slottype = 'head';
25+ $slottype_name = t('items.helmets');
26+ break;
27+ case 'sword':
28+ $slottype = 'sword';
29+ $slottype_name = t('items.swords');
30+ break;
31+ case 'distance':
32+ $slottype = 'distance';
33+ $slottype_name = t('items.distance');
34+ break;
35+ case 'wand':
36+ $slottype = 'wand';
37+ $slottype_name = t('items.wands');
38+ break;
39+ case 'armor':
40+ $slottype = 'body';
41+ $slottype_name = t('items.armors');
42+ break;
43+ case 'club':
44+ $slottype = 'club';
45+ $slottype_name = t('items.clubs');
46+ break;
47+ case 'ammunition':
48+ $slottype = 'ammunition';
49+ $slottype_name = t('items.ammunition');
50+ break;
51+ case 'book':
52+ $slottype = 'shield';
53+ $slottype_name = t('items.spellbooks');
54+ break;
55+ case 'legs':
56+ $slottype = 'legs';
57+ $slottype_name = t('items.legs');
58+ break;
59+ case 'axe':
60+ $slottype = 'axe';
61+ $slottype_name = t('items.axes');
62+ break;
63+ case 'necklace':
64+ $slottype = 'necklace';
65+ $slottype_name = t('items.necklaces');
66+ break;
67+ case 'feet':
68+ $slottype = 'feet';
69+ $slottype_name = t('items.boots');
70+ break;
71+ case 'shield':
72+ $slottype = 'shield';
73+ $slottype_name = t('items.shields');
74+ break;
75+ case 'backpack':
76+ $slottype = 'backpack';
77+ $slottype_name = t('items.backpacks');
78+ break;
79+ case 'ring':
80+ $slottype = 'ring';
81+ $slottype_name = t('items.rings');
82+ break;
83+ default:
84+ $slottype_name = 'null';
85+ break;
86+ }
87+ }
88+
89+ // Render HTML
90+ if(isset($_GET['slot']) && ($slottype_name == 'null')) header("Location:items.php");
91+ ?>
92+
93+ <h1 id="items"><?= t('items.title') ?><?php if (isset($_GET['slot'])) echo ' ('.$slottype_name.')';?></h1>
94+ <?php if(empty($_GET['slot'])) { ?>
95+ <table>
96+ <tbody>
97+ <tr>
98+ <td style="text-align:center;"><a href="?slot=helmet"><?= t('items.helmets') ?><br><img src="<?php echo $itemImg(2471); ?>" /></a></td>
99+ <td style="text-align:center;"><a href="?slot=sword"><?= t('items.swords') ?><br><img src="<?php echo $itemImg(8931); ?>" /></a></td>
100+ <td style="text-align:center;"><a href="?slot=shield"><?= t('items.shields') ?><br><img src="<?php echo $itemImg(2523); ?>" /></a></td>
101+ <td style="text-align:center;"><a href="?slot=necklace"><?= t('items.amulets') ?><br><img src="<?php echo $itemImg(2173); ?>" /></a></td>
102+ </tr>
103+ <tr>
104+ <td style="text-align:center;"><a href="?slot=armor"><?= t('items.armors') ?><br><img src="<?php echo $itemImg(2466); ?>" /></a></td>
105+ <td style="text-align:center;"><a href="?slot=club"><?= t('items.clubs') ?><br><img src="<?php echo $itemImg(2444); ?>" /></a></td>
106+ <td style="text-align:center;"><a href="?slot=wand"><?= t('items.wands') ?><br><img src="<?php echo $itemImg(2190); ?>" /></a></td>
107+ <td style="text-align:center;"><a href="?slot=ammunition"><?= t('items.ammunition') ?><br><img src="<?php echo $itemImg(6529); ?>" /></a></td>
108+ </tr>
109+ <tr>
110+ <td style="text-align:center;"><a href="?slot=legs"><?= t('items.legs') ?><br><img src="<?php echo $itemImg(2470); ?>" /></a></td>
111+ <td style="text-align:center;"><a href="?slot=axe"><?= t('items.axes') ?><br><img src="<?php echo $itemImg(8925); ?>" /></a></td>
112+ <td style="text-align:center;"><a href="?slot=ring"><?= t('items.rings') ?><br><img src="<?php echo $itemImg(6093); ?>" /></a></td>
113+ </tr>
114+ <tr>
115+ <td style="text-align:center;"><a href="?slot=feet"><?= t('items.boots') ?><br><img src="<?php echo $itemImg(2646); ?>" /></a></td>
116+ <td style="text-align:center;"><a href="?slot=distance"><?= t('items.distance') ?><br><img src="<?php echo $itemImg(5803); ?>" /></a></td>
117+ <td style="text-align:center;"><a href="?slot=backpack"><?= t('items.backpacks') ?><br><img src="<?php echo $itemImg(9774); ?>" /></a></td>
118+ </tr>
119+ </tbody>
120+ </table>
121+ <?php } else { ?>
122+ <table>
123+ <tbody>
124+ <tr>
125+ <td></td>
126+ <td><?= t('common.name') ?></td>
127+ <td><?= t('items.attributes') ?></td>
128+ </tr>
129+
130+<?php foreach ($items['item'] as $select) {
131+ $attributes = array();
132+ $extradef = NULL;
133+ $element = NULL;
134+ if (!empty($select['id'])) $itemid = $select['id'];
135+ else $itemid = $select['fromid'];
136+
137+ if (!empty($select['attributes'])) {
138+ foreach ($select['attributes'] as $att => $value) {
139+ if($att == 'slotType' || $att == 'weaponType') $slotType = $value;
140+ if(!empty($slotType) && $slotType == $slottype) $show = true;
141+ else $show = false;
142+ }
143+ }
144+
145+ if($show == true) { ?>
146+ <tr>
147+ <td><img src="<?php echo $itemImg($itemid); ?>" /></td>
148+ <td><?php echo ucwords($select['name']); ?></td>
149+ <td><?php
150+ foreach ($select['attributes'] as $array => $value) {
151+
152+ $extra = NULL;
153+ if($value > 0) $extra = '+';
154+ switch ($array) {
155+ case 'weight':
156+ echo ucwords($array).': '.intval($value/100).'.'.substr($value, -2).' oz<br>';
157+ break;
158+ case 'containerSize':
159+ echo t('items.attr_slots') .': '.$value.'<br>';
160+ break;
161+ case 'armor':
162+ echo ucwords($array).': '.$value.'<br>';
163+ break;
164+ case 'attack':
165+ echo ucwords($array).': '.$value;
166+ if($element != NULL) echo ' ('.$element.')';
167+ echo '<br>';
168+ break;
169+ case 'defense':
170+ echo ucwords($array).': '.$value;
171+ if($extradef != NULL) echo ' ('.$extradef.')';
172+ echo '<br>';
173+ break;
174+ case 'skillFist':
175+ echo t('items.fight_fist') .': '.$extra.$value.'<br>';
176+ break;
177+ case 'skillAxe':
178+ echo t('items.fight_axe') .': '.$extra.$value.'<br>';
179+ break;
180+ case 'skillSword':
181+ echo t('items.fight_sword') .': '.$extra.$value.'<br>';
182+ break;
183+ case 'skillClub':
184+ echo t('items.fight_club') .': '.$extra.$value.'<br>';
185+ break;
186+ case 'skillAxe':
187+ echo t('items.fight_axe') .': '.$extra.$value.'<br>';
188+ break;
189+ case 'skillDist':
190+ echo t('items.fight_dist') .': '.$extra.$value.'<br>';
191+ break;
192+ case 'skillShield':
193+ echo t('items.fight_shield') .': '.$extra.$value.'<br>';
194+ break;
195+ case 'range':
196+ echo ucwords($array).': '.$value.'<br>';
197+ break;
198+ case 'shootType':
199+ echo t('items.attr_shoot') .': '.ucwords($value).'<br>';
200+ break;
201+ case 'hitChance':
202+ echo t('items.attr_hit') .': '.$extra.$value.'%<br>';
203+ break;
204+ case 'magiclevelpoints':
205+ echo t('items.attr_magic') .': '.$extra.$value.'<br>';
206+ break;
207+ case 'absorbPercentEnergy':
208+ echo t('items.prot_energy') .': '.$extra.$value.'%<br>';
209+ break;
210+ case 'absorbPercentFire':
211+ echo t('items.prot_fire') .': '.$extra.$value.'%<br>';
212+ break;
213+ case 'absorbPercentEarth':
214+ echo t('items.prot_earth') .': '.$extra.$value.'%<br>';
215+ break;
216+ case 'absorbPercentPoison':
217+ echo t('items.prot_poison') .': '.$extra.$value.'%<br>';
218+ break;
219+ case 'absorbPercentIce':
220+ echo t('items.prot_ice') .': '.$extra.$value.'%<br>';
221+ break;
222+ case 'absorbPercentHoly':
223+ echo t('items.prot_holy') .': '.$extra.$value.'%<br>';
224+ break;
225+ case 'absorbPercentDeath':
226+ echo t('items.prot_death') .': '.$extra.$value.'%<br>';
227+ break;
228+ case 'absorbPercentLifeDrain':
229+ echo t('items.prot_lifedrain') .': '.$extra.$value.'%<br>';
230+ break;
231+ case 'absorbPercentManaDrain':
232+ echo t('items.prot_manadrain') .': '.$extra.$value.'%<br>';
233+ break;
234+ case 'absorbPercentDrown':
235+ echo t('items.prot_drown') .': '.$extra.$value.'%<br>';
236+ break;
237+ case 'absorbPercentPhysical':
238+ echo t('items.prot_physical') .': '.$extra.$value.'%<br>';
239+ break;
240+ case 'absorbPercentIce':
241+ echo t('items.prot_ice') .': '.$extra.$value.'%<br>';
242+ break;
243+ /**case 'suppressDrunk':
244+ echo t('items.sup_drunk') .': '. t('common.yes') .'<br>';
245+ break;
246+ case 'suppressEnergy':
247+ echo t('items.sup_energy') .': '. t('common.yes') .'<br>';
248+ break;
249+ case 'suppressFire':
250+ echo t('items.sup_fire') .': '. t('common.yes') .'<br>';
251+ break;
252+ case 'suppressPoison':
253+ echo t('items.sup_poison') .': '. t('common.yes') .'<br>';
254+ break;
255+ case 'suppressDrown':
256+ echo t('items.sup_drown') .': '. t('common.yes') .'<br>';
257+ break;
258+ case 'suppressPhysical':
259+ echo t('items.sup_bleeding') .': '. t('common.yes') .'<br>';
260+ break;
261+ case 'suppressFreeze':
262+ echo t('items.sup_freeze') .': '. t('common.yes') .'<br>';
263+ break;
264+ case 'suppressDazzle':
265+ echo t('items.sup_dazzle') .': '. t('common.yes') .'<br>';
266+ break;
267+ case 'suppressCurse':
268+ echo t('items.sup_curse') .': '. t('common.yes') .'<br>';
269+ break;
270+ Those are not necessary in my opinion, but if you want to show
271+ **/
272+ case 'speed':
273+ echo t('items.attr_speed') .': '.$extra.($value/2).'<br>';
274+ break;
275+ case 'charges':
276+ echo t('items.attr_charges') .': '.$value.'<br>';
277+ break;
278+ }
279+ }
280+ ?>
281+ </td>
282+ </tr>
283+
284+
285+<?php
286+ }
287+ } ?>
288+
289+ </tbody>
290+ </table>
291+
292+ <?php
293+ }
294+} else { ?>
295+ <h1><?= t('items.title') ?></h1>
296+ <p><?= t('items.not_loaded') ?></p>
297+<?php }
298+?>
299+<?php endif; ?>
Top