コード例 #1
0
function invite_update($inviteid, $uid, $username, $m_uid, $m_username, $appid=0) {
	global $_SGLOBAL, $_SN;

	if($uid && $uid != $m_uid) {
		$friendstatus = getfriendstatus($uid, $m_uid);
		if($friendstatus < 1) {
			
			friend_update($uid, $username, $m_uid, $m_username, 'invite');
			
			//查找邀请记录
			$query = $_SGLOBAL['db']->query("SELECT * FROM ".tname('invite')." WHERE uid='$m_uid' AND fuid='$uid'");
			if($oldinvite = $_SGLOBAL['db']->fetch_array($query)) {
				//已经邀请过
				return false;
			}
			
			//奖励积分
			getreward('invitefriend', 1, $m_uid, '', 0);

			//feed
			$_SGLOBAL['supe_uid'] = $m_uid;
			$_SGLOBAL['supe_username'] = $m_username;

			//实名
			realname_set($uid, $username);
			realname_get();

			if(ckprivacy('invite', 1)) {
				$title_template = cplang('feed_invite');
				$tite_data = array('username'=>'<a href="space.php?uid='.$uid.'">'.stripslashes($_SN[$uid]).'</a>');
				feed_add('friend', $title_template, $tite_data);
			}

			//通知
			$_SGLOBAL['supe_uid'] = $uid;
			$_SGLOBAL['supe_username'] = $username;
			notification_add($m_uid, 'friend', cplang('note_invite'));

			//更新邀请
			$setarr = array('fuid'=>$uid, 'fusername'=>$username, 'appid'=>$appid);
			if($inviteid) {
				updatetable('invite', $setarr, array('id'=>$inviteid));
			} else {
				$setarr['uid'] = $m_uid;
				inserttable('invite', $setarr, 0, true);//插入邀请记录
			}
		}
	}
}
コード例 #2
0
ファイル: cp_feed.php プロジェクト: shiyake/php-ihome
        }
    }
} elseif ($_GET['op'] == 'ignore') {
    if (submitcheck('feedignoresubmit')) {
        $uid = empty($_POST['feed_uid']) ? 0 : $_POST['feed_uid'];
        $ignore_type = $_POST['ignore_type'];
        if ($ignore_type == 'black_feed') {
            if (empty($space['privacy']['black_feed']) || !is_array($space['privacy']['black_feed'])) {
                $space['privacy']['black_feed'] = array();
            }
            $space['privacy']['black_feed'][$uid] = $uid;
            privacy_update();
        } elseif ($ignore_type == 'black_all') {
            //删除好友
            if ($space['friends'] && in_array($uid, $space['friends'])) {
                friend_update($_SGLOBAL['supe_uid'], $_SGLOBAL['supe_username'], $uid, '', 'ignore');
            }
            inserttable('blacklist', array('uid' => $_SGLOBAL['supe_uid'], 'buid' => $uid, 'dateline' => $_SGLOBAL['timestamp']), 0, true);
        }
        showmessage('do_success', $_POST['refer']);
    }
} elseif ($_GET['op'] == 'get') {
    //获得好友的feed
    $cp_mode = 1;
    $_GET['start'] = intval($_GET['start']);
    if ($_GET['start'] < 1) {
        $_GET['start'] = $_SCONFIG['feedmaxnum'] < 50 ? 50 : $_SCONFIG['feedmaxnum'];
        $_GET['start'] = $_GET['start'] + 1;
    }
    $_TPL['getmore'] = 1;
    include_once S_ROOT . './source/space_feed.php';
コード例 #3
0
ファイル: cp_friend.php プロジェクト: NaturalWill/UCQA
        $_GET['uid'] = intval($_GET['uid']);
        $_SGLOBAL['db']->query("DELETE FROM " . tname('blacklist') . " WHERE uid='{$space['uid']}' AND buid='{$_GET['uid']}'");
        showmessage('do_success', "space.php?do=friend&view=blacklist&start={$_GET['start']}", 0);
    }
    if (submitcheck('blacklistsubmit')) {
        $_POST['username'] = trim($_POST['username']);
        $query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('space') . " WHERE username='******'username']}'");
        if (!($tospace = $_SGLOBAL['db']->fetch_array($query))) {
            showmessage('space_does_not_exist');
        }
        if ($tospace['uid'] == $space['uid']) {
            showmessage('unable_to_manage_self');
        }
        //删除好友
        if ($space['friends'] && in_array($tospace['uid'], $space['friends'])) {
            friend_update($_SGLOBAL['supe_uid'], $_SGLOBAL['supe_username'], $tospace['uid'], '', 'ignore');
        }
        inserttable('blacklist', array('uid' => $space['uid'], 'buid' => $tospace['uid'], 'dateline' => $_SGLOBAL['timestamp']), 0, true);
        showmessage('do_success', "space.php?do=friend&view=blacklist&start={$_GET['start']}", 0);
    }
} elseif ($op == 'rand') {
    $randuids = array();
    if ($space['friendnum'] < 5) {
        //附近在线的朋友
        $onlinelist = array();
        $query = $_SGLOBAL['db']->query("SELECT uid FROM " . tname('session') . " LIMIT 0,100");
        while ($value = $_SGLOBAL['db']->fetch_array($query)) {
            if ($value['uid'] != $space['uid']) {
                $onlinelist[] = $value['uid'];
            }
        }
コード例 #4
0
ファイル: cp_parent_func.php プロジェクト: shiyake/php-ihome
function followManually($uidA, $uidB)
{
    //A follow B
    friend_update($uidA, $usernameA, $uidB, $usernameB, 'add', 3);
    notification_add($uidA, "friend", cplang('note_friend_add'));
    return 1;
}
コード例 #5
0
ファイル: do_register.php プロジェクト: shiyake/php-ihome
 $setarrfri = array('uid' => $newuid, 'fuid' => $space['uid'], 'fusername' => addslashes($space['username']), 'gid' => 0, 'note' => '', 'dateline' => $_SGLOBAL['timestamp']);
 inserttable('friend', $setarrfri);
 friend_update($space['uid'], $space['username'], $newuid, $username, 'add', 0);
 notification_add($newuid, 'friend', cplang('note_friend_add'));
 $profile_uid = $_POST['profile_uid'];
 $_SGLOBAL['db']->query("UPDATE " . tname('baseprofile') . " SET isactive=1,uid={$newuid} WHERE userid=" . $profile_uid);
 $query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('baseprofile') . " WHERE userid=" . $profile_uid);
 $row = $_SGLOBAL['db']->fetch_array($query);
 if (!strcmp($row['usertype'], "学生")) {
     $sub = $row['collegeid'];
     $sub = substr($sub, 0, strlen($sub) - 2);
     $query1 = $_SGLOBAL['db']->query("SELECT " . tname('baseprofile') . ".uid as uid," . tname('space') . ".username as username FROM " . tname('baseprofile') . "," . tname('space') . " WHERE " . tname('baseprofile') . ".uid=" . tname('space') . ".uid AND " . tname('baseprofile') . ".collegeid LIKE '" . $sub . "%'");
     while ($row1 = $_SGLOBAL['db']->fetch_array($query1)) {
         $setarrfri = array('uid' => $newuid, 'fuid' => $row1['uid'], 'fusername' => addslashes($row1['username']), 'gid' => 0, 'note' => '', 'dateline' => $_SGLOBAL['timestamp']);
         inserttable('friend', $setarrfri);
         friend_update($row1['uid'], $row1['username'], $newuid, $username, 'add', 0);
         notification_add($row1['uid'], 'friend', cplang('note_friend_add'));
     }
 }
 include_once S_ROOT . './source/function_space.php';
 $space = space_open($newuid, $username, 0, $email);
 $flog = $inserts = $fuids = $pokes = array();
 if (!empty($_SCONFIG['defaultfusername'])) {
     $query = $_SGLOBAL['db']->query("SELECT uid,username FROM " . tname('space') . " WHERE username IN (" . simplode(explode(',', $_SCONFIG['defaultfusername'])) . ")");
     while ($value = $_SGLOBAL['db']->fetch_array($query)) {
         $value = saddslashes($value);
         $fuids[] = $value['uid'];
         $inserts[] = "('{$newuid}','{$value['uid']}','{$value['username']}','1','{$_SGLOBAL['timestamp']}')";
         $inserts[] = "('{$value['uid']}','{$newuid}','\$','1','{$_SGLOBAL['timestamp']}')";
         $pokes[] = "('{$newuid}','{$value['uid']}','{$value['username']}','" . addslashes($_SCONFIG['defaultpoke']) . "','{$_SGLOBAL['timestamp']}')";
         //Ìí¼ÓºÃÓѱä¸ü¼Ç¼
コード例 #6
0
             $class = !empty($value['class']) ? $value['class'] : $newclass;
             $eduinfo = array('uid' => $newuid, 'type' => 'edu', 'title' => '北京航空航天大学', 'subtitle' => $value['academy'] . $value['startyear'] . '级' . $class . '班', 'startyear' => $value['startyear']);
             inserttable('spaceinfo', $eduinfo, 1);
             $tagname = $value['startyear'] . '年' . $class . '班';
             auto_join($newuid, $tagname, $_SGLOBAL['db']);
             $classB = preg_replace('/([a-zA-Z]*\\d{4})\\d*/', '${1}', $class);
             $eduinfo = array('uid' => $newuid, 'type' => 'edu', 'title' => '北京航空航天大学', 'subtitle' => $value['academy'] . $value['startyear'] . '级' . $classB . '大班', 'startyear' => $value['startyear']);
             inserttable('spaceinfo', $eduinfo, 1);
             $tagname = $value['startyear'] . '年' . $classB . '大班';
             $tagid = auto_join($newuid, $tagname, $_SGLOBAL['db']);
             $assts = getGroupAsst($tagid);
             foreach ($assts as $asst) {
                 $q = $_SGLOBAL['db']->query("SELECT username FROM " . tname("space") . " WHERE uid=" . $asst);
                 if ($v = $_SGLOBAL['db']->fetch_array($q)) {
                     $asstname = $v['username'];
                     friend_update($newuid, $username, $asst, $asstname, 'invite');
                 }
             }
         }
     }
 }
 //print_r($EduArray);
 /*if(empty($bp['collegeid']))
 				{
 					//教育信息
 					if(!empty($bp['startyear']))
 						{
 							$eduinfo = array('uid' => $newuid, 'type'=>'edu', 'title' => '北京航空航天大学',	'startyear'=>$bp['startyear']);
 							inserttable('spaceinfo', $eduinfo, 1);
 
 							//加入群组:1,同年级;2,区域.
コード例 #7
0
ファイル: addfriend.php プロジェクト: shiyake/php-ihome
 $maxfriendnum = checkperm('maxfriendnum');
 if ($maxfriendnum && $space['friendnum'] >= $maxfriendnum + $space['addfriend']) {
     if ($_SGLOBAL['magic']['friendnum']) {
         showmessage('enough_of_the_number_of_friends_with_magic');
     } else {
         showmessage('enough_of_the_number_of_friends');
     }
 }
 $fstatus = getfriendstatus($uid, $_SGLOBAL['supe_uid']);
 if ($fstatus == -1) {
     //对方没有加好友,我加别人
     if ($status == -1) {
         $setarr = array('uid' => $_SGLOBAL['supe_uid'], 'fuid' => $uid, 'fusername' => addslashes($tospace['username']), 'gid' => intval($_POST['gid']), 'note' => getstr($_POST['note'], 50, 1, 1), 'dateline' => $_SGLOBAL['timestamp']);
         inserttable('friend', $setarr);
         if ($_SGLOBAL['member']['groupid'] == 3 && in_array($uid, explode(',', $_SGLOBAL['member']['aud']))) {
             friend_update($tospace['uid'], $tospace['username'], $space['uid'], $space['username'], 'add', 0);
             notification_add($tospace['uid'], 'friend', cplang('note_friend_add'));
             showmessage('friends_add', $_POST['refer'], 1, array($_SN[$tospace['uid']]));
         }
         //发送邮件通知
         smail($uid, '', cplang('friend_subject', array($_SN[$space['uid']], getsiteurl() . 'cp.php?ac=friend&amp;op=request')), '', 'friend_add');
         //增加对方好友申请数
         $_SGLOBAL['db']->query("UPDATE " . tname('space') . " SET addfriendnum=addfriendnum+1 WHERE uid='{$uid}'");
         echo 'request_has_been_sent';
         echo "<br />";
         echo "{$uid} is ok!";
         echo "<br />";
     } else {
         echo 'waiting_for_the_other_test';
         echo "<br />";
         echo "{$uid}";
コード例 #8
0
ファイル: register.php プロジェクト: shiyake/php-ihome
function freshmanregister_interface($realname, $birthday, $email)
{
    global $_SCONFIG, $_SGLOBAL;
    $res_json = array();
    $email = isemail($email) ? $email : '';
    if (empty($realname)) {
        $res_json = array("status" => "error", "reason" => "Realname is empty!");
    }
    if (empty($birthday)) {
        $res_json = array("status" => "error", "reason" => "Birthday is empty!");
    }
    if (empty($email)) {
        $res_json = array("status" => "error", "reason" => "Email is empty or format error!");
    }
    if ($_SCONFIG['checkemail']) {
        if ($count = getcount('spacefield', array('email' => $email))) {
            $res_json = array("status" => "error", "reason" => "Email has been registered!");
        }
    }
    $ThisYear = date('Y');
    //获取当前年
    $query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('baseprofile') . " WHERE realname='{$realname}' and birthday='{$birthday}' and startyear={$ThisYear} limit 1");
    $bp = $_SGLOBAL['db']->fetch_array($query);
    if (empty($bp)) {
        $res_json = array("status" => "error", "reason" => "Realname with birthday is invalid!");
    }
    if ($bp['isactive'] == 1) {
        $res_json = array("status" => "error", "reason" => "The user have actived!");
    }
    if ($bp['startyear'] < $ThisYear) {
        $res_json = array("status" => "error", "reason" => "This user is frashman!");
    }
    if (!@(include_once S_ROOT . './uc_client/client.php')) {
        $res_json = array("status" => "error", "reason" => "System error!");
    }
    $num = strpos($email, '@');
    $num = $num > 15 ? 15 : $num;
    $username = substr($email, 0, $num);
    $password = $birthday;
    $newuid = uc_user_register($username, $password, $email);
    if ($newuid <= 0) {
        if ($newuid == -1) {
            $res_json = array("status" => "error", "Username is not legitimate!");
        } elseif ($newuid == -2) {
            $res_json = array("status" => "error", "Include not registered words!");
        } elseif ($newuid == -3) {
            $res_json = array("status" => "error", "Please change an email address!");
        } elseif ($newuid == -4) {
            $res_json = array("status" => "error", "Email format is wrong");
        } elseif ($newuid == -5) {
            $res_json = array("status" => "error", "Email not registered");
        } else {
            $res_json = array("status" => "error", "Register error");
        }
    } else {
        //检查uid是否在ucenter里面,如果不在,就采取野蛮方式插入新纪录
        $q = $_SGLOBAL['db']->query("SELECT uid FROM ihomeuser_members WHERE uid='{$newuid}'");
        $members_match = $_SGLOBAL['db']->fetch_array($q);
        $members_match = $members_match['uid'];
        $q = $_SGLOBAL['db']->query("SELECT uid FROM ihomeuser_memberfields WHERE uid='{$newuid}'");
        $memberfields_match = $_SGLOBAL['db']->fetch_array($q);
        $memberfields_match = $memberfields_match['uid'];
        if (!$members_match && !$memberfields_match) {
            $salt = substr(uniqid(rand()), -6);
            $hhpassword = md5(md5($password) . $salt);
            $sqladd = "uid='" . intval($newuid) . "',";
            $sqladd .= " secques='',";
            $_SGLOBAL['db']->query("INSERT INTO ihomeuser_members SET {$sqladd} username='******', password='******', email='{$email}', regip='" . $_SERVER["HTTP_X_FORWARDED_FOR"] . "', regdate='" . time() . "', salt='{$salt}'");
            $_SGLOBAL['db']->query("INSERT INTO ihomeuser_memberfields SET uid='{$newuid}'");
        }
        $setarr = array('uid' => $newuid, 'username' => $username, 'password' => md5($password));
        inserttable('actionlog', array('uid' => "{$newuid}", 'dateline' => "{$_SGLOBAL['timestamp']}", 'action' => 'register', 'value' => 'freshman'));
        //更新本地用户库
        inserttable('member', $setarr, 0, true);
        //开通空间
        include_once S_ROOT . './source/function_space.php';
        $space = space_open($newuid, $username, 0, $email);
        //默认好友
        $flog = $inserts = $fuids = $pokes = array();
        if (!empty($_SCONFIG['defaultfusername'])) {
            $query = $_SGLOBAL['db']->query("SELECT uid,username FROM " . tname('space') . " WHERE\tusername IN (" . simplode(explode(',', $_SCONFIG['defaultfusername'])) . ")");
            while ($value = $_SGLOBAL['db']->fetch_array($query)) {
                $value = saddslashes($value);
                $fuids[] = $value['uid'];
                $inserts[] = "('{$newuid}','{$value['uid']}','{$value['username']}','1','{$_SGLOBAL['timestamp']}')";
                $inserts[] = "('{$value['uid']}','{$newuid}','{$username}','1','{$_SGLOBAL['timestamp']}')";
                $pokes[] = "('{$newuid}','{$value['uid']}','{$value['username']}','" . addslashes($_SCONFIG['defaultpoke']) . "','{$_SGLOBAL['timestamp']}')";
                //添加好友变更记录
                $flog[] = "('{$value['uid']}','{$newuid}','add','{$_SGLOBAL['timestamp']}')";
            }
            if ($inserts) {
                $_SGLOBAL['db']->query("REPLACE INTO " . tname('friend') . " (uid,fuid,fusername,status,dateline) VALUES " . implode(',', $inserts));
                $_SGLOBAL['db']->query("REPLACE INTO " . tname('poke') . " (uid,fromuid,fromusername,note,dateline) VALUES " . implode(',', $pokes));
                $_SGLOBAL['db']->query("REPLACE INTO " . tname('friendlog') . " (uid,fuid,action,dateline) VALUES " . implode(',', $flog));
                //添加到附加表
                $friendstr = empty($fuids) ? '' : implode(',', $fuids);
                updatetable('space', array('friendnum' => count($fuids), 'pokenum' => count($pokes)), array('uid' => $newuid));
                updatetable('spacefield', array('friend' => $friendstr, 'feedfriend' => $friendstr), array('uid' => $newuid));
                //更新默认用户好友缓存
                include_once S_ROOT . './source/function_cp.php';
                foreach ($fuids as $fuid) {
                    friend_cache($fuid);
                }
            }
        }
        //加入新用户
        inserttable('spacefield', array('uid' => $newuid), 0, true);
        //baseprofile的事情了!!
        $birth_year = intval(substr($birthday, 0, 4));
        $birth_month = intval(substr($birthday, 4, 2));
        $birth_day = intval(substr($birthday, 6, 2));
        if ($bp['sex'] == '男') {
            $sexc = 1;
        } elseif ($bp['sex'] == '女') {
            $sexc = 2;
        } else {
            $sexc = 0;
        }
        if (empty($bp['identifier'])) {
            $insertinfo = array('realname' => $bp['realname'], 'realbirth' => $birthday, 'sex' => $sexc, 'email' => $email, 'birthyear' => $birth_year, 'birthmonth' => $birth_month, 'birthday' => $birth_day);
            updatetable('spacefield', $insertinfo, array('uid' => $newuid));
        } else {
            $insertinfo = array('identifier' => $bp['identifier'], 'realname' => $bp['realname'], 'realbirth' => $birthday, 'sex' => $sexc, 'email' => $email, 'birthyear' => $birth_year, 'birthmonth' => $birth_month, 'birthday' => $birth_day);
            updatetable('spacefield', $insertinfo, array('uid' => $newuid));
        }
        if ($birth_year && $birth_month && $birth_day) {
            $_SGLOBAL['db']->query("INSERT INTO " . tname('spaceinfo') . " (type,subtype,uid,friend) VALUES ('base','birth'," . $newuid . ",3)");
        }
        $space = array('uid' => $newuid, 'name' => $bp['realname'], 'namestatus' => 1);
        updatetable('space', $space, array('uid' => $newuid));
        //获取该用户的所有基础信息用于填充其教育经历
        $EduArray = array();
        $userids = '';
        $query = $_SGLOBAL['db']->query("SELECT userid,collegeid,school,academy,startyear,class,sourcearea FROM " . tname('baseprofile') . " WHERE realname='{$realname}' and birthday='{$birthday}' order by startyear");
        while ($EduResult = $_SGLOBAL['db']->fetch_array($query)) {
            $userids .= $EduResult['userid'] . ",";
            if ($EduResult['startyear']) {
                if ($EduArray[$EduResult["startyear"]]) {
                    if ($EduResult['class']) {
                        $EduArray[$EduResult["startyear"]] = array('collegeid' => $EduResult['collegeid'], 'school' => $EduResult['school'], 'academy' => $EduResult['academy'], 'sourcearea' => $EduResult['sourcearea'], 'class' => $EduResult['class'], 'startyear' => $EduResult['startyear']);
                    }
                } else {
                    $EduArray[$EduResult["startyear"]] = array('collegeid' => $EduResult['collegeid'], 'school' => $EduResult['school'], 'academy' => $EduResult['academy'], 'sourcearea' => $EduResult['sourcearea'], 'class' => $EduResult['class'], 'startyear' => $EduResult['startyear']);
                }
            }
        }
        foreach ($EduArray as $key => $value) {
            if (empty($value['collegeid'])) {
                //教育信息
                if (!empty($value['startyear'])) {
                    $eduinfo = array('uid' => $newuid, 'type' => 'edu', 'title' => '北京航空航天大学', 'subtitle' => $value['academy'], 'startyear' => $value['startyear']);
                    inserttable('spaceinfo', $eduinfo, 1);
                    //应该要加一个段记录该学生为本科还是研究生********************(缺)
                    //还要考虑没有生日信息但有身份证号存在的情况................(缺)
                    //加入群组:1,同年级;2,区域.
                    $tagname = $value['startyear'] . '级本科生';
                    joinGrade($newuid, $tagname, $_SGLOBAL['db']);
                    $tagname = $value['startyear'] . '级' . $value['sourcearea'] . '本科生';
                    joinArea($newuid, $tagname, $_SGLOBAL['db']);
                }
            } elseif (!empty($value['collegeid'])) {
                $thefour = intval(substr($value['collegeid'], 3, 1));
                if ($thefour == 2 || $value['class']) {
                    $newclass = substr($value['collegeid'], 0, 7);
                    $class = !empty($value['class']) ? $value['class'] : $newclass;
                    $eduinfo = array('uid' => $newuid, 'type' => 'edu', 'title' => '北京航空航天大学', 'subtitle' => $value['academy'] . $value['startyear'] . '级' . $class . '班', 'startyear' => $value['startyear']);
                    inserttable('spaceinfo', $eduinfo, 1);
                    $tagname = $value['startyear'] . '年' . $class . '班';
                    auto_join($newuid, $tagname, $_SGLOBAL['db']);
                    $classB = preg_replace('/([a-zA-Z]*\\d{4})\\d*/', '${1}', $class);
                    $eduinfo = array('uid' => $newuid, 'type' => 'edu', 'title' => '北京航空航天大学', 'subtitle' => $value['academy'] . $value['startyear'] . '级' . $classB . '大班', 'startyear' => $value['startyear']);
                    inserttable('spaceinfo', $eduinfo, 1);
                    $tagname = $value['startyear'] . '年' . $classB . '大班';
                    $tagid = auto_join($newuid, $tagname, $_SGLOBAL['db']);
                    $assts = getGroupAsst($tagid);
                    foreach ($assts as $asst) {
                        $q = $_SGLOBAL['db']->query("SELECT username FROM " . tname("space") . " WHERE uid=" . $asst);
                        if ($v = $_SGLOBAL['db']->fetch_array($q)) {
                            $asstname = $v['username'];
                            friend_update($newuid, $username, $asst, $asstname, 'invite');
                        }
                    }
                }
            }
        }
        if (substr($userids, -1, 1) == ',') {
            $userids = substr($userids, 0, -1);
        }
        $_SGLOBAL['db']->query("update " . tname("baseprofile") . " set isactive='1',uid={$newuid} WHERE userid in ({$userids})");
        $res_json = array("status" => "correct", "uid" => $newuid, "email" => $email, "username" => $username, "password" => $password);
    }
    echo json_encode($res_json);
    return json_encode($res_json);
}
コード例 #9
0
ファイル: do_cpfriend.php プロジェクト: shiyake/php-ihome
                 $fs['body_template'] = '';
                 $fs['body_data'] = array();
                 $fs['body_general'] = '';
                 feed_add($fs['icon'], $fs['title_template'], $fs['title_data'], $fs['body_template'], $fs['body_data'], $fs['body_general']);
             }
             //我的好友申请数进行变化
             $_SGLOBAL['db']->query("UPDATE " . tname('space') . " SET addfriendnum=addfriendnum-1 WHERE uid={$userid} AND addfriendnum>0");
             //通知
             notification_add($tousesrid, 'friend', cplang('note_friend_add'));
             $result = array('flag' => 'added');
         }
     }
 } elseif ($type == 'ignore') {
     if ($rfstatus == 1) {
         //取消双向好友关系
         friend_update($userid, $space['username'], $touserid, '', 'ignore');
         $result = array('flag' => 'ignored');
     } elseif ($rfstatus == 0) {
         request_ignore($touserid);
         $result = array('flag' => 'ignored');
     } else {
         $result = array('flag' => 'notfriends');
     }
 } else {
     /*$friends = explode(',',$space['friend']);
     			if(in_array($touserid, $friends)){
     				$result = array('flag'=>'isfriend');
     			}else{
     				$result = array('flag'=>'notfriends');
     
     			}*/
コード例 #10
0
ファイル: space_friend.php プロジェクト: shiyake/php-ihome
 }
 $query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('asst') . " WHERE passed=0 and uid='{$uid}'");
 if ($value = $_SGLOBAL['db']->fetch_array($query)) {
     //记录审批时间
     $_SGLOBAL['db']->query("UPDATE " . tname('asst') . " SET passdate='" . time() . "' , pass_uid='" . $_SGLOBAL['supe_uid'] . "' , state=1, passed=1  WHERE passed=0 and uid='{$uid}'");
     if ($value['degree'] == '本科') {
         $username = $value['username'];
         $name = $value['name'];
         if (!$name) {
             $name = $username;
         }
         $tagid = tagGroupAsst($uid, $value['year'], $value['academy']);
         if ($tagid != -1) {
             $query = $_SGLOBAL['db']->query("SELECT uid,username FROM " . tname('tagspace') . " WHERE tagid='{$tagid}' AND uid!='{$uid}'");
             while ($value = $_SGLOBAL['db']->fetch_array($query)) {
                 friend_update($uid, $username, $value['uid'], $value['username'], 'invite');
             }
         }
     }
     $q = $_SGLOBAL['db']->query("SELECT username,name FROM " . tname('space') . " WHERE uid=" . $_SGLOBAL['supe_uid']);
     if ($v = $_SGLOBAL['db']->fetch_array($q)) {
         $supe_name = $v['name'];
         if (!$supe_name) {
             $supe_name = $v['username'];
         }
     }
     $setarr = array('uid' => $uid, 'type' => "systemnote", 'new' => 1, 'authorid' => 0, 'note' => '<a href="space.php?uid=' . $uid . '">' . $name . '</a>您好,您的辅导员权限已被管理员<a href="space.php?uid=' . $_SGLOBAL['supe_uid'] . '">' . $supe_name . "</a>审批通过", 'dateline' => $_SGLOBAL['timestamp']);
     $_SGLOBAL['db']->query("UPDATE " . tname('space') . " SET notenum=notenum+1 WHERE uid='{$uid}'");
     inserttable('notification', $setarr);
 } else {
     showmessage("当前没有申请或者申请已被处理");