cloud_manyou.php
5.38 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
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: cloud_manyou.php 29273 2012-03-31 07:58:50Z yexinhao $
*/
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
exit('Access Denied');
}
cpheader();
if(!submitcheck('settingsubmit')) {
shownav('navcloud', 'setting_manyou');
$_GET['anchor'] = in_array($_GET['anchor'], array('base', 'manage')) ? $_GET['anchor'] : 'manage';
$current = array($_GET['anchor'] => 1);
$manyounav = array();
if($_G['setting']['my_app_status']) {
$manyounav[0] = array('setting_manyou_manage', 'cloud&operation=manyou&anchor=manage', $current['manage']);
}
$manyounav[1] = array('setting_manyou_base', 'cloud&operation=manyou&anchor=base', $current['base']);
showsubmenu('setting_manyou', $manyounav);
showformheader('cloud&edit=yes');
showhiddenfields(array('operation' => $operation));
if($_GET['anchor'] == 'base') {
showtips('setting_manyou_tips');
showtableheader('', 'nobottom', 'id="base"');
$actives = $checkarr = array();
$actives[$_G['setting']['my_app_status']] = ' class="checked"';
$checkarr[$_G['setting']['my_app_status']] = ' checked';
$str = <<<EOF
<ul onmouseover="altStyle(this);">
<li$actives[1]><input type="radio" onclick="hiddenShareInfo(0, 1);$('hidden_setting_manyou_base_status').style.display = '';" $checkarr[1] value="1" name="settingnew[my_app_status]" class="radio"> $lang[yes]</li>
<li$actives[0]><input type="radio" onclick="hiddenShareInfo(0, 0);$('hidden_setting_manyou_base_status').style.display = 'none';" $checkarr[0] value="0" name="settingnew[my_app_status]" class="radio"> $lang[no]</li>
</ul>
EOF;
showsetting('setting_manyou_base_status', 'settingnew[my_app_status]', $_G['setting']['my_app_status'], $str, '', 1);
showsetting('setting_manyou_base_close_prompt', 'settingnew[my_closecheckupdate]', $_G['setting']['my_closecheckupdate'], 'radio');
showsetting('setting_manyou_base_open_app_prompt', 'settingnew[my_openappprompt]', $_G['setting']['my_openappprompt'], 'radio');
showtagfooter('tbody');
$appstate = !empty($_G['setting']['my_app_status']) ? 1 : 0;
$actives = $checkarr = array();
echo <<<EOF
<script type="text/javascript">
var appState = $appstate;
function hiddenShareInfo(type, state) {
appState = state ? 1 : 0;
$('shareinfo').style.display = appState ? '' : 'none';
}
</script>
EOF;
showtagheader('tbody', 'shareinfo', $_G['setting']['my_app_status']);
showsetting('setting_manyou_base_ip', 'settingnew[my_ip]', $_G['setting']['my_ip'], 'text');
showtagfooter('tbody');
showtablefooter();
} elseif($_G['setting']['my_app_status']) {
$uchUrl = $_G['siteurl'].'/'.ADMINSCRIPT.'?action=cloud&operation=manyou&anchor=' . $_GET['anchor'];
if(empty($_GET['my_suffix'])) {
$_GET['my_suffix'] = '/appadmin/list';
}
$my_prefix = 'http://uchome.manyou.com';
$my_suffix = urlencode($_GET['my_suffix']);
$tmp_suffix = $_GET['my_suffix']?urldecode($_GET['my_suffix']):'/appadmin/list';
$myUrl = $my_prefix.$tmp_suffix;
$timestamp = time();
$hash = md5($_G['setting']['my_siteid'].'|'.$_G['uid'].'|'.$_G['setting']['my_sitekey'].'|'.$timestamp);
$delimiter = strrpos($myUrl, '?') ? '&' : '?';
$url = $myUrl.$delimiter.'s_id='.$_G['setting']['my_siteid'].'&uch_id='.$_G['uid'].'&uch_url='.urlencode($uchUrl).'&my_suffix='.$my_suffix.'×tamp='.$timestamp.'&my_sign='.$hash;
print <<<EOF
<script type="text/javascript" src="http://static.manyou.com/scripts/my_iframe.js"></script>
<script language="javascript">
var prefixURL = "$my_prefix";
var suffixURL = "$my_suffix";
var queryString = '';
var url = "{$url}";
var oldHash = null;
var timer = null;
var server = new MyXD.Server("ifm0");
server.registHandler('iframeHasLoaded');
server.registHandler('setTitle');
server.start();
function iframeHasLoaded(ifm_id) {
MyXD.Util.showIframe(ifm_id);
document.getElementById('loading').style.display = 'none';
}
function setTitle(x) {
document.title = x;
}
</script>
<div id="loading" style="display:block; padding:100px 0 100px 0;text-align:center;color:#999999;font-size:12px;">
<img src="static/image/common/loading.gif" alt="loading..." align="absmiddle" /> {$lang['loading']}...
</div>
<div style="margin-top:8px;">
<iframe id="ifm0" frameborder="0" width="810px" scrolling="no" height="810px" style="position:absolute; top:-5000px; left:-5000px;" src="{$url}"></iframe>
</div>
</body></html>
EOF;
exit();
} else {
cpmsg('my_app_status_off', 'action=cloud&operation=manyou&anchor=base', 'error');
}
showsubmit('settingsubmit', 'submit');
showtablefooter();
showformfooter();
} else {
$settingnew = $_GET['settingnew'];
$settings = array();
foreach($settingnew as $key => $val) {
if($_G['setting'][$key] != $val) {
$$key = $val;
$settings[$key] = $val;
}
}
if($settings) {
C::t('common_setting')->update_batch($settings);
}
$appName = 'manyou';
$status = $settingnew['my_app_status'] ? 'normal' : 'pause';
$appService = Cloud::loadClass('Service_App');
$appService->setCloudAppStatus($appName, $status);
cpmsg('setting_update_succeed', 'action=cloud&operation='.$operation.(!empty($_GET['anchor']) ? '&anchor='.$_GET['anchor'] : ''), 'succeed');
}