-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathindex.php
More file actions
373 lines (322 loc) · 9.67 KB
/
index.php
File metadata and controls
373 lines (322 loc) · 9.67 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
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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
<?php
/**
*
* @package MX-Publisher Core
* @version $Id: index.php,v 1.91 2024/04/02 06:19:17 orynider Exp $
* @copyright (c) 2002-2008 MX-Publisher Project Team
* @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2
* @link http://mxpcms.sourceforge.net
*
*/
define('IN_PORTAL', 1);
$mx_root_path = "./";
/*
* Let's include some stuff...
*/
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($mx_root_path . 'common.' . $phpEx);
/*
* Page selector
*/
$page_id = $mx_request_vars->request('page', MX_TYPE_INT, 1);
/*
Start user session
- populate $userdata and $lang
*/
$mx_user->init($user_ip, $page_id, false);
/*
* Load and instatiate CORE (page) and block classes
*/
$mx_page->init($page_id);
/*
* Initiate user style (template + theme) management
* - populate $theme, $images and initiate $template.
*/
$mx_user->init_style();
//Include shared phpBB2 language file
$mx_user->set_lang($mx_user->lang, $mx_user->help, 'lang_main');
//Include shared phpBB3 language file
$language->set_default_language(isset($mx_user->user_language) ? $mx_user->user_language : $mx_user->default_language);
//$language->add_lang(array('common', 'acp/common', 'cli'));
//$language->load_common_language_files();
/*
* Site under reconstruction
*/
if(!$portal_config['portal_status'] && !($mx_user->data['user_level'] == ADMIN && $mx_user->data['session_logged_in']))
{
mx_message_die(GENERAL_MESSAGE, $portal_config['disabled_message'], 'Information');
}
/*
* Show copyrights
*/
if ( $mx_request_vars->is_request('mx_copy') )
{
compose_mx_copy();
}
/*
* Page Auth and IP filter
*/
if ( !($mx_page->auth_view || $mx_page->auth_mod) && $mx_user->data['session_logged_in'] )
{
$message = empty( $lang['Page_Not_Authorised'] ) ? "Sorry, but you don't have privilege to access this page." : $lang['Page_Not_Authorised'];
mx_message_die(GENERAL_MESSAGE, $message, '', __LINE__, __FILE__, '');
}
elseif ( !($mx_page->auth_view || $mx_page->auth_mod) && !$mx_user->data['session_logged_in'] )
{
mx_redirect( mx3_append_sid( "login.$phpEx?redirect=index.$phpEx", 'page=' . $page_id, true ) );
}
elseif ( !$mx_page->auth_ip )
{
$message = empty( $lang['Page_Not_Authorised'] ) ? "Sorry, but you don't have privilege to access this page." : $lang['Page_Not_Authorised'];
mx_message_die(GENERAL_MESSAGE, $message, '', __LINE__, __FILE__, '');
}
/*
* Initialize page layout template
*/
$layouttemplate = new mx_Template( $mx_root_path . 'templates/'. $theme['template_name'] );
$layouttemplate->set_filenames(array(
'mx_main_layout' => $mx_page->page_main_layout)
);
//
// Start output of page
// ------------------------------------------------------------------------------------------------------------
//
//
// Page columns - loop through each column
//
for( $column = 0; $column < $mx_page->total_column; $column++ )
{
//
// Pass column data
//
$mx_page->output_column( $column );
//
// Column blocks - loop through column blocks
//
for( $block = 0; $block < $mx_page->total_block; $block++ )
{
//
// Validate this block is visible and exists for the column
//
if ( $mx_page->columns[$column]['column_id'] == $mx_page->blocks[$block]['column_id'] )
{
$block_id = $mx_block_id = $mx_page->blocks[$block]['block_id'];
$mx_block->init( $block_id );
//
// Toggle mode: default, dynamic, sub
//
unset($mx_dynamic_block);
if ( $mx_block->is_dynamic )
{
//
// Create a parent block
//
$mx_dynamic_block = new mx_block();
$mx_dynamic_block->init( $mx_block->block_id );
//
// Instatiate the dynamic block
//
if ($mx_dynamic_block->dynamic_block_id > 0)
{
$mx_block->init( $mx_dynamic_block->dynamic_block_id );
}
else
{
$mx_block->init_error_msg = 'This dynamic block has not been configured with a default block.';
}
}
unset($mx_parent_block);
if ( $mx_block->is_sub )
{
//
// Create a parent block
//
$mx_parent_block = new mx_block();
$mx_parent_block->init( $mx_block->block_id );
$total_subs = $mx_parent_block->total_subs;
}
else
{
$total_subs = 1;
}
//
// Additional loop for subblocks - split block
//
for( $subblock = 0; $subblock < $total_subs; $subblock++ )
{
if ( isset($mx_parent_block) )
{
if ($mx_parent_block->is_sub)
{
$block_id = intval( $mx_parent_block->sub_block_ids[$subblock] );
//
// Instatiate the sub block
//
$mx_block->init( $block_id );
}
}
//
// View Auth -------------------------------------------------------------------------------
//
if ( ( $mx_block->auth_view && $mx_block->show_block ) || $mx_block->auth_mod )
{
$template = new mx_Template($mx_root_path . 'templates/'. $theme['template_name']);
//
// Define $module_root_path, to be used within blocks
//
$module_root_path = $mx_block->module_root_path;
//
// Include block file and cache output
//
ob_start();
if (!@$mx_block->init_error_msg)
{
if ((@include $module_root_path . $mx_block->block_file) === false)
{
$module_root_path = $mx_root_path . $mx_block->module_root_path;
//this will fix the path
if ((@include $module_root_path . $mx_block->block_file) === false)
{
$module_root_path = $mx_block->module_root_path;
if (!is_dir($module_root_path . $mx_block->block_file . '/'))
{
include($module_root_path . $mx_block->block_file);
}
}
}
$mx_block->block_contents = ob_get_contents();
}
else
{
$mx_block->block_contents = $mx_block->init_error_msg;
}
ob_end_clean();
//
// Pass block data
//
if ( $mx_block->show_block || $mx_block->auth_mod )
{
//
// Full page block Mode
//
if ($mx_block->full_page)
{
$mx_block->output_full_page();
}
//
// Output Block contents
//
$mx_block->output();
//
// Output Block stats
//
$mx_block->output_stats();
}
}
//
// Edit Auth ---------------------------------------------------------------------------------
//
if ( ( ( $mx_block->auth_view && $mx_block->auth_edit && $mx_block->show_block ) || $mx_block->auth_mod ) )
{
//
// Now use the editCP on/off switch
//
$mx_page->editcp_exists();
//
// Output editcp controls/buttons
//
if ( isset($mx_dynamic_block) && $subblock == $total_subs - 1 )
{
if ($mx_dynamic_block->dynamic_block_id > 0 && $mx_dynamic_block->auth_edit)
{
$mx_dynamic_block->output_cp_button();
}
}
if ( isset($mx_parent_block) && $subblock == $total_subs - 1 && $mx_parent_block->auth_edit )
{
$mx_parent_block->output_cp_button();
}
$mx_block->output_cp_button();
//
// Is the Block hidden ? Output 'hidden' indicator
//
if ( !$mx_block->show_block || !$mx_block->auth_view)
{
$mx_block->output_hidden_indicator();
}
}
//
// Switch: show title --------------------------------------------------------------------------
//
if ( $mx_block->auth_view && $mx_block->show_block && $mx_block->show_title && $mx_block->module_root_path != 'modules/mx_phpbb/' || $mx_block->auth_mod )
{
$mx_block->output_title();
}
//
// Switch: show Block header -------------------------------------------------------------------
//
if ( $mx_block->auth_view && $mx_block->show_block && $mx_block->module_root_path != 'modules/mx_forum/' && $mx_block->module_root_path != 'modules/mx_phpbb/' && $mx_block->module_root_path != 'modules/mx_phpbb3/' || $mx_block->auth_mod )
{
$layouttemplate->assign_block_vars('layout_column.blocks.block_header', array());
}
//
// Output some subblock wrappers
//
if (isset($mx_parent_block))
{
if ( $mx_parent_block->is_sub )
{
if ( $subblock == 0 )
{
$layouttemplate->assign_block_vars('layout_column.blocks.sub_start', array());
$inner_space = $sub_inner_space = '';
}
else
{
$inner_space = '<td width="'. $mx_parent_block->sub_inner_space .'"> </td>';
$sub_inner_space = $mx_parent_block->sub_inner_space;
}
$block_size = $mx_parent_block->sub_block_sizes[$subblock];
$layouttemplate->assign_block_vars('layout_column.blocks.sub_col', array(
'INNER_SPACE' => $inner_space,
'SUB_INNER_SPACE' => $sub_inner_space,
'BLOCK_SIZE' => $mx_parent_block->sub_block_sizes[$subblock],
'BLOCK_SIZES' => ($mx_block->block_sizes !== '100%') ? $mx_block->block_sizes : $mx_parent_block->sub_block_sizes[$subblock]
));
if ( intval($subblock + 1) == $total_subs )
{
$layouttemplate->assign_block_vars('layout_column.blocks.sub_end', array());
}
}
}
else //if ($mx_block->module_root_path = 'modules/mx_navmenu/')
{
//$block_size = ($mx_block->block_sizes !== '100%') ? $mx_block->block_sizes : '100%';
}
} // for ... subblocks
//
// Destroy parent block data
//
if ( isset($mx_parent_block) && $mx_parent_block->is_sub )
{
unset( $mx_parent_block );
}
if ( isset($mx_dynamic_block) )
{
unset( $mx_dynamic_block );
}
$mx_block->kill_me($block_id);
}
} // for ... blocks
} // for ... column
// Output header
include($mx_root_path . 'includes/page_header.' . $phpEx);
// Output page
$layouttemplate->pparse('mx_main_layout');
$template->assign_vars(array(
'PORTAL' => defined('IN_PORTAL') ? true : false,
'PORTAL_INDEX_PAGE' => ($portal_config['main_layout']) ? true : false,
));
// Output footer
include($mx_root_path . 'includes/page_tail.' . $phpEx);
?>