home.ctrl.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. /**
  3. * [WeEngine System] Copyright (c) 2014 WE7.CC
  4. * WeEngine is NOT a free software, it under the license terms, visited http://www.we7.cc/ for more details.
  5. */
  6. defined('IN_IA') or exit('Access Denied');
  7. load()->model('app');
  8. $dos = array('display', 'login_out');
  9. $do = in_array($do, $dos) ? $do : 'display';
  10. load()->func('tpl');
  11. $card_setting = pdo_get('mc_card', array('uniacid' => $_W['uniacid']));
  12. $uni_setting = pdo_get('uni_settings', array('uniacid' => $_W['uniacid']), array('exchange_enable'));
  13. $setting = uni_setting_load(array('uc', 'passport'), $_W['uniacid']);
  14. if($do == 'login_out') {
  15. unset($_SESSION);
  16. session_destroy();
  17. isetcookie('logout', 1, 60);
  18. $logoutjs = "<script language=\"javascript\" type=\"text/javascript\">window.location.href=\"" . url('auth/login/') . "\";</script>";
  19. exit($logoutjs);
  20. }
  21. if ($do == 'display') {
  22. $navs = app_navs('profile');
  23. $modules = uni_modules();
  24. $groups = $others = array();
  25. $reg = '/^tel:(\d+)$/';
  26. if(!empty($navs)) {
  27. foreach($navs as $row) {
  28. $row['url'] = tourl($row['url']);
  29. if(!empty($row['module'])) {
  30. $groups[$row['module']][] = $row;
  31. } else {
  32. $others[] = $row;
  33. }
  34. }
  35. }
  36. $profile = mc_fetch($_W['member']['uid'], array('nickname', 'avatar', 'mobile', 'groupid'));
  37. $mcgroups = mc_groups();
  38. $profile['group'] = $mcgroups[$profile['groupid']];
  39. if(isset($setting['uc']['status']) && $setting['uc']['status'] == '1') {
  40. $uc = $setting['uc'];
  41. $sql = 'SELECT * FROM ' . tablename('mc_mapping_ucenter') . ' WHERE `uniacid`=:uniacid AND `uid`=:uid';
  42. $pars = array();
  43. $pars[':uniacid'] = $_W['uniacid'];
  44. $pars[':uid'] = $_W['member']['uid'];
  45. $mapping = pdo_fetch($sql, $pars);
  46. if(empty($mapping)) {
  47. } else {
  48. mc_init_uc();
  49. $u = uc_get_user($mapping['centeruid'], true);
  50. $ucUser = array(
  51. 'uid' => $u[0],
  52. 'username' => $u[1],
  53. 'email' => $u[2]
  54. );
  55. }
  56. }
  57. if (empty($setting['passport']['focusreg'])) {
  58. $reregister = false;
  59. if ($_W['member']['email'] == md5($_W['openid']).'@we7.cc') {
  60. $reregister = true;
  61. }
  62. }
  63. }
  64. template('mc/home');