-
Notifications
You must be signed in to change notification settings - Fork 18
/
bots.php
120 lines (96 loc) · 3.72 KB
/
bots.php
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<?php
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Portions of this program are derived from publicly licensed software
* projects including, but not limited to phpBB, Magelo Clone,
* EQEmulator, EQEditor, and Allakhazam Clone.
*
* Author:
* Maudigan(Airwalking)
*
* April 16, 2020 - Maudigan
* Initial Revision
* April 25, 2020 - Maudigan
* implement multi-tenancy
*
***************************************************************************/
/*********************************************
INCLUDES
*********************************************/
//define this as an entry point to unlock includes
if ( !defined('INCHARBROWSER') )
{
define('INCHARBROWSER', true);
}
include_once(__DIR__ . "/include/common.php");
include_once(__DIR__ . "/include/profile.php");
include_once(__DIR__ . "/include/db.php");
/*********************************************
SETUP CHARACTER CLASS & PERMISSIONS
*********************************************/
$charName = preg_Get_Post('char', '/^[a-zA-Z]+$/', false, $language['MESSAGE_ERROR'],$language['MESSAGE_NO_CHAR'], true);
//character initializations
$char = new Charbrowser_Character($charName, $showsoftdelete, $charbrowser_is_admin_page); //the Charbrowser_Character class will sanitize the character name
$charID = $char->char_id();
$name = $char->GetValue('name');
//block view if user level doesnt have permission
if ($char->Permission('bots')) $cb_error->message_die($language['MESSAGE_NOTICE'],$language['MESSAGE_ITEM_NO_VIEW']);
/*********************************************
GATHER RELEVANT PAGE DATA
*********************************************/
//get factions from the db
$tpl = <<<TPL
SELECT name, race, gender,
class, face, level
FROM bot_data
WHERE owner_id = %d
ORDER BY name ASC
TPL;
$query = sprintf($tpl, $charID);
$result = $cbsql->query($query);
if (!$cbsql->rows($result)) $cb_error->message_die($language['BOTS_BOTS']." - ".$name,$language['MESSAGE_NO_BOTS']);
$bots = $cbsql->fetch_all($result);
/*********************************************
DROP HEADER
*********************************************/
$d_title = " - ".$name.$language['PAGE_TITLES_BOTS'];
include(__DIR__ . "/include/header.php");
/*********************************************
DROP PROFILE MENU
*********************************************/
output_profile_menu($name, 'bots');
/*********************************************
POPULATE BODY
*********************************************/
$cb_template->set_filenames(array(
'bots' => 'bots_body.tpl')
);
$cb_template->assign_both_vars(array(
'NAME' => $name)
);
$cb_template->assign_vars(array(
'ROOT_URL' => $charbrowser_root_url,
'L_BOTS' => $language['BOTS_BOTS'],
'L_DONE' => $language['BUTTON_DONE'])
);
foreach($bots as $bot) {
$cb_template->assign_both_block_vars("bots", array(
'NAME' => $bot['name'],
'AVATAR_IMG' => getAvatarImage($bot['race'], $bot['gender'], $bot['face']),
'RACE' => $dbracenames[$bot['race']],
'CLASS' => $dbclassnames[$bot['class']],
'LEVEL' => $bot['level'])
);
}
/*********************************************
OUTPUT BODY AND FOOTER
*********************************************/
$cb_template->pparse('bots');
$cb_template->destroy();
include(__DIR__ . "/include/footer.php");
?>