国内流行的内容管理系统(CMS)多端全媒体解决方案 https://www.dedebiz.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

135 lines
4.8KB

  1. <?php
  2. /**
  3. * 空间配置
  4. *
  5. * @version $Id: config_space.php 1 13:52 2010年7月9日Z tianya $
  6. * @package DedeBIZ.Member
  7. * @copyright Copyright (c) 2022, DedeBIZ.COM
  8. * @license https://www.dedebiz.com/license
  9. * @link https://www.dedebiz.com
  10. */
  11. if (!defined('DEDEMEMBER')) exit('dedebiz');
  12. //检查是否开放会员功能
  13. if ($cfg_mb_open == 'N') {
  14. ShowMsg("系统关闭了会员功能,因此您无法访问此页面", "javascript:;");
  15. exit();
  16. }
  17. //对uid进行过滤
  18. if (preg_match("/'/", $uid)) {
  19. ShowMsg("您的用户名中含有非法字符", "-1");
  20. exit();
  21. } else {
  22. $uid = RemoveXSS($uid);
  23. }
  24. $_vars = GetUserSpaceInfos();
  25. $_vars['bloglinks'] = $_vars['curtitle'] = '';
  26. //---------------------------
  27. //用户权限检查
  28. //被禁言用户
  29. if ($_vars['spacesta'] == -2) {
  30. ShowMsg("用户:{$_vars['userid']} 被禁言,因此个人空间禁止访问", "-1");
  31. exit();
  32. }
  33. //未审核用户
  34. if ($_vars['spacesta'] < 0) {
  35. ShowMsg("用户:{$_vars['userid']} 的资料尚未通过审核,因此空间禁止访问", "-1");
  36. exit();
  37. }
  38. //是否禁止了管理员空间的访问
  39. if (!isset($_vars['matt'])) $_vars['matt'] = 0;
  40. if (
  41. $_vars['matt'] == 10 && $cfg_mb_adminlock == 'Y'
  42. && !(isset($cfg_ml->fields) && $cfg_ml->fields['matt'] == 10)
  43. ) {
  44. ShowMsg('系统设置了禁止访问管理员的个人空间', '-1');
  45. exit();
  46. }
  47. //---------------------------
  48. //默认风格
  49. if ($_vars['spacestyle'] == '') {
  50. if ($_vars['mtype'] == '个人') {
  51. $_vars['spacestyle'] = 'person';
  52. } else if ($_vars['mtype'] == '企业') {
  53. $_vars['spacestyle'] = 'company';
  54. } else {
  55. $_vars['spacestyle'] = 'person';
  56. }
  57. }
  58. //找不到指定样式文件夹的时候使用person为默认
  59. if (!is_dir(DEDEMEMBER.'/space/'.$_vars['spacestyle'])) {
  60. $_vars['spacestyle'] = 'person';
  61. }
  62. //获取分类数据
  63. $mtypearr = array();
  64. $dsql->Execute('mty', "select * from `#@__mtypes` where mid='".$_vars['mid']."'");
  65. while ($row = $dsql->GetArray('mty')) {
  66. $mtypearr[] = $row;
  67. }
  68. //获取栏目导航数据
  69. $_vars['bloglinks'] = array();
  70. $query = "SELECT tp.channeltype,ch.typename FROM `#@__arctype` tp
  71. LEFT JOIN `#@__channeltype` ch on ch.id=tp.channeltype
  72. WHERE (ch.usertype='' OR ch.usertype LIKE '{$_vars['mtype']}') And tp.channeltype<>1 And tp.issend=1 And tp.ishidden=0 GROUP BY tp.channeltype ORDER BY ABS(tp.channeltype) asc";
  73. $dsql->Execute('ctc', $query);
  74. while ($row = $dsql->GetArray('ctc')) {
  75. $_vars['bloglinks'][$row['channeltype']] = $row['typename'];
  76. }
  77. //获取企业用户私有数据
  78. if ($_vars['mtype'] == '企业') {
  79. require_once(DEDEINC.'/enums.func.php');
  80. $query = "SELECT * FROM `#@__member_company` WHERE mid='".$_vars['mid']."'";
  81. $company = $db->GetOne($query);
  82. $company['vocation'] = GetEnumsValue('vocation', $company['vocation']);
  83. $company['cosize'] = GetEnumsValue('cosize', $company['cosize']);
  84. $tmpplace = GetEnumsTypes($company['place']);
  85. $provinceid = $tmpplace['top'];
  86. $provincename = (isset($em_nativeplaces[$provinceid]) ? $em_nativeplaces[$provinceid] : '');
  87. $cityname = (isset($em_nativeplaces[$tmpplace['son']]) ? $em_nativeplaces[$tmpplace['son']] : '');
  88. $company['place'] = $provincename.' - '.$cityname;
  89. $_vars = array_merge($company, $_vars);
  90. if ($action == 'infos') $action = 'introduce';
  91. $_vars['comface'] = empty($_vars['comface']) ? 'images/comface.png' : $_vars['comface'];
  92. }
  93. /**
  94. * 获取空间基本信息
  95. *
  96. * @return unknown
  97. */
  98. function GetUserSpaceInfos()
  99. {
  100. global $dsql, $uid, $cfg_memberurl;
  101. $_vars = array();
  102. $userid = preg_replace("#[\r\n\t \*%]#", '', $uid);
  103. $query = "SELECT m.mid,m.mtype,m.userid,m.uname,m.sex,m.rank,m.email,m.scores,
  104. m.spacesta,m.face,m.logintime,
  105. s.*,t.*,m.matt,r.membername,g.msg
  106. From `#@__member` m
  107. LEFT JOIN `#@__member_space` s on s.mid=m.mid
  108. LEFT JOIN `#@__member_tj` t on t.mid=m.mid
  109. LEFT JOIN `#@__arcrank` r on r.rank=m.rank
  110. where m.userid like '$uid' ORDER BY g.dtime DESC ";
  111. $_vars = $dsql->GetOne($query);
  112. if (!is_array($_vars)) {
  113. ShowMsg("您访问的用户可能已经被删除", "javascript:;");
  114. exit();
  115. }
  116. if ($_vars['face'] == '') {
  117. $_vars['face'] = ($_vars['sex'] == '女') ? 'templets/images/dfgirl.png' : 'templets/images/dfboy.png';
  118. }
  119. $_vars['userid_e'] = urlencode($_vars['userid']);
  120. $_vars['userurl'] = $cfg_memberurl."/index.php?uid=".$_vars['userid_e'];
  121. if ($_vars['membername'] == '开放浏览') $_vars['membername'] = '限制会员';
  122. return $_vars;
  123. }