-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
executable file
·179 lines (151 loc) · 4.32 KB
/
index.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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
<?php
/// KioCMS 1.0.0 - Kiofol Content Managment System
/// Copyright © 2008 by Kiofol Software
/// License: GNU General Public License
/// Author: Rafał "Endzio" Enden
/// index.php
define('KioCMS', true);
//define('Admin', true);
//define('INDEX', true);
ob_start('ob_gzhandler');
header('Content-Type: text/html; charset=UTF-8');
header('Expires: Thu, 21 Jul 1977 07:30:00 GMT');
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header('Cache-Control: store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: public');
require_once './init.php';
ob_start();
$kio->left = $kio->right = true;
// $module = $block = new stdClass();
// Check for contents to display (int) or to include (string)
$s = ctype_digit(u0) ? (int)u0 : (int)Kio::getConfig('front_page');
// Static page
if ($s)
{
try
{
if (!Module::exists('subpage'))
{
throw new Exception(t('Module dosn't exists'));
}
require_once ROOT.'modules/subpage/subpage.module.php';
$module = new Subpage($s);
echo $module->getContent();
define('MODULE', 'subpage-'.$s);
}
catch (Exception $e)
{
define('MODULE', 'error');
echo $e->getMessage();
}
}
else if (u0)
{
switch (u0)
{
// Administration
case 'admin':
include_once ROOT.'admin/index.php';
if (!$module->name)
{
$module->name = end($kio->title);
}
define('MODULE', 'admin');
break;
// Logout
case 'logout':
define('MODULE', 'logout');
User::logout();
break;
// Redirect to external page
case 'redirect':
define('MODULE', 'redirect');
ctype_digit(u1) && ($row = sql_fetch_assoc(sql_query('SELECT url FROM '.DB_PREFIX.'redirect WHERE id = '.u1))) ? sql_query('UPDATE '.DB_PREFIX.'redirect SET clicks = clicks + 1 WHERE id = '.u1).
redirect($row['url']) : redirect(LOCAL);
break;
// Load block as module
case 'blocks':
try
{
// Load block
if (!Block::exists(u1))
{
throw new Exception(t('Block dosn't exists'));
}
require_once ROOT.'blocks/'.u1.'/'.u1.'.block.php';
$codename = u1;
$module = new $codename(Block::getBlockData(u1), true);
Kio::addTitle($module->name);
Kio::addBreadcrumb($module->name, 'blocks/'.u1);
echo $module->getContent();
define('MODULE', u1);
}
// Block doesn't exist
catch (Exception $e)
{
define('MODULE', 'error_404-module');
echo $e->getMessage().'<br/><br/>In file <strong>'.$e->getFile().'</strong> ar line '.$e->getLine().'';
// define('MODULE', 'error_404-block');
// not_found(sprintf('Blok <strong>%s</strong> nie istnieje.', u1), array(
// 'Blok obsługujący nie jest zainstalowany',
// $lang_system['FIRST_404_COUSE'],
// $lang_system['SECOND_404_COUSE']));
}
break;
// Module
default:
try
{
if (!Module::exists(u0))
{
throw new Exception(t('Module dosn't exists'));
}
require_once ROOT.'modules/'.u0.'/'.u0.'.module.php';
$codename = u0;
$module = new $codename();
echo $module->getContent();
define('MODULE', u0);
}
catch (Exception $e)
{
define('MODULE', 'error_404-module');
echo $e->getMessage().'<br/><br/>In file <strong>'.$e->getFile().'</strong> ar line '.$e->getLine().'';
// not_found(t('Podstrona <strong>%page</strong> nie istnieje.', array('%page' => u0)), array(
// 'Moduł obsługujący nie jest zainstalowany.',
// 'FIRST_404_COUSE',
// 'SECOND_404_COUSE'));
}
}
}
// Load front page module
else
{
try
{
$codename = Kio::getConfig('front_page');
if (!Module::exists($codename))
{
throw new Exception(t('Module dosn't exists'));
}
require_once ROOT.'modules/'.$codename.'/'.$codename.'.module.php';
$module = new $codename();
echo $module->getContent();
define('MODULE', $codename);
}
catch (Exception $e)
{
define('MODULE', 'error_404-module');
echo $e->getMessage().'<br/>'.$e->getFile().':'.$e->getLine();
}
//if (!$module->name) $module->name = end($kio->path);
}
if (!$module->name)
{
$module->name = Kio::getModuleName();
}
$module->content = ob_get_contents();
ob_end_clean();
//$kio->blocks_disabled = ${MODULE}['blocks'] ? ${MODULE}['blocks'] : $cfg->system['blocks'];
require_once ROOT.'themes/'.THEME.'/'.THEME.'.theme.php';
unset($config, $system, $kio, $user, $form, $lang, $lang_system, $module, $stats, $permit, $groups, $sql);