commit | author | age
|
dba282
|
1 |
<?php |
B |
2 |
/** |
|
3 |
* [WeEngine System] Copyright (c) 20181025112638 WE7.CC |
|
4 |
* WeEngine is NOT a free software, it under the license terms, visited http://www.we7.cc/ for more details. |
|
5 |
*/ |
|
6 |
define('IN_MOBILE', true); |
|
7 |
|
|
8 |
require '../framework/bootstrap.inc.php'; |
|
9 |
load()->app('common'); |
|
10 |
load()->app('template'); |
|
11 |
require IA_ROOT . '/app/common/bootstrap.app.inc.php'; |
|
12 |
|
|
13 |
$acl = array( |
|
14 |
'home' => array( |
|
15 |
'default' => 'home', |
|
16 |
), |
|
17 |
'mc' => array( |
|
18 |
'default' => 'home' |
|
19 |
) |
|
20 |
); |
|
21 |
|
|
22 |
if ($_W['setting']['copyright']['status'] == 1) { |
|
23 |
$_W['siteclose'] = true; |
|
24 |
message('抱歉,站点已关闭,关闭原因:' . $_W['setting']['copyright']['reason']); |
|
25 |
} |
|
26 |
$multiid = intval($_GPC['t']); |
|
27 |
if(empty($multiid)) { |
|
28 |
$multiid = intval($unisetting['default_site']); |
|
29 |
unset($setting); |
|
30 |
} |
|
31 |
|
|
32 |
$multi = pdo_fetch("SELECT * FROM ".tablename('site_multi')." WHERE id=:id AND uniacid=:uniacid", array(':id' => $multiid, ':uniacid' => $_W['uniacid'])); |
|
33 |
$multi['site_info'] = @iunserializer($multi['site_info']); |
|
34 |
|
|
35 |
$styleid = !empty($_GPC['s']) ? intval($_GPC['s']) : intval($multi['styleid']); |
|
36 |
$style = pdo_fetch("SELECT * FROM ".tablename('site_styles')." WHERE id = :id", array(':id' => $styleid)); |
|
37 |
|
|
38 |
$templates = uni_templates(); |
|
39 |
$templateid = intval($style['templateid']); |
|
40 |
$template = $templates[$templateid]; |
|
41 |
|
|
42 |
$_W['template'] = !empty($template) ? $template['name'] : 'default'; |
|
43 |
$_W['styles'] = array(); |
|
44 |
|
|
45 |
if(!empty($template) && !empty($style)) { |
|
46 |
$sql = "SELECT `variable`, `content` FROM " . tablename('site_styles_vars') . " WHERE `uniacid`=:uniacid AND `styleid`=:styleid"; |
|
47 |
$params = array(); |
|
48 |
$params[':uniacid'] = $_W['uniacid']; |
|
49 |
$params[':styleid'] = $styleid; |
|
50 |
$stylevars = pdo_fetchall($sql, $params); |
|
51 |
if(!empty($stylevars)) { |
|
52 |
foreach($stylevars as $row) { |
|
53 |
if (strexists($row['variable'], 'img')) { |
|
54 |
$row['content'] = tomedia($row['content']); |
|
55 |
} |
|
56 |
$_W['styles'][$row['variable']] = $row['content']; |
|
57 |
} |
|
58 |
} |
|
59 |
unset($stylevars, $row, $sql, $params); |
|
60 |
} |
|
61 |
|
|
62 |
$_W['page'] = array(); |
|
63 |
$_W['page']['title'] = $multi['title']; |
|
64 |
if(is_array($multi['site_info'])) { |
|
65 |
$_W['page'] = array_merge($_W['page'], $multi['site_info']); |
|
66 |
} |
|
67 |
unset($multi, $styleid, $style, $templateid, $template, $templates); |
|
68 |
|
|
69 |
if ($controller == 'wechat' && $action == 'card' && $do == 'use') { |
|
70 |
header("location: index.php?i={$_W['uniacid']}&c=entry&m=paycenter&do=consume&encrypt_code={$_GPC['encrypt_code']}&card_id={$_GPC['card_id']}&openid={$_GPC['openid']}&source={$_GPC['source']}"); |
|
71 |
exit; |
|
72 |
} |
|
73 |
$controllers = array(); |
|
74 |
$handle = opendir(IA_ROOT . '/app/source/'); |
|
75 |
if(!empty($handle)) { |
|
76 |
while($dir = readdir($handle)) { |
|
77 |
if($dir != '.' && $dir != '..') { |
|
78 |
$controllers[] = $dir; |
|
79 |
} |
|
80 |
} |
|
81 |
} |
|
82 |
if(!in_array($controller, $controllers)) { |
|
83 |
$controller = 'home'; |
|
84 |
} |
|
85 |
$init = IA_ROOT . "/app/source/{$controller}/__init.php"; |
|
86 |
if(is_file($init)) { |
|
87 |
require $init; |
|
88 |
} |
|
89 |
|
|
90 |
$actions = array(); |
|
91 |
$handle = opendir(IA_ROOT . '/app/source/' . $controller); |
|
92 |
if(!empty($handle)) { |
|
93 |
while($dir = readdir($handle)) { |
|
94 |
if($dir != '.' && $dir != '..' && strexists($dir, '.ctrl.php')) { |
|
95 |
$dir = str_replace('.ctrl.php', '', $dir); |
|
96 |
$actions[] = $dir; |
|
97 |
} |
|
98 |
} |
|
99 |
} |
|
100 |
|
|
101 |
if(empty($actions)) { |
|
102 |
$str = ''; |
|
103 |
if(uni_is_multi_acid()) { |
|
104 |
$str = "&j={$_W['acid']}"; |
|
105 |
} |
|
106 |
header("location: index.php?i={$_W['uniacid']}{$str}&c=home?refresh"); |
|
107 |
} |
|
108 |
if(!in_array($action, $actions)) { |
|
109 |
$action = $acl[$controller]['default']; |
|
110 |
} |
|
111 |
if(!in_array($action, $actions)) { |
|
112 |
$action = $actions[0]; |
|
113 |
} |
|
114 |
require _forward($controller, $action); |
|
115 |
|
|
116 |
function _forward($c, $a) { |
|
117 |
$file = IA_ROOT . '/app/source/' . $c . '/' . $a . '.ctrl.php'; |
|
118 |
return $file; |
|
119 |
} |