Example #1
0
        private void PopulateControls()
        {
            SiteUser current = SiteUtils.GetCurrentSiteUser();

            if (current != null)
            {
                KLAuthor author = KLAuthor.GetKLAuthorByUserID(current.UserId);
                GeneralVariables.NameAuthor = current.Name;
                GeneralVariables.Level      = author.LevelAuthor;
                if (news != null)
                {
                    shortcontent.Content = news.BriefContent;
                    fullcontent.Content  = news.FullContent;
                    newstitle.Text       = news.Title;
                    KLNewsType temp = new KLNewsType(KLnews.NewType);
                    ddlnewtype.SelectedValue      = temp.ParentID.ToString();
                    ddlnewtypechild.SelectedValue = temp.NewsTypeID.ToString();
                }
                else
                {
                    litabimages.Visible = false;
                }
            }
            else
            {
                WebUtils.SetupRedirect(this, SiteRoot);
            }
        }
Example #2
0
        protected virtual void LoadSettings()
        {
            FileSystemProvider p = FileSystemManager.Providers[WebConfigSettings.FileSystemProvider];

            if (p != null)
            {
                fileSystem = p.GetFileSystem();
            }
            current = SiteUtils.GetCurrentSiteUser();
            if (current != null)
            {
                author = KLAuthor.GetKLAuthorByUserID(current.UserId);
                GeneralVariables.NameAuthor = current.Name;
                GeneralVariables.Level      = author.LevelAuthor;
                if (author != null)
                {
                    txtfb.Text              = author.LinkFacebook;
                    txtinstagram.Text       = author.LinkInstagram;
                    txtpinterest.Text       = author.LinkPinterest;
                    txttwinter.Text         = author.LinkTwitter;
                    txtFullName.Text        = author.Name;
                    txtEmail.Text           = current.Email;
                    editDescription.Content = current.Signature;
                    ImageAvatar.ImageUrl    = AuthorHepper.GetAvatarAuthor(siteSettings.SiteId, author.UserID);
                }
            }
            else
            {
                WebUtils.SetupRedirect(this, SiteRoot);
            }
        }
Example #3
0
        protected virtual void LoadSettings()
        {
            currentuser = SiteUtils.GetCurrentSiteUser();
            if (currentuser == null)
            {
                WebUtils.SetupRedirect(this, SiteRoot);
            }
            else
            {
                author = KLAuthor.GetKLAuthorByUserID(currentuser.UserId);
            }
            bookid = WebUtils.ParseInt32FromQueryString("BookID", bookid);
            if (bookid != -1)
            {
                book = new KLBook(bookid);
            }


            FileSystemProvider p = FileSystemManager.Providers[WebConfigSettings.FileSystemProvider];

            if (p != null)
            {
                fileSystem = p.GetFileSystem();
            }
        }
Example #4
0
        protected virtual void LoadSettings()
        {
            SiteUser site = SiteUtils.GetCurrentSiteUser();

            author = KLAuthor.GetKLAuthorByUserID(site.UserId);
            if (author == null)
            {
                WebUtils.SetupRedirect(this, SiteRoot);
            }
            GeneralVariables.NameAuthor = site.Name;
            GeneralVariables.Level      = author.LevelAuthor;
            search = WebUtils.ParseStringFromQueryString("search", search);
            status = WebUtils.ParseStringFromQueryString("status", status);
            switch (status)
            {
            case "":
                all = true;
                break;

            case "draft":
                isdraft    = true;
                isapproved = false;
                break;

            case "posted":
                isapproved = true;
                isdraft    = false;
                break;

            case "pending":
                isapproved = false;
                break;
            }
        }
 private void LoadParam()
 {
     current = SiteUtils.GetCurrentSiteUser();
     author  = KLAuthor.GetKLAuthorByUserID(current.UserId);
     GeneralVariables.NameAuthor = current.Name;
     GeneralVariables.Level      = author.LevelAuthor;
     hduserid.Value = current.UserId.ToString();
 }
