From 1b539f82ac5e50d8e7731599c5469ec6fbe9784b Mon Sep 17 00:00:00 2001
From: Lee <42119604+Leesneaks@users.noreply.github.com>
Date: Wed, 12 Dec 2018 19:44:29 +0000
Subject: [PATCH] Updates (#65)
* Updates
+Added missing images
+Added report viewer as requested by icekis
-Code cleanup
if strict db, need to set spell to null run
ALTER TABLE `myaac_spells` CHANGE `spell` `spell` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL;
---
admin/template/template.php | 13 +-
system/libs/spells.php | 22 ++-
system/pages/admin/logs.php | 131 +++++++------
system/pages/admin/reports.php | 91 +++++++++
system/pages/spells.php | 9 +-
system/templates/admin.pages.html.twig | 88 ++++-----
system/templates/admin.plugins.html.twig | 83 ++++-----
system/templates/admin.visitors.html.twig | 66 +++----
system/templates/spells.html.twig | 213 +++++++++++++++++-----
tools/images/sort_asc.png | Bin 0 -> 160 bytes
tools/images/sort_asc_disabled.png | Bin 0 -> 148 bytes
tools/images/sort_both.png | Bin 0 -> 201 bytes
tools/images/sort_desc.png | Bin 0 -> 158 bytes
tools/images/sort_desc_disabled.png | Bin 0 -> 146 bytes
14 files changed, 456 insertions(+), 260 deletions(-)
create mode 100644 system/pages/admin/reports.php
create mode 100644 tools/images/sort_asc.png
create mode 100644 tools/images/sort_asc_disabled.png
create mode 100644 tools/images/sort_both.png
create mode 100644 tools/images/sort_desc.png
create mode 100644 tools/images/sort_desc_disabled.png
diff --git a/admin/template/template.php b/admin/template/template.php
index b728b231..f85b619e 100644
--- a/admin/template/template.php
+++ b/admin/template/template.php
@@ -56,7 +56,7 @@
'book', 'list',
'plug', 'user',
'edit', 'gavel',
- 'book', 'edit', 'book',
+ 'wrench', 'edit', 'book', 'book',
);
$menus = array(
@@ -72,10 +72,17 @@
),
'Items' => 'items',
'Tools' => array(
+ 'Notepad' => 'notepad',
'phpinfo' => 'phpinfo',
),
- 'Notepad' => 'notepad',
- 'Logs' => 'logs'
+ 'Editor' => array(
+ 'Accounts' => 'accounts',
+ 'Players' => 'players',
+ ),
+ 'Logs' => array(
+ 'Logs' => 'logs',
+ 'Reports' => 'reports',
+ ),
);
$i = 0;
diff --git a/system/libs/spells.php b/system/libs/spells.php
index 113ab92f..546d85bf 100644
--- a/system/libs/spells.php
+++ b/system/libs/spells.php
@@ -14,7 +14,23 @@ class Spells {
private static $spellsList = null;
private static $lastError = '';
- public static function loadFromXML($show = false) {
+ // 1 - attack, 2 - healing, 3 - summon, 4 - supply, 5 - support
+ public static function loadGroup($tGroup) {
+ switch ($tGroup) {
+ case "attack":
+ return 1;
+ case "healing":
+ return 2;
+ case "summon":
+ return 3;
+ case "supply":
+ return 4;
+ case "support":
+ return 5;
+ }
+ }
+
+ public static function loadFromXML($show = false) {
global $config, $db;
try { $db->query('DELETE FROM `' . TABLE_PREFIX . 'spells`;'); } catch(PDOException $error) {}
@@ -58,6 +74,8 @@ class Spells {
'premium' => $spell->isPremium() ? 1 : 0,
'vocations' => json_encode($spell->getVocations()),
'conjure_count' => $spell->getConjureCount(),
+ 'conjure_id' => $spell->getConjureId(),
+ 'reagent' => $spell->getReagentId(),
'hidden' => $spell->isEnabled() ? 0 : 1
));
@@ -121,7 +139,7 @@ class Spells {
foreach($runeslist as $spellname) {
$spell = self::$spellsList->getRune($spellname);
- $name = $spell->getName() . ' (rune)';
+ $name = $spell->getName() . ' Rune';
try {
$db->insert(TABLE_PREFIX . 'spells', array(
diff --git a/system/pages/admin/logs.php b/system/pages/admin/logs.php
index 0fea9301..a927fba6 100644
--- a/system/pages/admin/logs.php
+++ b/system/pages/admin/logs.php
@@ -16,77 +16,68 @@ $title = 'Logs viewer';
Logs:
-
@@ -119,6 +110,6 @@ if (!empty($file)) {
?>
\ No newline at end of file
diff --git a/system/pages/admin/reports.php b/system/pages/admin/reports.php
new file mode 100644
index 00000000..5a951aec
--- /dev/null
+++ b/system/pages/admin/reports.php
@@ -0,0 +1,91 @@
+
+
+
+
+
+
+
+
+
+
+ Report name
+ Last updated
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
';
+ echo nl2br(file_get_contents($server_path_reports . $file));
+ echo '
';
+ } else
+ echo 'Specified file does not exist.';
+ } else
+ echo 'Invalid file name specified.';
+}
+?>
+
\ No newline at end of file
diff --git a/system/pages/spells.php b/system/pages/spells.php
index fb311ffd..4699143c 100644
--- a/system/pages/spells.php
+++ b/system/pages/spells.php
@@ -41,8 +41,9 @@ else {
}
}
+$order = 'name';
$spells = array();
-$spells_db = $db->query('SELECT * FROM `' . TABLE_PREFIX . 'spells` WHERE `hidden` != 1 AND `type` < 3 ORDER BY name, level');
+$spells_db = $db->query('SELECT * FROM `' . TABLE_PREFIX . 'spells` WHERE `hidden` != 1 AND `type` < 4 AND `level` > 0 ORDER BY ' . $order . '');
if((string)$vocation_id != 'all') {
foreach($spells_db->fetchAll() as $spell) {
@@ -77,12 +78,16 @@ $twig->display('spells.html.twig', array(
'post_vocation_id' => $vocation_id,
'post_vocation' => $vocation,
'spells' => $spells,
+ 'item_path' => $config['item_images_url'],
));
?>
diff --git a/system/templates/admin.pages.html.twig b/system/templates/admin.pages.html.twig
index a0f80fd3..096d43d5 100644
--- a/system/templates/admin.pages.html.twig
+++ b/system/templates/admin.pages.html.twig
@@ -6,58 +6,44 @@
-
diff --git a/system/templates/admin.plugins.html.twig b/system/templates/admin.plugins.html.twig
index bcd639c1..4b854f70 100644
--- a/system/templates/admin.plugins.html.twig
+++ b/system/templates/admin.plugins.html.twig
@@ -5,55 +5,40 @@
Installed plugins:
\ No newline at end of file
diff --git a/system/templates/admin.visitors.html.twig b/system/templates/admin.visitors.html.twig
index 55475f84..1b3c25b9 100644
--- a/system/templates/admin.visitors.html.twig
+++ b/system/templates/admin.visitors.html.twig
@@ -3,54 +3,36 @@
Users active within last {{ config_visitors_counter_ttl }} minutes.
\ No newline at end of file
diff --git a/system/templates/spells.html.twig b/system/templates/spells.html.twig
index 3e9e4fcc..1c76e8f7 100644
--- a/system/templates/spells.html.twig
+++ b/system/templates/spells.html.twig
@@ -1,9 +1,42 @@
+
{% if canEdit %}
-
+
{% endif %}
-
- Name Words Type (count)
- Mana Level Magic Level Soul Premium Vocations
-
- {% set i = 0 %}
- {% for spell in spells %}
- {% set i = i + 1 %}
-
- {{ spell.name }}
- {{ spell.words }}
-
- {% if spell.type == 1 %}
- Instant
- {% elseif spell.type == 2 %}
- Conjure ({{ spell.conjure_count }})
- {% else %}
- Rune
- {% endif %}
-
- {{ spell.mana }}
- {{ spell.level }}
- {{ spell.maglevel }}
- {{ spell.soul }}
- {% if spell.premium == 1 %}yes{% else %}no{% endif %}
-
- {% if spell.vocations|length > 0 %}
-
- {{ spell.vocations|raw }}
-
- {% else %}
- {{ config.vocations[post_vocation_id] }}
- {% endif %}
-
-
- {% endfor %}
-
\ No newline at end of file
+
+
+
+
Instant
+
+
+
Conjure
+
+
+
Rune
+
+
+
+
+
+ Name
+ Words
+ Level
+ Mana
+ Vocations
+
+
+ {% set i = 0 %}
+ {% set y = 0 %}
+ {% for spell in spells %}
+ {% set i = i + 1 %}
+ {% if spell.type == 1 %}
+ {% set y = y + 1 %}
+
+ {{ spell.name }}
+ {{ spell.words }}
+ {{ spell.level }}
+ {{ spell.mana }}
+
+ {% if spell.vocations|length > 0 %}
+ {{ spell.vocations|raw }}
+ {% else %}
+ {{ config.vocations[post_vocation_id] }}
+ {% endif %}
+
+
+ {% endif %}
+ {% endfor %}
+
+
+
+
+
+
+ Name
+ Words
+ Level
+ Mana
+ Soul
+ Item
+ Reagent
+ Vocations
+
+
+ {% set i = 0 %}
+ {% set y = 0 %}
+ {% for spell in spells %}
+ {% set i = i + 1 %}
+ {% if spell.type == 2 %}
+ {% set y = y + 1 %}
+
+ {{ spell.name }}
+ {{ spell.words }}
+ {{ spell.level }}
+ {{ spell.mana }}
+ {{ spell.soul }}
+
+
+ {% if (spell.conjure_count < 150) and ( spell.conjure_count > 0) %} {{ spell.conjure_count }}x
+ {% endif %}
+
+ {% if (spell.reagent > 0) %}
+ {% else %}---{% endif %}
+
+ {% if spell.vocations|length > 0 %}
+ {{ spell.vocations|raw }}
+ {% else %}
+ {{ config.vocations[post_vocation_id] }}
+ {% endif %}
+
+
+ {% endif %}
+ {% endfor %}
+
+
+
+
+
+
+
+ Name
+ Level
+ Magic Level
+ Item
+ Vocations
+
+
+ {% set i = 0 %}
+ {% set y = 0 %}
+ {% for spell in spells %}
+ {% set i = i + 1 %}
+ {% if spell.type == 3 %}
+ {% set y = y + 1 %}
+
+ {{ spell.name }}
+ {{ spell.level }}
+ {{ spell.maglevel }}
+
+
+ {% if spell.vocations|length > 0 %}
+ {{ spell.vocations|raw }}
+ {% else %}
+ {{ config.vocations[post_vocation_id] }}
+ {% endif %}
+
+
+ {% endif %}
+ {% endfor %}
+
+
+
+
+
\ No newline at end of file
diff --git a/tools/images/sort_asc.png b/tools/images/sort_asc.png
new file mode 100644
index 0000000000000000000000000000000000000000..e1ba61a8055fcb18273f2468d335572204667b1f
GIT binary patch
literal 160
zcmeAS@N?(olHy`uVBq!ia0vp^!XV7S1|*9D%+3I*bWaz@5R22v2@;zYta_*?F5u6Q
zWR@in#&u+WgT?Hi<}D3B3}GOXuX|8Oj3tosHiJ3*4TN
zC7>_x-r1O=t(?KoTC+`+>7&2GzdqLHBg&F)2Q?&EGZ+}|Rpsc~9`m>jw35No)z4*}
HQ$iB}HK{Sd
literal 0
HcmV?d00001
diff --git a/tools/images/sort_asc_disabled.png b/tools/images/sort_asc_disabled.png
new file mode 100644
index 0000000000000000000000000000000000000000..fb11dfe24a6c564cb7ddf8bc96703ebb121df1e7
GIT binary patch
literal 148
zcmeAS@N?(olHy`uVBq!ia0vp^!XV7S0wixl{&NRX(Vi}jAsXkC6BcOhI9!^3NY?Do
zDX;f`c1`y6n0RgO@$!H7chZT&|Jn0dmaqO^XNm-CGtk!Ur<_=Jws3;%W$<+Mb6Mw<&;$T1GdZXL
literal 0
HcmV?d00001
diff --git a/tools/images/sort_both.png b/tools/images/sort_both.png
new file mode 100644
index 0000000000000000000000000000000000000000..af5bc7c5a10b9d6d57cb641aeec752428a07f0ca
GIT binary patch
literal 201
zcmeAS@N?(olHy`uVBq!ia0vp^!XV7S0wixl{&NRX6FglULp08Bycxyy87-Q;~nRxO8@-UU*I^KVWyN+&SiMHu5xDOu|HNvwzODfTdXjhVyNu1
z#7^XbGKZ7LW3XeONb$RKLeE*WhqbYpIXPIqK@r4)v+qN8um%99%MPpS9d#7Ed7SL@Bp00i_>zopr0H-Zb
Aj{pDw
literal 0
HcmV?d00001
diff --git a/tools/images/sort_desc.png b/tools/images/sort_desc.png
new file mode 100644
index 0000000000000000000000000000000000000000..0e156deb5f61d18f9e2ec5da4f6a8c94a5b4fb41
GIT binary patch
literal 158
zcmeAS@N?(olHy`uVBq!ia0vp^!XV7S1|*9D%+3I*R8JSj5R22v2@yo
z(czD9$NuDl3Ljm9c#_#4$vXUz=f1~&WY3aa=h!;z7fOEN>ySP9QA=6C-^Dmb&tuM=
z4Z&=WZU;2WF>e%GI&mWJk^K!jrbro{W;-I>FeCfLGJl3}+Z^2)3Kw?+EoAU?^>bP0
Hl+XkKC^j|Q{b@g3TV7E(Grjn^aLC2o)_ptHrtUEoT$S@q)~)7U@V;W{6)!%@
u>N?4t-1qslpJw9!O?PJ&w0Cby