-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathfindspell.php
More file actions
80 lines (58 loc) · 1.29 KB
/
findspell.php
File metadata and controls
80 lines (58 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<?php
ini_set('memory_limit', '1024M');
$pagetitle = 'Spell Search (beta)';
if (isset($_GET['spellid']))
{
$checkcsrf = true;
}
$NEEDPUB = true;
require 'common.php';
$_GET['spellid'] = preg_replace("/[^0-9]/", "", $_GET['spellid'] );
if (!$GM)
{
$tpl->message = 'You must be a Game Master to view this page.';
$tpl->Execute(null);
exit;
}
if (isset($_GET['spellid']))
{
$_GET['spellid'] = (int)$_GET['spellid'];
$allcharacters = webcp_db_fetchall("SELECT name, account, spells FROM characters");
foreach ($allcharacters as &$character)
{
$character['spells'] = unserialize_spells($character['spells']);
}
unset($character);
$characters = array();
foreach ($allcharacters as $character)
{
$spells = $character['spells'];
foreach ($spells as $spell)
{
if ($spell['id'] == $_GET['spellid'])
{
$character['found_spell'] = '<b>' . $spell['name'] . '</b>';
$character['found'] = 1;
break;
}
}
$characters[] = $character;
}
$tpl->characters = $characters;
$tpl->Execute('findspell_results');
}
else
{
$i = 1;
$spell = $eoserv_spells->Get($i);
while ($spell->id)
{
$spells[] = array(
'name' => $spell->name,
'id' => $spell->id
);
$spell = $eoserv_spells->Get(++$i);
}
$tpl->spells = $spells;
$tpl->Execute('findspell');
}