Example #6
0
        bool LoginAuthor()
        {
            if (!SiteUser.EmailExistsInDB(siteSettings.SiteId, txtEmail.Text))
            {
                message.Message = "Email Don't Exists";
                return(false);
            }
            else
            {
                string result = SiteUser.Login(siteSettings, txtEmail.Text, txtPass.Text);
                if (result != "")
                {
                    try
                    {
                        SiteUser temp        = SiteUser.GetByEmail(siteSettings, txtEmail.Text);
                        KLAuthor authorlogin = KLAuthor.GetKLAuthorByUserID(temp.UserId);
                        if (authorlogin.IsActive != false)
                        {
                            GeneralVariables.NameAuthor = temp.Name;
                            GeneralVariables.Level      = authorlogin.LevelAuthor;
                            if (temp.Email != "")
                            {
                                if ((siteSettings.UseEmailForLogin))
                                {
                                    FormsAuthentication.SetAuthCookie(temp.Email, false);
                                    SiteUtils.CreateAndStoreSessionToken(temp);
                                }
                            }
                            else
                            {
                                if ((!siteSettings.UseEmailForLogin))
                                {
                                    FormsAuthentication.SetAuthCookie(temp.LoginName, false);

                                    SiteUtils.CreateAndStoreSessionToken(temp);
                                }
                            }

                            return(true);
                        }
                        else
                        {
                            message.Message = "This Account not yet approved";
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error(ex.Message);
                    }
                }
                else
                {
                    message.Message = "Password Wrong";
                }
            }

            return(false);
        }
Example #7
0
        public static string GetAvatarAuthor(int siteId, int authorId)
        {
            KLAuthor author = KLAuthor.GetKLAuthorByUserID(authorId);

            if (author.Avatar == "")
            {
                return("/Data/Sites/" + siteId.ToInvariantString() + "/Author/Authordefault.png");
            }
            return("/Data/Sites/" + siteId.ToInvariantString() + "/Author/" + authorId.ToInvariantString() + "/" + author.Avatar);
        }
Example #8
0
 private void LoadParams()
 {
     currentUser = SiteUtils.GetCurrentSiteUser();
     if (currentUser != null)
     {
         author = KLAuthor.GetKLAuthorByUserID(currentUser.UserId);
     }
     else
     {
         WebUtils.SetupRedirect(this, SiteRoot);
     }
 }
Example #9
0
        private void LoadParams()
        {
            SiteUser currentUser = SiteUtils.GetCurrentSiteUser();

            if (currentUser != null)
            {
                pagenum = WebUtils.ParseInt32FromQueryString("page", pagenum);

                var lst = KLFowllowAuthor.GetPageByAuthorID(pagenum, pageSize, out totalPage, currentUser.UserId);
                foreach (var item in lst)
                {
                    KLAuthor author = KLAuthor.GetKLAuthorByUserID(item.AuthorID);
                    authorList.Add(author);
                }
            }
            else
            {
            }
        }
Example #10
0
 private void LoadSettings()
 {
     currentUser  = SiteUtils.GetCurrentSiteUser();
     newsID       = WebUtils.ParseInt32FromQueryString("newsID", newsID);
     siteSettings = CacheHelper.GetCurrentSiteSettings();
     timeOffset   = SiteUtils.GetUserTimeOffset();
     timeZone     = SiteUtils.GetUserTimeZone();
     if (currentUser == null)
     {
         imgAvatar.ImageUrl = "/Data/Sites/1/Author/Authordefault.png";
         currentUser        = SiteUser.GetByEmail(siteSettings, "*****@*****.**");
     }
     else
     {
         author             = KLAuthor.GetKLAuthorByUserID(currentUser.UserId);
         imgAvatar.ImageUrl = AuthorHepper.MediaFolderPath(1, author.UserID) + author.Avatar;
         txtEmail.Text      = currentUser.Email;
         txtFullName.Text   = currentUser.Name;
     }
     news = new KLNews(newsID, 0);
 }
Example #11
0
        private void LoadSettings()
        {
            current = SiteUtils.GetCurrentSiteUser();
            if (current != null)
            {
                aut = KLAuthor.GetKLAuthorByUserID(current.UserId);
                if (aut == null)
                {
                    WebUtils.SetupRedirect(this, SiteRoot);
                }
                grat = KLGratitude.GetAll().Where(g => g.AuthorID == aut.AuthorID).ToList();
                listviewGratitude.DataSource = grat.OrderByDescending(x => x.CreateUtc);
                listviewGratitude.DataBind();

                GeneralVariables.NameAuthor = current.Name;
                GeneralVariables.Level      = aut.LevelAuthor;
            }
            else
            {
                WebUtils.SetupRedirect(this, SiteRoot);
            }
        }
Example #12
0
        protected virtual void LoadSettings()
        {
            currentuser = SiteUtils.GetCurrentSiteUser();
            author      = KLAuthor.GetKLAuthorByUserID(currentuser.UserId);

            currentuser = SiteUtils.GetCurrentSiteUser();
            if (currentuser == null)
            {
                WebUtils.SetupRedirect(this, SiteRoot);
            }
            else
            {
                author = KLAuthor.GetKLAuthorByUserID(currentuser.UserId);
            }
            guestid = WebUtils.ParseInt32FromQueryString("GuestID", guestid);

            if (guestid != -1)
            {
                gratitude         = new KLGratitude(guestid);
                txtgratitude.Text = gratitude.Comment;
            }
        }
        protected virtual void LoadSettings()
        {
            current = SiteUtils.GetCurrentSiteUser();
            if (current != null)
            {
                news   = WebUtils.ParseInt32FromQueryString("NewsID", news);
                author = KLAuthor.GetKLAuthorByUserID(current.UserId);
                if (author == null)
                {
                    WebUtils.SetupRedirect(this, SiteRoot);
                }
                listcomment = KLNewsComment.GetPageByAuthor(1, 10000, out totalpage, author.AuthorID, approved, news, -1, -1);
                listviewComment.DataSource = listcomment.OrderBy(com => com.IsPublish);
                listviewComment.DataBind();

                GeneralVariables.NameAuthor = current.Name;
                GeneralVariables.Level      = author.LevelAuthor;
            }
            else
            {
                WebUtils.SetupRedirect(this, SiteRoot);
            }
        }
Example #14
0
        private void Btnlogin_Click(object sender, EventArgs e)
        {
            if (txtpass.Text.Trim().Length > 8)
            {
                user.Password = txtpass.Text;
                user.Save();
                formreset2.Visible          = true;
                formreset.Visible           = false;
                GeneralVariables.NameAuthor = user.Name;
                KLAuthor author = KLAuthor.GetKLAuthorByUserID(user.UserId);
                GeneralVariables.Level = author.LevelAuthor;
                if (user.Email != "")
                {
                    if ((siteSettings.UseEmailForLogin))
                    {
                        FormsAuthentication.SetAuthCookie(user.Email, false);
                        SiteUtils.CreateAndStoreSessionToken(user);
                    }
                }
                else
                {
                    if ((!siteSettings.UseEmailForLogin))
                    {
                        FormsAuthentication.SetAuthCookie(user.LoginName, false);

                        SiteUtils.CreateAndStoreSessionToken(user);
                    }
                }
                time          = new Timer();
                time.Tick    += Time_Tick;
                time.Interval = 1000;
                time.Enabled  = true;
            }
            else
            {
            }
        }
Example #15
0
        private int Save(string op = "")
        {
            Page.Validate("news");

            if (!Page.IsValid)
            {
                return(-1);
            }

            if (ddlnewtype.SelectedValue.Length == 0)
            {
                message.ErrorMessage = CustomResources.SelectTypeMessage;
                return(-1);
            }

            if (news == null)
            {
                news        = new News(siteSettings.SiteId, newsId);
                news.ZoneID = -1;
            }
            if (currentUser == null)
            {
                return(-1);
            }

            news.LastModUserGuid = currentUser.UserGuid;

            news.SiteId       = siteSettings.SiteId;
            news.FullContent  = fullcontent.Content;
            news.BriefContent = shortcontent.Content;
            news.Title        = newstitle.Text;
            news.UserGuid     = currentUser.UserGuid;

            if (news.Save())
            {
                if (newsId > 0)
                {
                    KLnews.NewType = Convert.ToInt32(ddlnewtypechild.SelectedValue);
                    LogActivity.Write("Update news", news.Title);
                    message.SuccessMessage = ResourceHelper.GetResourceString("Resource", "UpdateSuccessMessage");
                }
                else
                {
                    KLAuthor author = KLAuthor.GetKLAuthorByUserID(currentUser.UserId);

                    KLnews = new KLNews()
                    {
                        CommentCount   = 0,
                        AuthorID       = author.AuthorID,
                        LikeCount      = 0,
                        Newlsevel      = 1,
                        Newstotalpoint = 0,
                        NewsID         = news.NewsID,
                        ShareCount     = 0,
                        NewType        = Convert.ToInt32(ddlnewtypechild.SelectedValue),
                        ViewCount      = 0,
                    };
                }
                if (op == "draft")
                {
                    KLnews.Isdraft    = true;
                    KLnews.Isapproved = false;
                }
                else
                {
                    KLnews.Isdraft    = false;
                    KLnews.Isapproved = false;
                }
                if (KLnews.Save())
                {
                    LogActivity.Write("Create new news", news.Title);
                    message.SuccessMessage = ResourceHelper.GetResourceString("Resource", "InsertSuccessMessage");
                }
            }

            SiteUtils.QueueIndexing();

            return(news.NewsID);
        }