userapp_app.php
3.39 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
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: userapp_app.php 34091 2013-10-09 04:04:17Z andyzheng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
if($appid == '1036584') {
} else {
if(!checkperm('allowmyop')) {
showmessage('no_privilege_myop', '', array(), array('return' => true));
}
}
$app = array();
if($app = C::t('common_myapp')->fetch($appid)) {
if($app['flag']<0) {
showmessage('no_privilege_myapp');
}
}
$canvasTitle = '';
$isFullscreen = 0;
$displayUserPanel = 0;
if($app['canvastitle']) {
$canvasTitle =$app['canvastitle'];
}
if($app['fullscreen']) {
$isFullscreen = $app['fullscreen'];
}
if($app['displayuserpanel']) {
$displayUserPanel = $app['displayuserpanel'];
}
$my_appId = $appid;
$my_suffix = htmlspecialchars(base64_decode($_GET['my_suffix']));
$my_prefix = getsiteurl();
updatecreditbyaction('useapp', 0, array(), $appid);
if (!$my_suffix) {
dheader('Location: userapp.php?mod=app&id='.$my_appId.'&my_suffix='.urlencode(base64_encode('/')));
exit;
}
if (preg_match('/^\//', $my_suffix)) {
$url = 'http://apps.manyou.com/'.$my_appId.$my_suffix;
} else {
if ($my_suffix) {
$url = 'http://apps.manyou.com/'.$my_appId.'/'.$my_suffix;
} else {
$url = 'http://apps.manyou.com/'.$my_appId;
}
}
if (strpos($my_suffix, '?')) {
$url = $url.'&my_uchId='.$_G['uid'].'&my_sId='.$_G['setting']['my_siteid'];
} else {
$url = $url.'?my_uchId='.$_G['uid'].'&my_sId='.$_G['setting']['my_siteid'];
}
$url .= '&my_prefix='.urlencode($my_prefix).'&my_suffix='.urlencode($my_suffix);
$current_url = getsiteurl().'userapp.php';
if ($_SERVER['QUERY_STRING']) {
$current_url = $current_url.'?'.$_SERVER['QUERY_STRING'];
}
$extra = $_GET['my_extra'];
$url .= '&my_current='.urlencode($current_url);
$url .= '&my_extra='.urlencode($extra);
$url .= '&my_ts='.$_G['timestamp'];
$url .= '&my_appVersion='.$app['version'];
$url .= '&my_fullscreen='.$isFullscreen;
$hash = $_G['setting']['my_siteid'].'|'.$_G['uid'].'|'.$appid.'|'.$current_url.'|'.$extra.'|'.$_G['timestamp'].'|'.$_G['setting']['my_sitekey'];
$hash = md5($hash);
$url .= '&my_sig='.$hash;
$my_sign = md5($_G['setting']['my_siteid'].'|'.$_G['uid'].'|'.$_G['setting']['my_sitekey'].'|'.$_G['timestamp']);
$url .= '×tamp='. $_G['timestamp'] .'&my_sign='.$my_sign;
$my_suffix = urlencode($my_suffix);
$canvasTitle = '';
$isFullscreen = 0;
$displayUserPanel = 0;
if ($app['canvastitle']) {
$canvasTitle =$app['canvastitle'];
}
if ($app['fullscreen']) {
$isFullscreen = $app['fullscreen'];
}
if ($app['displayuserpanel']) {
$displayUserPanel = $app['displayuserpanel'];
}
if($_G['uid'] && $appid && $appid != '1036584') {
$usedArr = array();
$usedInfo = explode('|', $_G['cookie']['usedapp']);
if($usedInfo[0] == $_G['uid']) {
$usedArr = !empty($usedInfo[1]) ? explode(',', $usedInfo[1]) : array();
if(!in_array($appid, $usedArr)) {
if(count($usedArr) >= 5) {
unset($usedArr[0]);
}
$usedArr[] = $appid;
}
}
dsetcookie('usedapp', $_G['uid'].'|'.implode(',', $usedArr), 31536000);
}
$navtitle = $app['appname'].' - '.$navtitle;
$metakeywords = $app['appname'].' '.$_G['setting']['seokeywords']['userapp'];
$metadescription = $app['appname'].' '.$_G['setting']['seodescription']['userapp'];
include_once template("userapp/userapp_app");
?>