コード例 #1
0
ファイル: Social.cs プロジェクト: fizikci/Cinar
        private void getUserHomePosts()
        {
            if (Provider.User.IsAnonim())
            {
                return;
            }

            int lessThanId = 0;

            int.TryParse(context.Request["lessThanId"], out lessThanId);
            int greaterThanId = 0;

            int.TryParse(context.Request["greaterThanId"], out greaterThanId);

            context.Response.Write(new Result {
                Data = SocialAPI.GetUserHomePosts(Provider.User.Id, lessThanId, greaterThanId, loadPostsPageSize)
            }.ToJSON());
        }
コード例 #2
0
        public static void FollowUser(int followerId, string nickToFollow, string emailToFollow)
        {
            User user = Provider.Database.Read <User>(string.IsNullOrWhiteSpace(nickToFollow) ? "Email={0}" : "Nick={0}", string.IsNullOrWhiteSpace(nickToFollow) ? emailToFollow : nickToFollow);

            if (user == null)
            {
                throw new Exception("User unknown");
            }

            if (!user.Settings.NeedsConfirmation)
            {
                new UserContact {
                    UserId = user.Id
                }.Save();
                new Notification
                {
                    NotificationType = NotificationTypes.Followed,
                    UserId           = user.Id
                }.Save();
                user.ContactCount = SocialAPI.GetUserFollowerCount(user.Id);
                user.Save();

                if (user.Settings.MailAfterFollow)
                {
                    string msg = String.Format(@"
                                Merhaba {0},<br/><br/>
                                {1} seni takip etti.<br/><br/>
                                <a href=""http://{2}"">http://{2}</a>",
                                               user.FullName,
                                               Provider.User.FullName,
                                               Provider.Configuration.SiteAddress);
                    Provider.SendMail(user.Email, Provider.User.FullName + " seni takip etti", msg);
                }
            }
            else
            {
                new Notification
                {
                    NotificationType = NotificationTypes.FollowerRequest,
                    UserId           = user.Id
                }.Save();
            }
        }
コード例 #3
0
ファイル: Social.cs プロジェクト: fizikci/Cinar
        private void followContacts()
        {
            if (Provider.User.IsAnonim())
            {
                return;
            }

            string[] emails = Provider.Request.Form["emails"].SplitWithTrim('&');
            foreach (string emailParts in emails)
            {
                try
                {
                    var email = emailParts.SplitWithTrim('=')[1].Replace("%40", "@");
                    SocialAPI.FollowUser(Provider.User.Id, null, email);
                }
                catch { }
            }
            Provider.Response.Write("ok");
        }
コード例 #4
0
ファイル: Social.cs プロジェクト: fizikci/Cinar
        private void getUserProfileLikes()
        {
            int lessThanId = 0;

            int.TryParse(context.Request["lessThanId"], out lessThanId);
            int greaterThanId = 0;

            int.TryParse(context.Request["greaterThanId"], out greaterThanId);

            int  userId = Provider.User.Id;
            User user   = Provider.Database.Read <User>("Nick={0}", context.Request["user"]);

            if (user != null)
            {
                userId = user.Id;
            }

            context.Response.Write(new Result {
                Data = SocialAPI.GetUserProfileLikes(userId, lessThanId, greaterThanId, loadPostsPageSize)
            }.ToJSON());
        }
コード例 #5
0
ファイル: Social.cs プロジェクト: fizikci/Cinar
 private void getUserProfileSummary()
 {
     context.Response.Write(new Result {
         Data = SocialAPI.GetUserProfileSummary(Provider.Request["userNick"])
     }.ToJSON());
 }