userapp_app.php 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. <?php
  2. /**
  3. * [Discuz!] (C)2001-2099 Comsenz Inc.
  4. * This is NOT a freeware, use is subject to license terms
  5. *
  6. * $Id: userapp_app.php 34091 2013-10-09 04:04:17Z andyzheng $
  7. */
  8. if(!defined('IN_DISCUZ')) {
  9. exit('Access Denied');
  10. }
  11. if($appid == '1036584') {
  12. } else {
  13. if(!checkperm('allowmyop')) {
  14. showmessage('no_privilege_myop', '', array(), array('return' => true));
  15. }
  16. }
  17. $app = array();
  18. if($app = C::t('common_myapp')->fetch($appid)) {
  19. if($app['flag']<0) {
  20. showmessage('no_privilege_myapp');
  21. }
  22. }
  23. $canvasTitle = '';
  24. $isFullscreen = 0;
  25. $displayUserPanel = 0;
  26. if($app['canvastitle']) {
  27. $canvasTitle =$app['canvastitle'];
  28. }
  29. if($app['fullscreen']) {
  30. $isFullscreen = $app['fullscreen'];
  31. }
  32. if($app['displayuserpanel']) {
  33. $displayUserPanel = $app['displayuserpanel'];
  34. }
  35. $my_appId = $appid;
  36. $my_suffix = htmlspecialchars(base64_decode($_GET['my_suffix']));
  37. $my_prefix = getsiteurl();
  38. updatecreditbyaction('useapp', 0, array(), $appid);
  39. if (!$my_suffix) {
  40. dheader('Location: userapp.php?mod=app&id='.$my_appId.'&my_suffix='.urlencode(base64_encode('/')));
  41. exit;
  42. }
  43. if (preg_match('/^\//', $my_suffix)) {
  44. $url = 'http://apps.manyou.com/'.$my_appId.$my_suffix;
  45. } else {
  46. if ($my_suffix) {
  47. $url = 'http://apps.manyou.com/'.$my_appId.'/'.$my_suffix;
  48. } else {
  49. $url = 'http://apps.manyou.com/'.$my_appId;
  50. }
  51. }
  52. if (strpos($my_suffix, '?')) {
  53. $url = $url.'&my_uchId='.$_G['uid'].'&my_sId='.$_G['setting']['my_siteid'];
  54. } else {
  55. $url = $url.'?my_uchId='.$_G['uid'].'&my_sId='.$_G['setting']['my_siteid'];
  56. }
  57. $url .= '&my_prefix='.urlencode($my_prefix).'&my_suffix='.urlencode($my_suffix);
  58. $current_url = getsiteurl().'userapp.php';
  59. if ($_SERVER['QUERY_STRING']) {
  60. $current_url = $current_url.'?'.$_SERVER['QUERY_STRING'];
  61. }
  62. $extra = $_GET['my_extra'];
  63. $url .= '&my_current='.urlencode($current_url);
  64. $url .= '&my_extra='.urlencode($extra);
  65. $url .= '&my_ts='.$_G['timestamp'];
  66. $url .= '&my_appVersion='.$app['version'];
  67. $url .= '&my_fullscreen='.$isFullscreen;
  68. $hash = $_G['setting']['my_siteid'].'|'.$_G['uid'].'|'.$appid.'|'.$current_url.'|'.$extra.'|'.$_G['timestamp'].'|'.$_G['setting']['my_sitekey'];
  69. $hash = md5($hash);
  70. $url .= '&my_sig='.$hash;
  71. $my_sign = md5($_G['setting']['my_siteid'].'|'.$_G['uid'].'|'.$_G['setting']['my_sitekey'].'|'.$_G['timestamp']);
  72. $url .= '&timestamp='. $_G['timestamp'] .'&my_sign='.$my_sign;
  73. $my_suffix = urlencode($my_suffix);
  74. $canvasTitle = '';
  75. $isFullscreen = 0;
  76. $displayUserPanel = 0;
  77. if ($app['canvastitle']) {
  78. $canvasTitle =$app['canvastitle'];
  79. }
  80. if ($app['fullscreen']) {
  81. $isFullscreen = $app['fullscreen'];
  82. }
  83. if ($app['displayuserpanel']) {
  84. $displayUserPanel = $app['displayuserpanel'];
  85. }
  86. if($_G['uid'] && $appid && $appid != '1036584') {
  87. $usedArr = array();
  88. $usedInfo = explode('|', $_G['cookie']['usedapp']);
  89. if($usedInfo[0] == $_G['uid']) {
  90. $usedArr = !empty($usedInfo[1]) ? explode(',', $usedInfo[1]) : array();
  91. if(!in_array($appid, $usedArr)) {
  92. if(count($usedArr) >= 5) {
  93. unset($usedArr[0]);
  94. }
  95. $usedArr[] = $appid;
  96. }
  97. }
  98. dsetcookie('usedapp', $_G['uid'].'|'.implode(',', $usedArr), 31536000);
  99. }
  100. $navtitle = $app['appname'].' - '.$navtitle;
  101. $metakeywords = $app['appname'].' '.$_G['setting']['seokeywords']['userapp'];
  102. $metadescription = $app['appname'].' '.$_G['setting']['seodescription']['userapp'];
  103. include_once template("userapp/userapp_app");
  104. ?>