public void FaceSave()
        {
            User user = ctx.owner.obj as User;

            Result result = AvatarUploader.Save(ctx.GetFileSingle(), user.Id);

            if (result.HasErrors)
            {
                errors.Join(result);
                run(Face);
                return;
            }

            if (user.Pic != UserFactory.Guest.Pic)
            {
                AvatarUploader.Delete(user.Pic);
            }

            userService.UpdateAvatar(user, result.Info.ToString());

            if (ctx.utils.isFrame())
            {
                echoToParent(lang("uploadThanks"));
            }
            else
            {
                echoRedirectPart(lang("uploadThanks"), to(Face), 0);
            }
        }
        public void FaceSave()
        {
            User user = ctx.owner.obj as User;

            Result result = AvatarUploader.Save(ctx.GetFileSingle(), user.Url);

            if (result.IsValid)
            {
                userService.UpdateAvatar(user, result.Info.ToString());

                if (ctx.utils.isFrame())
                {
                    echoToParent(lang("uploadThanks"));
                }
                else
                {
                    echoRedirectPart(lang("uploadThanks"), to(Face), 0);
                }
            }
            else
            {
                errors.Join(result);
                run(Face);
            }
        }
        public void SaveUserPic()
        {
            User user = ctx.owner.obj as User;

            Result result = AvatarUploader.Save(ctx.GetFileSingle(), user.Id);

            if (result.HasErrors)
            {
                echoError(result);
                return;
            }

            if (user.Pic != UserFactory.Guest.Pic)
            {
                AvatarUploader.Delete(user.Pic);
            }

            userService.UpdateAvatar(user, result.Info.ToString());

            // 页面跳转
            String redirectUrl = ctx.Post("redirectUrl");
            String msg         = "感谢上传!";

            if (strUtil.HasText(redirectUrl))
            {
                echoRedirect(msg, redirectUrl);
            }
            else
            {
                echoRedirect(msg, sys.Url.SiteUrl);
            }
        }
Example #4
0
        private void saveWaitingApprove()
        {
            User user = ctx.owner.obj as User;

            Result result = AvatarUploader.Save(ctx.GetFileSingle(), user.Id);

            if (result.HasErrors)
            {
                echoError(result);
                return;
            }

            if (user.Pic != UserFactory.Guest.Pic)
            {
                AvatarUploader.Delete(user.Pic);
            }

            // 更新最后一个日志
            errorPicService.UpdateLastUpload(user, ctx.Ip);

            // 2) 仅仅保存图像、不会增加积分、不会发送邮件鼓励、不给管理员发通知
            userService.UpdateAvatarOnly(user, result.Info.ToString());

            String msg = "感谢上传!";

            echoRedirect(msg);
        }
Example #5
0
        private void importUserSingle(ImportUser u, List <string> picList)
        {
            OpenService os = new OpenService();

            //
            String pwd   = getRandomPwd();
            String email = pwd + "@xxx.com";
            String apps  = " home,blog,photo,microblog,friend,visitor,forumpost,about";

            // 注册
            Result result;

            if (strUtil.HasText(u.FriendlyUrl))
            {
                result = os.UserRegister(u.Name, pwd, email, u.FriendlyUrl, apps);
            }
            else
            {
                String uFriendlyUrl = getFriendlyUrl();
                result = os.UserRegister(u.Name, pwd, email, uFriendlyUrl, apps);
            }

            if (result.HasErrors)
            {
                return;
            }
            User user = result.Info as User;

            if (picList.Count > 0)
            {
                String randomPic = picList[0];

                // 上传头像
                Result saved = AvatarUploader.Save(randomPic, user.Id);

                // 更新头像信息
                user.Pic = saved.Info.ToString();
                user.update();

                picList.RemoveAt(0);
            }
        }
Example #6
0
        private void saveFirstUpload()
        {
            User user = ctx.owner.obj as User;

            Result result = AvatarUploader.Save(ctx.GetFileSingle(), user.Id);

            if (result.HasErrors)
            {
                echoError(result);
                return;
            }

            if (user.Pic != UserFactory.Guest.Pic)
            {
                AvatarUploader.Delete(user.Pic);
            }

            userService.UpdateAvatar(user, result.Info.ToString());
            String msg = "感谢上传!";

            echoRedirect(msg, sys.Url.SiteUrl);
        }
Example #7
0
        private void saveWaitingUpload()
        {
            User user = ctx.owner.obj as User;

            Result result = AvatarUploader.Save(ctx.GetFileSingle(), user.Id);

            if (result.HasErrors)
            {
                echoError(result);
                return;
            }

            if (user.Pic != UserFactory.Guest.Pic)
            {
                AvatarUploader.Delete(user.Pic);
            }

            // 增加日志
            UserErrorPic lastLog = errorPicService.GetLastLog(user);

            if (lastLog.IsNextAutoPass == 1)
            {
                errorPicService.AddLogAndPass(user, ctx.Ip);
            }
            else
            {
                errorPicService.AddLog(user, ctx.Ip);
            }

            // 2) 保存图像、不会增加积分、不会发送邮件鼓励;给管理员发通知
            userService.UpdateAvatarWhenError(user, result.Info.ToString());

            String msg = "感谢上传!";

            echoRedirect(msg);
        }