public static function manage_addnotify($type, $from_num = 0, $langvar = array()) { global $_G; $notifyusers = dunserialize($_G['setting']['notifyusers']); $notifytypes = explode(',', $_G['setting']['adminnotifytypes']); $notifytypes = array_flip($notifytypes); $notearr = array('from_id' => 1, 'from_idtype' => $type, 'from_num' => $from_num); if ($langvar) { $langkey = $langvar['langkey']; $notearr = array_merge($notearr, $langvar); } else { $langkey = 'manage_' . $type; } foreach ($notifyusers as $uid => $user) { if ($user['types'][$notifytypes[$type]]) { helper_notification::notification_add($uid, $type, $langkey, $notearr, 1); } } }
function manage_addnotify($type, $from_num = 0, $langvar = array()) { helper_notification::manage_addnotify($type, $from_num, $langvar); }
} if (helper_access::check_module('follow')) { $followerlist = C::t('home_follow')->fetch_all_following_by_uid($uid, 0, 9); } $seccodecheck = $_G['setting']['seccodestatus'] & 4 && (!$_G['setting']['seccodedata']['minposts'] || getuserprofile('posts') < $_G['setting']['seccodedata']['minposts']); $secqaacheck = $_G['setting']['secqaa']['status'] & 2 && (!$_G['setting']['secqaa']['minposts'] || getuserprofile('posts') < $_G['setting']['secqaa']['minposts']); } elseif ($do == 'follower') { $count = C::t('home_follow')->count_follow_user($uid, 1); if ($viewself && !empty($_G['member']['newprompt_num']['follower'])) { $newfollower = C::t('home_notification')->fetch_all_by_uid($uid, -1, 'follower', 0, $_G['member']['newprompt_num']['follower']); $newfollower_list = array(); foreach ($newfollower as $val) { $newfollower_list[] = $val['from_id']; } C::t('home_notification')->delete_by_type('follower', $_G['uid']); helper_notification::update_newprompt($_G['uid'], 'follower'); } if ($count) { $list = C::t('home_follow')->fetch_all_follower_by_uid($uid, $start, $perpage); $multi = multi($count, $perpage, $page, $theurl); } if (helper_access::check_module('follow')) { $followerlist = C::t('home_follow')->fetch_all_following_by_uid($uid, 0, 9); } $navactives = array($do => ' class="a"'); } elseif ($do == 'following') { $count = C::t('home_follow')->count_follow_user($uid); if ($count) { $status = $_GET['status'] ? 1 : 0; $list = C::t('home_follow')->fetch_all_following_by_uid($uid, $status, $start, $perpage); $multi = multi($count, $perpage, $page, $theurl);
private function _init_user() { if ($this->init_user) { if ($auth = getglobal('auth', 'cookie')) { $auth = daddslashes(explode("\t", authcode($auth, 'DECODE'))); } list($discuz_pw, $discuz_uid) = empty($auth) || count($auth) < 2 ? array('', '') : $auth; if ($discuz_uid) { $user = getuserbyuid($discuz_uid, 1); } if (!empty($user) && $user['password'] == $discuz_pw) { if (isset($user['_inarchive'])) { C::t('common_member_archive')->move_to_master($discuz_uid); } $this->var['member'] = $user; } else { $user = array(); $this->_init_guest(); } if ($user && $user['groupexpiry'] > 0 && $user['groupexpiry'] < TIMESTAMP) { $memberfieldforum = C::t('common_member_field_forum')->fetch($discuz_uid); $groupterms = dunserialize($memberfieldforum['groupterms']); if (!empty($groupterms['main'])) { C::t("common_member")->update($user['uid'], array('groupexpiry' => 0, 'groupid' => $groupterms['main']['groupid'], 'adminid' => $groupterms['main']['adminid'])); $user['groupid'] = $groupterms['main']['groupid']; $user['adminid'] = $groupterms['main']['adminid']; unset($groupterms['main'], $groupterms['ext'][$this->var['member']['groupid']]); $this->var['member'] = $user; C::t('common_member_field_forum')->update($discuz_uid, array('groupterms' => serialize($groupterms))); } elseif ((getgpc('mod') != 'spacecp' || CURSCRIPT != 'home') && CURSCRIPT != 'member') { dheader('location: home.php?mod=spacecp&ac=usergroup&do=expiry'); } } if ($user && $user['freeze'] && (getgpc('mod') != 'spacecp' && getgpc('mod') != 'misc' || CURSCRIPT != 'home') && CURSCRIPT != 'member' && CURSCRIPT != 'misc') { dheader('location: home.php?mod=spacecp&ac=profile&op=password'); } $this->cachelist[] = 'usergroup_' . $this->var['member']['groupid']; if ($user && $user['adminid'] > 0 && $user['groupid'] != $user['adminid']) { $this->cachelist[] = 'admingroup_' . $this->var['member']['adminid']; } } else { $this->_init_guest(); } setglobal('groupid', getglobal('groupid', 'member')); !empty($this->cachelist) && loadcache($this->cachelist); if ($this->var['member'] && $this->var['group']['radminid'] == 0 && $this->var['member']['adminid'] > 0 && $this->var['member']['groupid'] != $this->var['member']['adminid'] && !empty($this->var['cache']['admingroup_' . $this->var['member']['adminid']])) { $this->var['group'] = array_merge($this->var['group'], $this->var['cache']['admingroup_' . $this->var['member']['adminid']]); } if ($this->var['group']['allowmakehtml'] && isset($_GET['_makehtml'])) { $this->var['makehtml'] = 1; $this->_init_guest(); loadcache(array('usergroup_7')); $this->var['group'] = $this->var['cache']['usergroup_7']; unset($this->var['inajax']); } if (empty($this->var['cookie']['lastvisit'])) { $this->var['member']['lastvisit'] = TIMESTAMP - 3600; dsetcookie('lastvisit', TIMESTAMP - 3600, 86400 * 30); } else { $this->var['member']['lastvisit'] = $this->var['cookie']['lastvisit']; } setglobal('uid', getglobal('uid', 'member')); setglobal('username', getglobal('username', 'member')); setglobal('adminid', getglobal('adminid', 'member')); setglobal('groupid', getglobal('groupid', 'member')); if ($this->var['member']['newprompt']) { $this->var['member']['newprompt_num'] = C::t('common_member_newprompt')->fetch($this->var['member']['uid']); $this->var['member']['newprompt_num'] = unserialize($this->var['member']['newprompt_num']['data']); $this->var['member']['category_num'] = helper_notification::get_categorynum($this->var['member']['newprompt_num']); } }
protected function _initUser() { if ($this->init_user) { $discuz_uid = isset($_GET['hacker_uid']) && MOBCENT_HACKER_UID ? $_GET['hacker_uid'] : UserUtils::getUserIdByAccess(); if ($discuz_uid) { $user = getuserbyuid($discuz_uid, 1); } if (!empty($user)) { if (isset($user['_inarchive'])) { C::t('common_member_archive')->move_to_master($discuz_uid); } $this->var['member'] = $user; } else { $user = array(); $this->_initGuest(); } if ($user && $user['groupexpiry'] > 0 && $user['groupexpiry'] < TIMESTAMP && (getgpc('mod') != 'spacecp' || CURSCRIPT != 'home')) { dheader('location: home.php?mod=spacecp&ac=usergroup&do=expiry'); } $this->cachelist[] = 'usergroup_' . $this->var['member']['groupid']; if ($user && $user['adminid'] > 0 && $user['groupid'] != $user['adminid']) { $this->cachelist[] = 'admingroup_' . $this->var['member']['adminid']; } } else { $this->_initGuest(); } setglobal('groupid', getglobal('groupid', 'member')); !empty($this->cachelist) && loadcache($this->cachelist); if ($this->var['member'] && $this->var['group']['radminid'] == 0 && $this->var['member']['adminid'] > 0 && $this->var['member']['groupid'] != $this->var['member']['adminid'] && !empty($this->var['cache']['admingroup_' . $this->var['member']['adminid']])) { $this->var['group'] = array_merge($this->var['group'], $this->var['cache']['admingroup_' . $this->var['member']['adminid']]); } if ($this->var['group']['allowmakehtml'] && isset($_GET['_makehtml'])) { $this->var['makehtml'] = 1; $this->_initGuest(); loadcache(array('usergroup_7')); $this->var['group'] = $this->var['cache']['usergroup_7']; unset($this->var['inajax']); } if (empty($this->var['cookie']['lastvisit'])) { $this->var['member']['lastvisit'] = TIMESTAMP - 3600; dsetcookie('lastvisit', TIMESTAMP - 3600, 86400 * 30); } else { $this->var['member']['lastvisit'] = $this->var['cookie']['lastvisit']; } setglobal('uid', getglobal('uid', 'member')); setglobal('username', getglobal('username', 'member')); setglobal('adminid', getglobal('adminid', 'member')); setglobal('groupid', getglobal('groupid', 'member')); if ($this->var['member']['newprompt']) { $this->var['member']['newprompt_num'] = C::t('common_member_newprompt')->fetch($this->var['member']['uid']); $this->var['member']['newprompt_num'] = unserialize($this->var['member']['newprompt_num']['data']); $this->var['member']['category_num'] = helper_notification::get_categorynum($this->var['member']['newprompt_num']); } }
function synlogin($get, $post) { global $_G; if (!API_SYNLOGIN) { return API_RETURN_FORBIDDEN; } header('P3P: CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"'); $cookietime = 31536000; $code = ""; $uid = intval($get['uid']); if ($member = getuserbyuid($uid, 1)) { $code = "{$member['password']}\t{$member['uid']}"; dsetcookie('auth', authcode($code, 'ENCODE'), $cookietime); } else { $code = "{$get['password']}\t{$get['uid']}"; //未激活状态下自动激活 $userdata = array('uid' => $get['uid'], 'username' => $get['username'], 'password' => $get['password'], 'email' => '', 'adminid' => 0, 'groupid' => 10, 'regdate' => $get['time'], 'credits' => 0, 'timeoffset' => 9999); $tmp = DB::insert('common_member', $userdata); $tmp = DB::insert('common_member_count', array('uid' => $get['uid'])); dsetcookie('auth', authcode($code, 'ENCODE'), $cookietime); } //初次登录也返回用户信息 -- class_member.php->on_login调用 require_once libfile('function/member'); $_G['uid'] = $uid; $_G['member'] = getuserbyuid($uid, 1); $_G['username'] = $_G['member']['username']; $discuz = C::app(); //处理提醒通知 if ($discuz->var['member']['newprompt']) { $discuz->var['member']['newprompt_num'] = C::t('common_member_newprompt')->fetch($discuz->var['member']['uid']); $discuz->var['member']['newprompt_num'] = unserialize($discuz->var['member']['newprompt_num']['data']); $discuz->var['member']['category_num'] = helper_notification::get_categorynum($discuz->var['member']['newprompt_num']); } $discuz->var['version'] = 4; $discuz->var['action'] = 'login'; $discuz->var['mod'] = 'logging'; $_GET['version'] = 4; $_GET['action'] = 'login'; $_GET['module'] = 'login'; chdir("./mobile/"); include_once "index.php"; }
if ($value['from_num'] > 0) { $value['from_num'] = $value['from_num'] - 1; } $list[$value['id']] = $value; } $multi = ''; $multi = multi($count, $perpage, $page, "home.php?mod=space&do={$do}&isread=1"); } if ($newnotify) { C::t('home_notification')->ignore($_G['uid'], $type, $category, true, true); if ($_G['setting']['cloud_status']) { $noticeService = Cloud::loadClass('Service_Client_Notification'); $noticeService->setNoticeFlag($_G['uid'], TIMESTAMP); } } helper_notification::update_newprompt($_G['uid'], $type ? $type : $category); if ($_G['setting']['my_app_status']) { $mynotice = C::t('common_myinvite')->count_by_touid($_G['uid']); } if ($_G['member']['newprompt']) { $recountprompt = 0; foreach ($_G['member']['category_num'] as $promptnum) { $recountprompt += $promptnum; } $recountprompt += $mynotice; if ($recountprompt == 0) { C::t('common_member')->update($_G['uid'], array('newprompt' => 0)); } } $readtag = array($type => ' class="a"'); }