source: aowow/index.php

Last change on this file was 364, checked in by maron, 15 years ago
  • Opraveno: Exportování lua souborů. * Opraveno: Zobrazování hlavní stránky AoWoW.
  • Property svn:executable set to *
File size: 3.0 KB
Line 
1<?php
2// Настройка шаблонизатора и ДБ
3include('includes/kernel.php');
4
5// Объект шаблонизатора
6$smarty = new Smarty_AoWoW('wowhead');
7
8// Имя пользователя и пасс
9session_start();
10
11if (IsSet($_COOKIE['remember_me']) and !(IsSet($_SESSION['username'])))
12{
13 $_SESSION['username'] = substr($_COOKIE['remember_me'], 0, strlen($_COOKIE['remember_me'])-40);
14 $_SESSION['shapass'] = substr($_COOKIE['remember_me'], strlen($_COOKIE['remember_me'])-40, 40);
15}
16
17if (IsSet($_SESSION['username']) and IsSet($_SESSION['shapass']))
18{
19 $user = array();
20 $user = CheckPwd($_SESSION['username'], $_SESSION['shapass']);
21 $_SESSION['userid'] = $user['id'];
22 $_SESSION['roles'] = $user['roles'];
23 if ($user>0)
24 $smarty->assign('user', $user);
25 else
26 UnSet($user);
27}
28
29// Язык сайта
30if(!isset($_SESSION['locale']) || !in_array($_SESSION['locale'], array(0, 8)))
31 $_SESSION['locale'] = $AoWoWconf['locale'];
32
33$smarty->assign('locale', $_SESSION['locale']);
34$smarty->assign('language', $languages[$smarty->get_template_vars('locale')]);
35
36// Параметры передаваемые скрипту
37$queryx = $_SERVER['QUERY_STRING'];
38@list($razdel, $podrazdel) = explode('=', $_SERVER['QUERY_STRING'], 2);
39
40// Язык, настройки
41$conf_file = $smarty->get_template_vars('language').'.conf';
42$smarty->assign('conf_file', $conf_file);
43$smarty->assign('query', $_SERVER['QUERY_STRING']);
44
45// Параметры страницы
46global $page;
47$page = array(
48 'Mapper' => false,
49 'Book' => false,
50 'Title' => '',
51 'tab' => 0,
52 'type' => 0,
53 'typeid' => 0,
54 'path' => '[]'
55);
56
57
58// В зависимости от раздела, выбираем что открывать:
59switch($razdel)
60{
61 case 'locale':
62 // Изменение языка сайта
63 if(in_array($podrazdel, array(0, 8)))
64 $_SESSION['locale'] = $podrazdel;
65 header('Location: '.$_SERVER["HTTP_REFERER"]);
66 break;
67 case 'account':
68 include 'account.php';
69 break;
70 case 'admin':
71 if($_SESSION['roles'] == 2)
72 include 'admin.php';
73 else
74 include 'main.php';
75 break;
76 case 'comment':
77 include 'comment.php';
78 break;
79 case 'faction':
80 include 'faction.php';
81 break;
82 case 'factions':
83 include 'factions.php';
84 break;
85 case 'item':
86 include 'item.php';
87 break;
88 case 'items':
89 include 'items.php';
90 break;
91 case 'itemset':
92 include 'itemset.php';
93 break;
94 case 'itemsets':
95 include 'itemsets.php';
96 break;
97 case 'latest':
98 include 'latest.php';
99 break;
100 case 'maps':
101 include 'maps.php';
102 break;
103 case 'npc':
104 include 'npc.php';
105 break;
106 case 'npcs':
107 include 'npcs.php';
108 break;
109 case 'object':
110 include 'object.php';
111 break;
112 case 'objects':
113 include 'objects.php';
114 break;
115 case 'quest':
116 include 'quest.php';
117 break;
118 case 'quests':
119 include 'quests.php';
120 break;
121 case 'search':
122 include 'search.php';
123 break;
124 case 'spell':
125 include 'spell.php';
126 break;
127 case 'spells':
128 include 'spells.php';
129 break;
130 default:
131 include 'main.php';
132 break;
133}
134die('');
135?>
Note: See TracBrowser for help on using the repository browser.