-
Notifications
You must be signed in to change notification settings - Fork 0
/
misc.php
100 lines (83 loc) · 2.4 KB
/
misc.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
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: misc.php 34264 2013-11-27 03:14:58Z nemohou $
*/
if(isset($_GET['css'])) {
$css = explode('|', $_GET['css']);
$string = '';
$size = 0;
foreach($css as $file) {
if(preg_match('/^\w+$/', $file)) {
$file = './data/cache/style_'.$file.'.css';
$string .= @implode('', file($file));
}
}
ob_start('ob_gzhandler');
header('Content-Type: text/css');
header('Expires: '.gmdate('D, d M Y H:i:s', time() + 2592000).' GMT');
header('Last-Modified: '.gmdate('D, d M Y H:i:s', time()).' GMT');
echo $string;
exit;
}
if(isset($_GET['js'])) {
$js = explode('|', $_GET['js']);
$string = '';
$size = 0;
foreach($js as $file) {
$file = substr($file, 0, strpos($file, '.'));
if(preg_match('/^\w+$/', $file)) {
$file = './data/cache/'.$file.'.js';
$string .= @implode('', file($file));
}
}
ob_start('ob_gzhandler');
header('Content-Type: text/javascript');
header('Expires: '.gmdate('D, d M Y H:i:s', time() + 2592000).' GMT');
header('Last-Modified: '.gmdate('D, d M Y H:i:s', time()).' GMT');
echo $string;
exit;
}
define('APPTYPEID', 100);
define('CURSCRIPT', 'misc');
require './source/class/class_core.php';
$discuz = C::app();
$discuz->reject_robot();
$modarray = array('seccode', 'secqaa', 'initsys', 'invite', 'faq', 'report',
'swfupload', 'manyou', 'stat', 'ranklist', 'buyinvitecode',
'tag', 'diyhelp', 'mobile', 'patch', 'getatuser', 'imgcropper',
'userstatus', 'signin');
$modcachelist = array(
'ranklist' => array('forums', 'diytemplatename'),
);
$mod = getgpc('mod');
$mod = (empty($mod) || !in_array($mod, $modarray)) ? 'error' : $mod;
if(in_array($mod, array('seccode', 'secqaa', 'initsys', 'faq', 'swfupload', 'mobile'))) {
define('ALLOWGUEST', 1);
}
$cachelist = array();
if(isset($modcachelist[$mod])) {
$cachelist = $modcachelist[$mod];
}
$discuz->cachelist = $cachelist;
switch ($mod) {
case 'secqaa':
case 'manyou':
case 'userstatus':
case 'seccode':
$discuz->init_cron = false;
$discuz->init_session = false;
break;
case 'updatecache':
$discuz->init_cron = false;
$discuz->init_session = false;
default:
break;
}
$discuz->init();
define('CURMODULE', $mod);
runhooks();
require DISCUZ_ROOT.'./source/module/misc/misc_'.$mod.'.php';
?>