forked from MarkusNemesis/VanillaWoWDB2
-
Notifications
You must be signed in to change notification settings - Fork 1
/
ajax.php
76 lines (70 loc) · 2.19 KB
/
ajax.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
<?php
header('Content-type: application/x-javascript');
require_once('configs/config.php');
require_once('includes/allutil.php');
// Для Ajax отключаем debug
$AoWoWconf['debug'] = false;
// Для Ajax ненужен реалм
$AoWoWconf['realmd'] = false;
// Настройка БД
require_once('includes/db.php');
// Параметры передаваемые скрипту
@list($what, $id) = explode("=", $_SERVER['QUERY_STRING']);
$id = intval($id);
$x = '';
switch($what)
{
case 'item':
if(!$item = load_cache(6, $id))
{
require_once('includes/allitems.php');
$item = allitemsinfo($id, 1);
save_cache(6, $id, $item);
}
$x .= '$WowheadPower.registerItem('.$id.', '.$_SESSION['locale'].', {';
if ($item['name'])
$x .= 'name: \''.ajax_str_normalize($item['name']).'\',';
if ($item['quality'])
$x .= 'quality: '.$item['quality'].',';
if ($item['icon'])
$x .= 'icon: \''.ajax_str_normalize($item['icon']).'\',';
if ($item['info'])
$x .= 'tooltip_'.$locales[$_SESSION['locale']].': \''.ajax_str_normalize($item['info']).'\'';
$x .= '});';
break;
case 'spell':
if(!$spell = load_cache(14, $id))
{
require_once('includes/allspells.php');
$spell = allspellsinfo($id, 1);
save_cache(14, $id, $spell);
}
$x .= '$WowheadPower.registerSpell('.$id.', '.$_SESSION['locale'].',{';
if ($spell['name'])
$x .= 'name: \''.ajax_str_normalize($spell['name']).'\',';
if ($spell['icon'])
$x .= 'icon: \''.ajax_str_normalize($spell['icon']).'\',';
if ($spell['info'])
$x .= 'tooltip_'.$locales[$_SESSION['locale']].': \''.ajax_str_normalize($spell['info']).'\'';
$x .= '});';
break;
case 'quest':
if(!$quest = load_cache(11, $id))
{
require_once('includes/allquests.php');
$quest = GetDBQuestInfo($id, QUEST_DATAFLAG_AJAXTOOLTIP);
$quest['tooltip'] = GetQuestTooltip($quest);
save_cache(11, $id, $quest);
}
$x .= '$WowheadPower.registerQuest('.$id.', '.$_SESSION['locale'].',{';
if($quest['name'])
$x .= 'name: \''.ajax_str_normalize($quest['name']).'\',';
if($quest['tooltip'])
$x .= 'tooltip_'.$locales[$_SESSION['locale']].': \''.ajax_str_normalize($quest['tooltip']).'\'';
$x .= '});';
break;
default:
break;
}
echo $x;
?>