function_space.php 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755
  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: function_space.php 34052 2013-09-25 06:18:43Z andyzheng $
  7. */
  8. if(!defined('IN_DISCUZ')) {
  9. exit('Access Denied');
  10. }
  11. function getblockhtml($blockname,$parameters = array()) {
  12. global $_G, $space;
  13. $parameters = empty($parameters) ? array() : $parameters;
  14. $list = array();
  15. $sql = $title = $html = $wheresql = $ordersql = $titlemore = $do = $contentclassname = '';
  16. $view = $from = false;
  17. $contenttagname = 'div';
  18. $shownum = 6;
  19. $uid = intval($space['uid']);
  20. $shownum = empty($parameters['shownum']) ? $shownum : intval($parameters['shownum']);
  21. switch ($blockname) {
  22. case 'personalinfo':
  23. $do = 'profile';
  24. space_merge($space, 'profile');
  25. require_once libfile('function/friend');
  26. $isfriend = friend_check($space['uid']);
  27. require_once libfile('function/spacecp');
  28. loadcache('profilesetting');
  29. include_once libfile('function/profile');
  30. $profiles = array();
  31. $privacy = $space['privacy']['profile'] ? $space['privacy']['profile'] : array();
  32. foreach($_G['cache']['profilesetting'] as $fieldid=>$field) {
  33. if(!$field['available'] || in_array($fieldid, array('birthprovince', 'birthdist', 'birthcommunity', 'resideprovince', 'residedist', 'residecommunity'))) {
  34. continue;
  35. }
  36. if(
  37. $field['available'] && $field['invisible'] != '1' && strlen($space[$fieldid]) > 0 &&
  38. (
  39. $field['showinthread'] ||
  40. $field['showincard'] ||
  41. (
  42. $space['self'] || empty($privacy[$fieldid]) || ($isfriend && $privacy[$fieldid] == 1)
  43. )
  44. )
  45. ) {
  46. $val = profile_show($fieldid, $space);
  47. if($val !== false) {
  48. if($fieldid == 'realname' && $_G['uid'] != $space['uid'] && !ckrealname(1)) {
  49. continue;
  50. }
  51. if($field['formtype'] == 'file' && $val) {
  52. $imgurl = getglobal('setting/attachurl').'./profile/'.$val;
  53. $val = '<span><a href="'.$imgurl.'" target="_blank"><img src="'.$imgurl.'" style="max-width: 300px;" /></a></span>';
  54. }
  55. if ($val == '') $val = '';
  56. $html .= '<li><em>'.$field['title'].'</em>'.$val.'</li>';
  57. }
  58. }
  59. }
  60. $html = $html ? $html : '<li>'.lang('space', 'block_view_profileinfo_noperm').'</li>';
  61. $html = '<ul id="pprl" class="mbm pbm bbda cl">'.$html.$more.'</ul>';
  62. $more = lang('space', 'block_profile_all', array('uid' => $uid));
  63. $html = $html.$more;
  64. $titlemore = $space['self'] ? lang('space', 'block_profile_edit') : '';
  65. break;
  66. case 'profile':
  67. $do = $blockname;
  68. $managehtml = '';
  69. $avatar = empty($parameters['banavatar']) ? 'middle' : $parameters['banavatar'];
  70. $html .= "<div class=\"hm\"><p><a href=\"home.php?mod=space&uid=$uid\" target=\"_blank\">".avatar($uid,$avatar).'</a></p>';
  71. $memberfieldforum = C::t('common_member_field_forum')->fetch($space['uid']);
  72. $space['medals'] = $memberfieldforum['medals'];
  73. unset($memberfieldforum);
  74. $usermedals = $medal_detial = $usermedalmenus = '';
  75. if($space['medals']) {
  76. loadcache('medals');
  77. foreach($space['medals'] = explode("\t", $space['medals']) as $key => $medalid) {
  78. list($medalid, $medalexpiration) = explode("|", $medalid);
  79. if(isset($_G['cache']['medals'][$medalid]) && (!$medalexpiration || $medalexpiration > TIMESTAMP)) {
  80. $usermedals .= '<img src="'.STATICURL.'image/common/'.$_G['cache']['medals'][$medalid]['image'].'" id="md_'.$medalid.'" alt="'.$_G['cache']['medals'][$medalid]['name'].'\'" onmouseover="showMenu({\'ctrlid\':this.id, \'menuid\':\'md_'.$medalid.'_menu\', \'pos\':\'12!\'});" />&nbsp;';
  81. $usermedalmenus .= '
  82. <div id="md_'.$medalid.'_menu" class="tip tip_4" style="display: none;">
  83. <div class="tip_horn"></div>
  84. <div class="tip_c">
  85. <h4>'.$_G['cache']['medals'][$medalid]['name'].'</h4>
  86. <p>'.$_G['cache']['medals'][$medalid]['description'].'</p>
  87. </div>
  88. </div>';
  89. }
  90. }
  91. if($usermedals) {
  92. $usermedals = '<p class="md_ctrl"><a href="home.php?mod=medal">'.$usermedals.'</a></p>'.$usermedalmenus;
  93. }
  94. }
  95. $html .= "<h2 class=\"mbn\"><a href=\"home.php?mod=space&uid=$uid\" target=\"_blank\">".$space['username']."</a></h2>$usermedals";
  96. $html .= '</div><ul class="xl xl2 cl ul_list">';
  97. $magicinfo = $showmagicgift = false;
  98. if($_G['setting']['magicstatus'] && $_G['setting']['magics']['gift']) {
  99. $showmagicgift = true;
  100. $magicinfo = !empty($space['magicgift']) ? dunserialize($space['magicgift']) : array();
  101. }
  102. if(helper_access::check_module('follow')) {
  103. $html .= '<li class="ul_broadcast"><a href="home.php?mod=space&uid='.$uid.'">'.lang('space', 'block_profile_follow').'</a></li>';
  104. }
  105. if ($space['self']) {
  106. $html .= '<li class="ul_diy"><a href="home.php?mod=space&do=index&diy=yes">'.lang('space', 'block_profile_diy').'</a></li>';
  107. $html .= '<li class="ul_msg"><a href="home.php?mod=space&uid='.$uid.'&do=wall">'.lang('space', 'block_profile_wall').'</a></li>';
  108. $html .= '<li class="ul_avt"><a href="home.php?mod=spacecp&ac=avatar">'.lang('space', 'block_profile_avatar').'</a></li>';
  109. $html .= '<li class="ul_profile"><a href="home.php?mod=spacecp&ac=profile">'.lang('space', 'block_profile_update').'</a></li>';
  110. if($showmagicgift) {
  111. $html .= '<li class="ul_magicgift"><div style="'.'background: url('.STATICURL.'image/magic/gift.small.gif) no-repeat 0 50%;'.'">';
  112. if($magicinfo) {
  113. $html .= '<a onclick="showWindow(\'magicgift\', this.href, \'get\', 0)" href="home.php?mod=spacecp&ac=magic&op=retiregift">'.lang('magic/gift', 'gift_gc').'</a>';
  114. } else {
  115. $html .= '<a onclick="showWindow(\'magicgift\', this.href, \'get\', 0)" href="home.php?mod=magic&mid=gift">'.lang('magic/gift', 'gift_use').'</a>';
  116. }
  117. $html .= '</div></li>';
  118. }
  119. } else {
  120. require_once libfile('function/friend');
  121. $isfriend = friend_check($uid);
  122. $follow = C::t('home_follow')->fetch_by_uid_followuid($_G['uid'], $uid);
  123. if($follow) {
  124. $html .= "<li class='ul_flw'><a href=\"home.php?mod=spacecp&ac=follow&op=del&fuid=$space[uid]\" id=\"followmod\" onclick=\"showWindow(this.id, this.href, 'get', 0);\">".lang('space', 'follow_cancle_follow')."</a></li>";
  125. } else {
  126. $html .= "<li class='ul_flw'><a href=\"home.php?mod=spacecp&ac=follow&op=add&hash=".FORMHASH."&fuid=$space[uid]\" id=\"followmod\" onclick=\"showWindow(this.id, this.href, 'get', 0);\">".lang('space', 'follow_follow_ta')."</a></li>";
  127. }
  128. if (!$isfriend) {
  129. $html .= "<li class='ul_add'><a href=\"home.php?mod=spacecp&ac=friend&op=add&uid=$space[uid]&handlekey=addfriendhk_{$space[uid]}\" id=\"a_friend_li_{$space[uid]}\" onclick=\"showWindow(this.id, this.href, 'get', 0);\">".lang('space', 'block_profile_friend_add')."</a></li>";
  130. } else {
  131. $html .= "<li class='ul_ignore'><a href=\"home.php?mod=spacecp&ac=friend&op=ignore&uid=$space[uid]&handlekey=ignorefriendhk_{$space[uid]}\" id=\"a_ignore_{$space[uid]}\" onclick=\"showWindow(this.id, this.href, 'get', 0);\">".lang('space', 'block_profile_friend_ignore')."</a></li>";
  132. }
  133. $html .= "<li class='ul_msg'><a href=\"home.php?mod=space&uid=$space[uid]&do=wall\">".lang('space', 'block_profile_wall_to_me')."</a></li>";
  134. $html .= "<li class='ul_poke'><a href=\"home.php?mod=spacecp&ac=poke&op=send&uid=$space[uid]&handlekey=propokehk_{$space[uid]}\" id=\"a_poke_{$space[uid]}\" onclick=\"showWindow(this.id, this.href, 'get', 0);\">".lang('space', 'block_profile_poke')."</a></li>";
  135. $html .= "<li class='ul_pm'><a href=\"home.php?mod=spacecp&ac=pm&op=showmsg&handlekey=showmsg_$space[uid]&touid=$space[uid]&pmid=0&daterange=2\" id=\"a_sendpm_$space[uid]\" onclick=\"showWindow('showMsgBox', this.href, 'get', 0)\">".lang('space', 'block_profile_sendmessage')."</a></li>";
  136. }
  137. $html .= '</ul>';
  138. $encodeusername = rawurlencode($space['username']);
  139. if(checkperm('allowbanuser')) {
  140. $managehtml .= '<li><a href="'.($_G['adminid'] == 1 ? "admin.php?action=members&operation=ban&username=$encodeusername&frames=yes" : "forum.php?mod=modcp&action=member&op=ban&uid=$space[uid]").'" id="usermanageli" onmouseover="showMenu(this.id)" class="showmenu" target="_blank">'.lang('home/template', 'member_manage').'</a></li>';
  141. } elseif (checkperm('allowedituser')) {
  142. $managehtml .= '<li><a href="'.($_G['adminid'] == 1 ? "admin.php?action=members&operation=search&username=$encodeusername&submit=yes&frames=yes" : "forum.php?mod=modcp&action=member&op=edit&uid=$space[uid]").'" id="usermanageli" onmouseover="showMenu(this.id)" class="showmenu" target="_blank">'.lang('home/template', 'member_manage').'</a></li>';
  143. }
  144. if($_G['adminid'] == 1) {
  145. $managehtml .= "<li><a href=\"forum.php?mod=modcp&action=thread&op=post&do=search&searchsubmit=1&users=$encodeusername\" id=\"umanageli\" onmouseover=\"showMenu(this.id)\" class=\"showmenu\">".lang('home/template', 'content_manage')."</a></li>";
  146. }
  147. if(!empty($managehtml)) {
  148. $html .= '<hr class="da mtn m0" /><ul class="ptn xl xl2 cl">'.$managehtml.'</ul><ul id="usermanageli_menu" class="p_pop" style="width: 80px; display:none;">';
  149. if(checkperm('allowbanuser')) {
  150. $html .= '<li><a href="'.($_G['adminid'] == 1 ? "admin.php?action=members&operation=ban&username=$encodeusername&frames=yes" : "forum.php?mod=modcp&action=member&op=ban&uid=$space[uid]").'" target="_blank">'.lang('home/template', 'user_ban').'</a></li>';
  151. }
  152. if (checkperm('allowedituser')) {
  153. $html .= '<li><a href="'.($_G['adminid'] == 1 ? "admin.php?action=members&operation=search&username=$encodeusername&submit=yes&frames=yes" : "forum.php?mod=modcp&action=member&op=edit&uid=$space[uid]").'" target="_blank">'.lang('home/template', 'user_edit').'</a></li>';
  154. }
  155. $html .= '</ul>';
  156. if($_G['adminid'] == 1) {
  157. $html .= '<ul id="umanageli_menu" class="p_pop" style="width: 80px; display:none;">';
  158. $html .= '<li><a href="forum.php?mod=modcp&action=thread&op=post&searchsubmit=1&do=search&users='.$encodeusername.'" target="_blank">'.lang('space', 'manage_post').'</a></li>';
  159. $html .= '<li><a href="admin.php?action=doing&searchsubmit=1&detail=1&search=true&fromumanage=1&users='.$encodeusername.'" target="_blank">'.lang('space', 'manage_doing').'</a></li>';
  160. $html .= '<li><a href="admin.php?action=blog&searchsubmit=1&detail=1&search=true&fromumanage=1&uid='.$uid.'" target="_blank">'.lang('space', 'manage_blog').'</a></li>';
  161. $html .= '<li><a href="admin.php?action=feed&searchsubmit=1&detail=1&fromumanage=1&uid='.$uid.'" target="_blank">'.lang('space', 'manage_feed').'</a></li>';
  162. $html .= '<li><a href="admin.php?action=album&searchsubmit=1&detail=1&search=true&fromumanage=1&uid='.$uid.'" target="_blank">'.lang('space', 'manage_album').'</a></li>';
  163. $html .= '<li><a href="admin.php?action=pic&searchsubmit=1&detail=1&search=true&fromumanage=1&users='.$encodeusername.'" target="_blank">'.lang('space', 'manage_pic').'</a></li>';
  164. $html .= '<li><a href="admin.php?action=comment&searchsubmit=1&detail=1&fromumanage=1&authorid='.$uid.'" target="_blank">'.lang('space', 'manage_comment').'</a></li>';
  165. $html .= '<li><a href="admin.php?action=share&searchsubmit=1&detail=1&search=true&fromumanage=1&uid='.$uid.'" target="_blank">'.lang('space', 'manage_share').'</a></li>';
  166. $html .= '<li><a href="admin.php?action=threads&operation=group&searchsubmit=1&detail=1&search=true&fromumanage=1&users='.$encodeusername.'" target="_blank">'.lang('space', 'manage_group_threads').'</a></li>';
  167. $html .= '<li><a href="admin.php?action=prune&operation=group&searchsubmit=1&detail=1&fromumanage=1&users='.$encodeusername.'" target="_blank">'.lang('space', 'manage_group_prune').'</a></li>';
  168. $html .= '</ul>';
  169. }
  170. }
  171. if($_G['setting']['magicstatus'] && $_G['setting']['magics']['gift']) {
  172. $info = !empty($space['magicgift']) ? dunserialize($space['magicgift']) : array();
  173. if($space['self']) {
  174. } elseif($info) {
  175. if($info['left'] && !in_array($_G['uid'], (array)$info['receiver'])) {
  176. $percredit = min($info['percredit'], $info['left']);
  177. if($info['credittype']=='credits') {
  178. $credittype = lang('core', 'title_credit');
  179. } else {
  180. $extcredits = str_replace('extcredits', '', $info['credittype']);
  181. $credittype = $_G['setting']['extcredits'][$extcredits]['title'];
  182. }
  183. $html .= '<div id="magicreceivegift">';
  184. $html .= '<a onclick="showWindow(\'magicgift\', this.href, \'get\', 0)" href="home.php?mod=spacecp&ac=magic&op=receivegift&uid='.$uid.'" title="'.lang('magic/gift', 'gift_receive_gift', array('percredit'=>$percredit,'credittype'=>$credittype)).'">';
  185. $html .= '<img src="'.STATICURL.'image/magic/gift.gif" alt="gift" />';
  186. $html .= '</a>';
  187. $html .= '</div>';
  188. }
  189. }
  190. }
  191. $html = '<div>'.$html.'</div>';
  192. break;
  193. case 'statistic':
  194. space_merge($space, 'count');
  195. $html .= '<p class="mbm xw1">';
  196. if(empty($parameters['banviews'])) $html .= lang('space', 'space_views', array('views' => $space['views'] ? $space['views'] : '--'));
  197. $html .= '</p><ul class="xl xl2 cl">';
  198. if(empty($parameters['bancredits'])) {
  199. $html .= "<li>".lang('space', 'credits').': <a href="home.php?mod=spacecp&ac=credit">'.($space['credits'] ? $space['credits'] : '--')."</a></li>";
  200. foreach($_G['setting']['extcredits'] as $extcreditid => $extcredit) {
  201. $html .= "<li>".($extcredit['img'] ? $extcredit['img'].' ' : '').$extcredit['title'].': <a href="home.php?mod=spacecp&ac=credit">'.($space['extcredits'.$extcreditid] ? $space['extcredits'.$extcreditid] : '--').'</a>';
  202. }
  203. }
  204. if(empty($parameters['banfriends'])) $html .= "<li>".lang('space', 'friends').': <a href="home.php?mod=space&uid='.$uid.'&do=friend&view=me&from=space">'.($space['friends'] ? $space['friends'] : '--')."</a></li>";
  205. if(empty($parameters['banthreads']) && $_G['setting']['allowviewuserthread'] !== -1 || $_G['adminid'] == 1) {
  206. $html .= "<li>".lang('space', 'threads').': <a href="home.php?mod=space&uid='.$uid.'&do=thread&view=me&from=space">'.($space['threads'] ? $space['threads'] : '--')."</a></li>";
  207. }
  208. if(empty($parameters['banblogs'])) $html .= "<li>".lang('space', 'blogs').': <a href="home.php?mod=space&uid='.$uid.'&do=blog&view=me&from=space">'.($space['blogs'] ? $space['blogs'] : '--')."</a></li>";
  209. if(empty($parameters['banalbums'])) $html .= "<li>".lang('space', 'albums').': <a href="home.php?mod=space&uid='.$uid.'&do=album&view=me&from=space">'.($space['albums'] ? $space['albums'] : '--')."</a></li>";
  210. if(empty($parameters['bansharings'])) $html .= "<li>".lang('space', 'sharings').': <a href="home.php?mod=space&uid='.$uid.'&do=share&view=me&from=space">'.($space['sharings'] ? $space['sharings'] : '--')."</a></li>";
  211. $html .= '</ul>';
  212. $html = '<div>'.$html.'</div>';
  213. break;
  214. case 'doing':
  215. $do = $blockname;
  216. $view = 'me';
  217. $from = 'space';
  218. if(ckprivacy('doing', 'view')) {
  219. $dolist = array();
  220. $query = C::t('home_doing')->fetch_all_by_uid_doid(array($uid), '', 'dateline', 0, $shownum, false, true);
  221. foreach ($query as $value) {
  222. if($value['status'] == 0 || $value['uid'] == $_G['uid']) {
  223. $dolist[] = $value;
  224. }
  225. }
  226. if ($dolist) {
  227. foreach($dolist as $dv) {
  228. $doid = $dv['doid'];
  229. $_GET[key] = $key = random(8);
  230. $html .= "<li class=\"pbn bbda\">";
  231. $html .= $dv['message'];
  232. $html .= "&nbsp;<a href=\"home.php?mod=space&uid=$dv[uid]&do=doing&view=me&from=space&doid=$dv[doid]\" target=\"_blank\" class=\"xg1\">".lang('space', 'block_doing_reply')."</a>";
  233. $html .= "</li>";
  234. }
  235. } else {
  236. $html .= "<p class=\"emp\">".lang('space', 'block_doing_no_content').($space['self'] ? lang('space', 'block_doing_no_content_publish', $space) : '')."</p>";
  237. }
  238. } else {
  239. $html .= "<p class=\"emp\">".lang('space', 'block_view_noperm')."</p>";
  240. }
  241. $html = '<ul class="xl">'.$html.'</ul>';
  242. break;
  243. case 'stickblog' :
  244. space_merge($space, 'profile');
  245. $stickblogs = explode(',', $space['stickblogs']);
  246. if(!empty($stickblogs)) {
  247. $bids = array_slice($stickblogs, 0, $shownum);
  248. if(count($bids)) {
  249. if(!isset($parameters['showmessage'])) $parameters['showmessage'] = 150;
  250. $data_blog = C::t('home_blog')->fetch_all($bids);
  251. if($parameters['showmessage'] > 0) {
  252. $data_blogfield = C::t('home_blogfield')->fetch_all($bids);
  253. }
  254. foreach($data_blog as $curblogid => $value) {
  255. if(ckfriend($value['uid'], $value['friend'], $value['target_ids'])) {
  256. if($parameters['showmessage'] > 0) {
  257. $value = array_merge($value, (array)$data_blogfield[$curblogid]);
  258. }
  259. if($value['pic']) $value['pic'] = pic_cover_get($value['pic'], $value['picflag']);
  260. $value['message'] = $value['friend'] == 4 ? '' : getstr($value['message'], $parameters['showmessage'], 0, 0, 0, -1);
  261. $html .= lang('space', 'blog_li', array(
  262. 'uid' => $value['uid'],
  263. 'blogid' => $value['blogid'],
  264. 'subject' => $value['subject'],
  265. 'date' => dgmdate($value['dateline'],'Y-m-d')));
  266. if(!empty($parameters['showmessage'])) {
  267. if ($value['pic']) {
  268. $html .= lang('space', 'blog_li_img', array(
  269. 'uid' => $value['uid'],
  270. 'blogid' => $value['blogid'],
  271. 'src' => $value['pic']));
  272. }
  273. $html .= "<dd>$value[message]</dd>";
  274. }
  275. $html .= lang('space', 'blog_li_ext', array('uid'=>$value['uid'],'blogid'=>$value['blogid'],'viewnum'=>$value['viewnum'],'replynum'=>$value['replynum']));
  276. $html .= "</dl>";
  277. } else {
  278. $html .= '<p>'.lang('space','block_view_noperm').'</p>';
  279. }
  280. }
  281. }
  282. }
  283. $more = $html ? '<p class="ptm" style="text-align: right;"><a href="home.php?mod=space&uid='.$uid.'&do=blog&view=me&from=space">'.lang('space', 'viewmore').'</a></p>' : '';
  284. $contentclassname = ' xld';
  285. $html = $html.$more;
  286. break;
  287. case 'blog':
  288. $do = $blockname;
  289. $view = 'me';
  290. $from = 'space';
  291. if(!isset($parameters['showmessage'])) $parameters['showmessage'] = 150;
  292. $data_blog = C::t('home_blog')->fetch_all_by_uid($uid, 'dateline', 0, $shownum);
  293. $blogids = array_keys($data_blog);
  294. $data_blogfield = C::t('home_blogfield')->fetch_all($blogids);
  295. foreach($data_blog as $curblogid => $value) {
  296. if(ckfriend($value['uid'], $value['friend'], $value['target_ids'])) {
  297. $value = array_merge($value, (array)$data_blogfield[$curblogid]);
  298. if($value['pic']) $value['pic'] = pic_cover_get($value['pic'], $value['picflag']);
  299. $value['message'] = $value['friend'] == 4 ? '' : getstr($value['message'], $parameters['showmessage'], 0, 0, 0, -1);
  300. $html .= lang('space', 'blog_li', array(
  301. 'uid' => $value['uid'],
  302. 'blogid' => $value['blogid'],
  303. 'subject' => $value['subject'],
  304. 'date' => dgmdate($value['dateline'],'Y-m-d')));
  305. if(!empty($parameters['showmessage'])) {
  306. if ($value['pic']) {
  307. $html .= lang('space', 'blog_li_img', array(
  308. 'uid' => $value['uid'],
  309. 'blogid' => $value['blogid'],
  310. 'src' => $value['pic']));
  311. }
  312. $html .= "<dd>$value[message]</dd>";
  313. }
  314. $html .= lang('space', 'blog_li_ext', array('uid'=>$value['uid'],'blogid'=>$value['blogid'],'viewnum'=>$value['viewnum'],'replynum'=>$value['replynum']));
  315. $html .= "</dl>";
  316. } else {
  317. $html .= '<p>'.lang('space','block_view_noperm').'</p>';
  318. }
  319. }
  320. if($html) {
  321. $more = '<p class="ptm" style="text-align: right;"><a href="home.php?mod=space&uid='.$uid.'&do=blog&view=me&from=space">'.lang('space', 'viewmore').'</a></p>';
  322. } else {
  323. $html = '<p class="emp">'.lang('space','block_blog_no_content').($space['self'] ? lang('space', 'block_blog_no_content_publish', $space) : '').'</p>';
  324. $more = '';
  325. }
  326. $contentclassname = ' xld';
  327. $html = $html.$more;
  328. break;
  329. case 'album':
  330. $do = $blockname;
  331. $view = 'me';
  332. $from = 'space';
  333. if(ckprivacy('album', 'view')) {
  334. $query = C::t('home_album')->fetch_all_by_uid($uid, 'updatetime', 0, $shownum);
  335. foreach($query as $value) {
  336. if(ckfriend($value['uid'], $value['friend'], $value['target_ids'])) {
  337. $value['pic'] = pic_cover_get($value['pic'], $value['picflag']);
  338. $html .= lang('space', 'album_li', array(
  339. 'albumid' =>$value['albumid'],
  340. 'src' => $value['pic'],
  341. 'albumname' => $value['albumname'],
  342. 'uid' => $value['uid'],
  343. 'picnum' => $value['picnum'],
  344. 'date' => dgmdate($value['updatetime'],'n-j')
  345. ));
  346. }
  347. }
  348. if(!$html) {
  349. $html = '<p class="emp">'.lang('space','block_album_no_content').($space['self'] ? lang('space', 'block_album_no_content_publish', $space) : '').'</p>';
  350. }
  351. } else {
  352. $html .= '<li>'.lang('space','block_view_noperm').'</li>';
  353. }
  354. $html = '<ul class="ml cl">'.$html.'</ul>';
  355. break;
  356. case 'feed':
  357. $do = 'home';
  358. $view = 'me';
  359. $from = 'space';
  360. if(!IS_ROBOT && ckprivacy('feed', 'view')) {
  361. require_once libfile('function/feed');
  362. $query = C::t('home_feed')->fetch_all_by_uid_dateline($uid, false, 0, $shownum);
  363. foreach($query as $value) {
  364. if(ckfriend($value['uid'], $value['friend'], $value['target_ids'])) {
  365. $html .= mkfeedhtml(mkfeed($value));
  366. }
  367. }
  368. }
  369. $contenttagname = 'ul';
  370. $contentclassname = ' el';
  371. $html = !$html ? '<p class="emp">'.lang('space','block_feed_no_content').'</p>' : $html;
  372. break;
  373. case 'thread':
  374. $do = $blockname;
  375. $view = 'me';
  376. $from = 'space';
  377. if ($_G['setting']['allowviewuserthread'] !== -1) {
  378. $fidsql = empty($_G['setting']['allowviewuserthread']) ? '' : " AND fid IN({$_G[setting][allowviewuserthread]}) ";
  379. $viewfids = str_replace("'", '', $_G['setting']['allowviewuserthread']);
  380. if(!empty($viewfids)) {
  381. $viewfids = explode(',', $viewfids);
  382. }
  383. foreach(C::t('forum_thread')->fetch_all_by_authorid_displayorder($uid, 0, '>=', null, '', 0, $shownum) as $thread) {
  384. if(!empty($viewfids) && $_G['adminid'] != 1 && !in_array($thread['fid'], $viewfids)) {
  385. continue;
  386. }
  387. if($thread['author']) {
  388. $html .= "<li><a href=\"forum.php?mod=viewthread&tid={$thread['tid']}\" target=\"_blank\">{$thread['subject']}</a></li>";
  389. }
  390. }
  391. }
  392. $html = !$html ? '<p class="emp">'.lang('space','block_thread_no_content').($space['self'] ? lang('space', 'block_thread_no_content_publish', $space) : '').'</p>' : '<ul class="xl">'.$html.'</ul>';
  393. break;
  394. case 'friend':
  395. $do = $blockname;
  396. $view = 'me';
  397. $from = 'space';
  398. require_once libfile('function/friend');
  399. $friendlist = array();
  400. $friendlist = friend_list($uid, $shownum);
  401. $fuids = array_keys($friendlist);
  402. getonlinemember($fuids);
  403. foreach ($friendlist as $key => $value) {
  404. $classname = $_G['ols'][$value['fuid']]?'gol':'';
  405. $html .= '<li><a href="home.php?mod=space&uid='.$value['fuid'].'" target="_blank" class="avt"><em class="'.$classname.'"></em>'.avatar($value['fuid'],'small').'</a><p><a href="home.php?mod=space&uid='.$value[fuid].'" target="_blank">'.$value['fusername'].'</a></p></li>';
  406. }
  407. $html = !$html ? '<p class="emp">'.lang('space','block_friend_no_content').($space['self'] ? lang('space', 'block_friend_no_content_publish', $space) : '').'</p>' : '<ul class="ml mls cl">'.$html.'</ul>';
  408. break;
  409. case 'visitor':
  410. if($space['self']) {
  411. $do = 'friend';
  412. $view = 'visitor';
  413. }
  414. $list = $fuids = array();
  415. foreach(C::t('home_visitor')->fetch_all_by_uid($uid, $shownum) as $value) {
  416. $list[] = $value;
  417. $fuids[] = $value['vuid'];
  418. }
  419. getonlinemember($fuids);
  420. foreach($list as $value) {
  421. $html .= "<li>";
  422. if ($value['vusername'] == '') {
  423. $html .= lang('space', 'visitor_anonymity');
  424. } else {
  425. $html .= lang('space', 'visitor_list', array(
  426. 'uid' => $value['vuid'],
  427. 'cuid' => $uid,
  428. 'username' => $value['vusername'],
  429. 'class' => ($_G['ols'][$value['vuid']]?'gol':''),
  430. 'self' => $value['vuid'] == $_G['uid'] ? 'god' : '',
  431. 'avatar' => avatar($value['vuid'],'small')));
  432. }
  433. $html .= "<span class=\"xg2\">".dgmdate($value['dateline'],'u', '9999', 'Y-m-d')."</span>";
  434. $html .= "</li>";
  435. }
  436. $html = !$html ? '<p class="emp">'.lang('space','block_visitor_no_content').($space['self'] ? lang('space', 'block_visitor_no_content_publish', $space) : '').'</p>' : '<ul class="ml mls cl">'.$html.'</ul>';
  437. break;
  438. case 'share':
  439. $do = $blockname;
  440. $view = 'me';
  441. $from = 'space';
  442. if(!IS_ROBOT && ckprivacy('share', 'view')) {
  443. require_once libfile('function/share');
  444. foreach(C::t('home_share')->fetch_all_by_uid($uid, 0, $shownum) as $value) {
  445. $value = mkshare($value);
  446. $html .= '<li><em><a href="home.php?mod=space&uid='.$value['uid'].'&do=share&id='.$value['sid'].'">'.$value['title_template'].'</a>('.dgmdate($value['dateline'], 'u').')</em><div class="ec cl">';
  447. if ($value['image']) {
  448. $html .= '<a href="'.$value['image_link'].'" target="_blank"><img src="'.$value['image'].'" class="tn" alt="" /></a>';
  449. }
  450. $html .= '<div class="d">'.$value['body_template'].'</div>';
  451. if ($value['type'] == 'video') {
  452. if(!empty($value['body_data']['imgurl'])) {
  453. $html .= '<table class="mtm" title="'.lang('space', 'click_play').'" onclick="javascript:showFlash(\''.$value['body_data']['host'].'\', \''.$value['body_data']['flashvar'].'\', this, \''.$value['sid'].'\');"><tr><td class="vdtn hm" style="background: url('.$value['body_data']['imgurl'].') no-repeat"><img src="'.STATICURL.'/image/common/vds.png" alt="'.lang('space', 'click_play').'" /></td></tr></table>';
  454. } else {
  455. $html .= "<img src=\"".STATICURL."/image/common/vd.gif\" alt=\"".lang('space', 'click_play')."\" onclick=\"javascript:showFlash('{$value['body_data']['host']}', '{$value['body_data']['flashvar']}', this, '{$value['sid']}');\" class=\"tn\" />";
  456. }
  457. }elseif ($value['type'] == 'music') {
  458. $html .= "<img src=\"".STATICURL."/image/common/music.gif\" alt=\"".lang('space', 'click_play')."\" onclick=\"javascript:showFlash('music', '{$value['body_data']['musicvar']}', this, '{$value['sid']}');\" class=\"tn\" />";
  459. }elseif ($value['type'] == 'flash') {
  460. $html .= "<img src=\"".STATICURL."/image/common/flash.gif\" alt=\"".lang('space', 'click_view')."\" onclick=\"javascript:showFlash('flash', '{$value['body_data']['flashaddr']}', this, '{$value['sid']}');\" class=\"tn\" />";
  461. }
  462. if ($value['body_general']) {
  463. $html .= '<div class="quote'.($value['image'] ? 'z' : '')."\"><blockquote>$value[body_general]</blockquote></div>";
  464. }
  465. $html .= '</div></li>';
  466. }
  467. $html = !$html ? '<p class="emp">'.lang('space','block_share_no_content').'</p>' : '<ul class="el">'.$html.'</ul>';
  468. }
  469. break;
  470. case 'wall':
  471. $do = $blockname;
  472. $walllist = array();
  473. if(ckprivacy('wall', 'view')) {
  474. $query = C::t('home_comment')->fetch_all_by_id_idtype($uid, 'uid', 0, $shownum, '', 'DESC');
  475. foreach($query as $value) {
  476. $value['message'] = strlen($value['message'])>500? getstr($value['message'], 500, 0, 0, 0, -1).' ...':$value['message'];
  477. if($value['status'] == 0 || $value['authorid'] == $_G['uid']) {
  478. $walllist[] = $value;
  479. }
  480. }
  481. }
  482. foreach ($walllist as $key => $value) {
  483. $op = '';
  484. if ($value['author']) {
  485. $author_avatar = '<a href="home.php?mod=space&uid='.$value['authorid'].'" target="_blank">'.avatar($value['authorid'],'small').'</a>';
  486. $author = '<a href="home.php?mod=space&uid='.$value['authorid'].'" id="author_'.$value['cid'].'" target="_blank">'.$value['author'].'</a>';
  487. }else {
  488. $author_avatar = '<img src="static/image/magic/hidden.gif" alt="hidden" />';
  489. $author = $_G['setting']['anonymoustext'];
  490. }
  491. if ($value['authorid']==$_G['uid']) {
  492. $op .= lang('space', 'wall_edit', array('cid'=>$value['cid']));
  493. }
  494. if ($value['authorid']==$_G['uid'] || $space['self'] || checkperm('managecomment')){
  495. $op .= lang('space', 'wall_del', array('cid'=>$value['cid']));
  496. }
  497. if ($value['authorid']!=$_G['uid'] && ($value['idtype'] != 'uid' || $space['self'])) {
  498. $op .= lang('space', 'wall_reply', array('cid'=>$value['cid']));
  499. }
  500. $moderate_need = $value['status'] == 1 ? lang('template', 'moderate_need') : '';
  501. $date = dgmdate($value['dateline'], 'u');
  502. $replacearr = array('author'=>$author, 'author_avatar' => $author_avatar, 'moderated' => $moderate_need, 'cid' => $value['cid'], 'message'=> $value['message'] , 'date' => $date, 'op'=> $op);
  503. $html .= lang('space', 'wall_li', $replacearr);
  504. }
  505. $html = !empty($walllist) ? $html.lang('space', 'wall_more', array('uid'=>$uid)) : '<p class="emp">'.lang('space','block_wall_no_content').'</p>';
  506. $html = '<div class="xld xlda el" id="comment_ul">'.$html.'</div>';
  507. if(helper_access::check_module('wall')) {
  508. $html = lang('space', 'wall_form', array('uid' => $uid, 'FORMHASH'=>FORMHASH)).'<hr class="da mtm m0">'.$html;
  509. }
  510. $titlemore = '<span class="y xw0"><a href="home.php?mod=space&uid='.$uid.'&do=wall">'.lang('space', 'all').'</a></span>';
  511. break;
  512. case 'group':
  513. require_once libfile('function/group');
  514. $grouplist = mygrouplist($uid, 'lastupdate', array('f.name', 'ff.icon'), $shownum);
  515. if(empty($grouplist)) $grouplist = array();
  516. foreach ($grouplist as $groupid => $group) {
  517. $group['groupid'] = $groupid;
  518. $html .= lang('space', 'group_li',$group);
  519. }
  520. $html = !$html ? '<p class="emp">'.lang('space','block_group_no_content').($space['self'] ? lang('space', ($_G['group']['allowbuildgroup'] ? 'block_group_no_content_publish' : 'block_group_no_content_join'), $space) : '').'</p>' : '<ul class="ml mls cl">'.$html.'</ul>';
  521. break;
  522. case 'music':
  523. if(!empty($parameters['mp3list'])) {
  524. $authcode = substr(md5($_G['authkey'].$uid), 6, 16);
  525. $view = ($_G['adminid'] == 1 && $_G['setting']['allowquickviewprofile']) ? '&view=admin' : '';
  526. $querystring = urlencode("home.php?mod=space&uid=$uid&do=index&op=getmusiclist&hash=$authcode$view&t=".TIMESTAMP);
  527. $swfurl = STATICURL.'image/common/mp3player.swf?config='.$querystring;
  528. if(empty($parameters['config']['height']) && $parameters['config']['height'] !== 0) {
  529. $parameters['config']['height'] = '200px';
  530. } else {
  531. $parameters['config']['height'] .= 'px';
  532. }
  533. $html = "<script language=\"javascript\" type=\"text/javascript\">document.write(AC_FL_RunContent('id', 'mp3player', 'name', 'mp3player', 'devicefont', 'false', 'width', '100%', 'height', '".$parameters['config']['height']."', 'src', '$swfurl', 'menu', 'false', 'allowScriptAccess', 'never', 'swLiveConnect', 'true', 'wmode', 'transparent'));</script>";
  534. } else {
  535. $html = lang('space', 'music_no_content');
  536. }
  537. $html = '<div class="ml mls cl">'.$html.'</div>';
  538. break;
  539. case 'myapp':
  540. $html = '';
  541. $listclass = 'ptm ml mls cl';
  542. $userapps = C::t('home_userapp')->fetch_all_by_uid_appid($uid, 0, 'menuorder', 'DESC', 0, $shownum);
  543. $appids = array();
  544. foreach($userapps as $app) {
  545. $appids[$app['appid']] = $app['appid'];
  546. }
  547. if(!empty($appids)) {
  548. $myapps = C::t('common_myapp')->fetch_all($appids);
  549. }
  550. foreach($userapps as $value) {
  551. $value['iconstatus'] = $myapps[$value['appid']]['iconstatus'];
  552. if(!empty($value['appname'])) {
  553. $replace = array('appid'=>$value['appid'], 'appname'=>$value['appname']);
  554. $parameters['logotype'] = !empty($parameters['logotype']) && in_array($parameters['logotype'], array('icon', 'logo')) ? $parameters['logotype'] : 'logo';
  555. if($parameters['logotype'] == 'icon') {
  556. $listclass = 'xl xl1 cl';
  557. $replace['icon'] = getmyappiconpath($value['appid'], $value['iconstatus']);
  558. }
  559. $html .= lang('space', 'myapp_li_'.$parameters['logotype'], $replace);
  560. }
  561. }
  562. $html = !$html ? '<p class="emp">'.lang('space','block_myapp_no_content').($space['self'] ? lang('space', 'block_myapp_no_content_publish', $space) : '').'</p>' : '<ul class="'.$listclass.'">'.$html.'</ul>';
  563. break;
  564. case 'block1':
  565. case 'block2':
  566. case 'block3':
  567. case 'block4':
  568. case 'block5':
  569. if($space['self']) {
  570. $_G['space_group'] = $_G['group'];
  571. } elseif(empty($_G['space_group'])) {
  572. $_G['space_group'] = C::t('common_usergroup_field')->fetch($space['groupid']);
  573. }
  574. require_once libfile('function/discuzcode');
  575. if ($_G['space_group']['allowspacediyimgcode']) {
  576. if (empty($_G['cache']['smilies']['loaded'])) {
  577. loadcache(array('smilies', 'smileytypes'));
  578. foreach($_G['cache']['smilies']['replacearray'] AS $skey => $smiley) {
  579. $_G['cache']['smilies']['replacearray'][$skey] = '[img]'.$_G['siteurl'].'static/image/smiley/'.$_G['cache']['smileytypes'][$_G['cache']['smilies']['typearray'][$skey]]['directory'].'/'.$smiley.'[/img]';
  580. }
  581. $_G['cache']['smilies']['loaded'] = 1;
  582. }
  583. $parameters['content'] = preg_replace($_G['cache']['smilies']['searcharray'], $_G['cache']['smilies']['replacearray'], trim($parameters['content']));
  584. }
  585. if ($_G['space_group']['allowspacediybbcode'] || $_G['space_group']['allowspacediyimgcode'] || $_G['space_group']['allowspacediyhtml'] ){
  586. $parameters['content'] = discuzcode($parameters['content'], 1, 0, 1, 0, $_G['space_group']['allowspacediybbcode'], $_G['space_group']['allowspacediyimgcode'], $_G['space_group']['allowspacediyhtml']);
  587. } else {
  588. $parameters['content'] = dhtmlspecialchars($parameters['content']);
  589. }
  590. $parameters['content'] = nl2br($parameters['content']);
  591. if (empty ($parameters['content'])) $parameters['content'] = lang('space',$blockname);
  592. $html .= $parameters['content'];
  593. break;
  594. default:
  595. return false;
  596. }
  597. if (isset($parameters['title'])) {
  598. if(empty($parameters['title'])) {
  599. $title = '';
  600. } else {
  601. $view = $view === false ? '' : '&view='.$view;
  602. $from = $from === false ? '' : '&from='.$from;
  603. $bnamelink = $do ? '<a href="home.php?mod=space&uid='.$uid.'&do='.$do.$view.$from.'">'.$parameters['title'].'</a>' : $parameters['title'];
  604. $title = lang('space', 'block_title', array('bname' => $bnamelink, 'more' => $titlemore));
  605. }
  606. } else {
  607. $view = $view === false ? '' : '&view='.$view;
  608. $from = $from === false ? '' : '&from='.$from;
  609. $bnamelink = $do ? '<a href="home.php?mod=space&uid='.$uid.'&do='.$do.$view.$from.'">'.getblockdata($blockname).'</a>' : getblockdata($blockname);
  610. $title = lang('space', 'block_title', array('bname' => $bnamelink, 'more' => $titlemore));
  611. }
  612. $html = $title.'<'.$contenttagname.' id="'.$blockname.'_content" class="dxb_bc'.$contentclassname.'">'.$html.'</'.$contenttagname.'>';
  613. return $html;
  614. }
  615. function mkfeedhtml($value) {
  616. global $_G;
  617. $_GET['uid'] = intval($_GET['uid']);
  618. $_GET['view'] = dhtmlspecialchars($_GET['view']);
  619. $html = '';
  620. $html .= "<li class=\"cl $value[magic_class]\" id=\"feed_{$value[feedid]}_li\">";
  621. $html .= "<div class=\"cl\" {$value[style]}>";
  622. $html .= "<a class=\"t\" href=\"home.php?mod=space&uid=$_GET[uid]&do=home&view=$_GET[view]&appid=$value[appid]&icon=$value[icon]\" title=\"".lang('space', 'feed_view_only')."\"><img src=\"$value[icon_image]\" /></a>$value[title_template]";
  623. $html .= "\t<span class=\"xg1\">".dgmdate($value[dateline], 'n-j H:i')."</span>";
  624. $html .= "<div class=\"ec\">";
  625. if ($value['image_1']) {
  626. $html .= "<a href=\"$value[image_1_link]\"{$value[target]}><img src=\"$value[image_1]\" alt=\"\" class=\"tn\" /></a>";
  627. }
  628. if ($value['image_2']) {
  629. $html .= "<a href=\"$value[image_2_link]\"{$value[target]}><img src=\"$value[image_2]\" alt=\"\" class=\"tn\" /></a>";
  630. }
  631. if ($value['image_3']) {
  632. $html .= "<a href=\"$value[image_3_link]\"{$value[target]}><img src=\"$value[image_3]\" alt=\"\" class=\"tn\" /></a>";
  633. }
  634. if ($value['image_4']) {
  635. $html .= "<a href=\"$value[image_4_link]\"{$value[target]}><img src=\"$value[image_4]\" alt=\"\" class=\"tn\" /></a>";
  636. }
  637. if ($value['body_template']) {
  638. $style = $value['image_3'] ? ' style="clear: both; zoom: 1;"' : '';
  639. $html .= "<div class=\"d\" $style>$value[body_template]</div>";
  640. }
  641. if (!empty($value['body_data']['flashvar'])) {
  642. if(!empty($value['body_data']['imgurl'])) {
  643. $html .= '<table class="mtm" title="'.lang('space', 'click_play').'" onclick="javascript:showFlash(\''.$value['body_data']['host'].'\', \''.$value['body_data']['flashvar'].'\', this, \''.$value['sid'].'\');"><tr><td class="vdtn hm" style="background: url('.$value['body_data']['imgurl'].') no-repeat"><img src="'.STATICURL.'/image/common/vds.png" alt="'.lang('space', 'click_play').'" /></td></tr></table>';
  644. } else {
  645. $html .= "<img src=\"".STATICURL."/image/common/vd.gif\" alt=\"".lang('space', 'click_play')."\" onclick=\"javascript:showFlash('{$value['body_data']['host']}', '{$value['body_data']['flashvar']}', this, '{$value['sid']}');\" class=\"tn\" />";
  646. }
  647. }elseif (!empty($value['body_data']['musicvar'])) {
  648. $html .= "<img src=\"".STATICURL."/image/common/music.gif\" alt=\"".lang('space', 'click_play')."\" onclick=\"javascript:showFlash('music', '{$value['body_data']['musicvar']}', this, '{$value['feedid']}');\" class=\"tn\" />";
  649. }elseif (!empty($value['body_data']['flashaddr'])) {
  650. $html .= "<img src=\"".STATICURL."/image/common/flash.gif\" alt=\"".lang('space', 'click_view')."\" onclick=\"javascript:showFlash('flash', '{$value['body_data']['flashaddr']}', this, '{$value['feedid']}');\" class=\"tn\" />";
  651. }
  652. if ($value['body_general']) {
  653. $classname = $value['image_1'] ? ' z' : '';
  654. $html .= "<div class=\"quote$classname\"><blockquote>$value[body_general]</blockquote></div>";
  655. }
  656. $html .= "</div>";
  657. $html .= "</div>";
  658. $html .= "</li>";
  659. return $html;
  660. }
  661. function &getlayout($layout='') {
  662. $layoutarr = array(
  663. '1:2:1' => array('240', '480', '240'),
  664. '1:1:2' => array('240', '240', '480'),
  665. '2:1:1' => array('480', '240', '240'),
  666. '2:2' => array('480', '480'),
  667. '1:3' => array('240', '720'),
  668. '3:1' => array('720', '240'),
  669. '1:4' => array('190', '770'),
  670. '4:1' => array('770', '190'),
  671. '2:2:1' => array('385', '385', '190'),
  672. '1:2:2' => array('190', '385', '385'),
  673. '1:1:3' => array('190', '190', '570'),
  674. '1:3:1' => array('190', '570', '190'),
  675. '3:1:1' => array('570', '190', '190'),
  676. '3:2' => array('575', '385'),
  677. '2:3' => array('385', '575')
  678. );
  679. if (!empty($layout)) {
  680. $rt = (isset($layoutarr[$layout])) ? $layoutarr[$layout] : false;
  681. } else {
  682. $rt = $layoutarr;
  683. }
  684. return $rt;
  685. }
  686. function getblockdata($blockname = '') {
  687. $blockarr = lang('space', 'blockdata');
  688. $r = empty($blockname) ? $blockarr : (isset($blockarr[$blockname]) ? $blockarr[$blockname] : false);
  689. return $r;
  690. }
  691. function check_ban_block($blockname, $space) {
  692. global $_G;
  693. $return = true;
  694. loadcache('usergroup_'.$space['groupid']);
  695. if($blockname == 'group' && !helper_access::check_module('group')) {
  696. $return = false;
  697. } elseif($blockname == 'thread' && $_G['setting']['allowviewuserthread'] === -1) {
  698. $return = false;
  699. } elseif($blockname == 'myapp') {
  700. loadcache('usergroup_'.$space['groupid']);
  701. if(empty($_G['setting']['my_app_status']) || empty($_G['cache']['usergroup_'.$space['groupid']]['allowmyop'])) {
  702. $return = false;
  703. }
  704. }
  705. return $return;
  706. }
  707. ?>