forked from mambax7/tad_web
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
133 lines (113 loc) · 3.92 KB
/
Copy pathindex.php
File metadata and controls
133 lines (113 loc) · 3.92 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
<?php
use Xmf\Request;
use XoopsModules\Tadtools\Utility;
use XoopsModules\Tad_web\Tools as TadWebTools;
/*-----------引入檔案區--------------*/
require_once __DIR__ . '/header.php';
$GLOBALS['xoopsOption']['template_main'] = 'tad_web_index.tpl';
require_once XOOPS_ROOT_PATH . '/header.php';
Utility::test($_COOKIE, 'cookie', 'dd');
Utility::test($_SESSION, 'session', 'dd');
/*-----------執行動作判斷區----------*/
$op = Request::getString('op');
$WebID = Request::getInt('WebID');
$NoticeID = Request::getInt('NoticeID');
Utility::test($web_all_config, 'web_all_config', 'dd');
common_template($WebID, $web_all_config);
switch ($op) {
//重新計算空間
case 'check_quota':
check_quota($WebID);
header("location: index.php?WebID={$WebID}");
exit;
//重新產生畫面
case 'clear_block_cache':
clear_block_cache($WebID);
header("location: index.php?WebID={$WebID}");
exit;
//新增資料
case 'notice':
view_notice($NoticeID);
break;
//預設動作
default:
if (!empty($WebID)) {
ClassHome($WebID);
$op = 'ClassHome';
} else {
list_all_class();
$op = 'list_all_class';
}
}
/*-----------秀出結果區--------------*/
require_once __DIR__ . '/footer.php';
require_once XOOPS_ROOT_PATH . '/footer.php';
/*-----------function區--------------*/
//首頁
function ClassHome($WebID = '')
{
global $xoopsDB, $xoopsTpl, $MyWebs, $web_all_config;
// $web = get_tad_web($WebID);
define('_DISPLAY_MODE', 'home');
$web_plugin_enable_arr = $web_all_config['web_plugin_enable_arr'];
if (empty($web_plugin_enable_arr)) {
$show_arr = get_dir_plugins();
} else {
$show_arr = explode(',', $web_plugin_enable_arr);
}
foreach ($show_arr as $dirname) {
if (empty($dirname)) {
continue;
}
if (file_exists("plugins/{$dirname}/class.php")) {
require_once "plugins/{$dirname}/class.php";
$plugin_name = "tad_web_{$dirname}";
$$plugin_name = new $plugin_name($WebID);
}
}
$_SESSION['tad_web'][$WebID]['WebCounter']++;
if (_IS_EZCLASS) {
redis_do($WebID, 'set', '', 'WebCounter', $_SESSION['tad_web'][$WebID]['WebCounter']);
} else {
$sql = 'UPDATE `' . $xoopsDB->prefix('tad_web') . '` SET `WebCounter` = `WebCounter` +1 WHERE `WebID` = ?';
Utility::query($sql, 'i', [$WebID]);
}
$xoopsTpl->assign('MyWebs', $MyWebs);
}
//取得所有班級
function list_all_class()
{
global $xoopsTpl, $xoopsModuleConfig;
$xoopsTpl->assign('module_title', $xoopsModuleConfig['module_title']);
$web_plugin_display_arr = TadWebTools::get_web_config('web_plugin_display_arr', 0);
if (empty($web_plugin_display_arr)) {
$show_arr = get_dir_plugins();
} else {
$show_arr = explode(',', $web_plugin_display_arr);
}
$xoopsTpl->assign('show_arr', $show_arr);
// $xoopsTpl->assign('display_mode', 'index');
define('_DISPLAY_MODE', 'index');
$data_count = [];
foreach ($show_arr as $dirname) {
if (empty($dirname)) {
continue;
}
if (file_exists("plugins/{$dirname}/class.php")) {
require_once "plugins/{$dirname}/class.php";
$limit = TadWebTools::get_web_config("{$dirname}_limit", 0);
$plugin_name = "tad_web_{$dirname}";
$$plugin_name = new $plugin_name(0);
$data_count[$dirname] = $$plugin_name->list_all('', $limit);
}
}
$xoopsTpl->assign('data_count', $data_count);
$xoopsTpl->assign('data_count_sum', array_sum($data_count));
}
function view_notice($NoticeID = '')
{
global $xoopsTpl;
$xoopsTpl->assign('Notice', get_tad_web_notice($NoticeID));
$xoopsTpl->assign('theme_display_mode', 'blank');
$xoopsTpl->assign('blank_kind', 'content');
}