Exemple #1
0
def detailsu(title):
    if 'user' in session and session['user'] == request.cookies.get('email'):
	       totalcomment = Users.allcomments(title)
	       blogs =  Users.bytitle(title)
	       return render_template('totalcomment.html', totalcomment=totalcomment,blogs=blogs)
    else:
        redirect(url_for('login'))
Exemple #2
0
def details(titleblog):
    if titleblog ==  request.cookies.get('title') and 'user' in session:
        title = request.cookies.get('title')
        totalcomment = Users.allcomments(title)
        comment = Users.querytitlei(title)['comment']
        blogs =  Users.bytitle(title)
        number_title(comment,title)
        return render_template('totalcomment.html', totalcomment=totalcomment,blogs=blogs)
    return redirect(url_for('login'))
Exemple #3
0
def open(email,blogtitle,blog_id):
        if utils.email_is_valid(email) == True and blog_id.__len__() ==  32:
            item = Users.bytitle_one(blogtitle)
            ids = Users.id_one(blog_id)["_id"]
            if  session['user'] == email and ids == blog_id:
                items =  Users.bytitle(blogtitle)
                return render_template('blogopen.html',items=items)
            else:
                flash("there is a problem contact Admin")
                return redirect(url_for('login'))
        flash("there is a problem please contact admin")
        return redirect(url_for('login'))
Exemple #4
0
def commentdetails(blogtitle,email,blog_id):
    if blog_id.__len__() ==  32:
        ids = Users.id_one(blog_id)['_id']
        if blog_id == ids and ids != False:
            item = Users.bytitle_one(blogtitle)
            totalcomment = Users.allcomments(blogtitle)
            blogs =  Users.bytitle(blogtitle)
            return render_template('totalcomment.html',totalcomment=totalcomment,blogs=blogs)
        else:
            flash(" big problem ")
            return redirect(url_for('login'))
    flash("big problem man")
    return redirect(url_for('login'))
Exemple #5
0
def editeprocess(email,blogtitle,blog_id):
    editeform = EditeForm()
    loginform = LoginForm()
    database_email = Users.get_by_email(email)["email"]
    if editeform.validate_on_submit() == True and 'user' in session and session['user'] == email and blog_id.__len__() ==  32:
        thins = Users.bytitle(blogtitle)
        ids = Users.id_one(blog_id)["_id"]
        for stuff in thins:
            if stuff['titleblog'] == blogtitle and stuff['email'] == session["user"] and blog_id == ids:
                description = editeform.description.data
                Database.updates("blogs",{"content":stuff['content']},{"$set": {"content":description}})
                return render_template('editemessage.html')
            else:
                redirect(url_for('login'))
    flash("these are technical errors please try login again")
    return render_template('login.html',loginform=loginform)
Exemple #6
0
def edite(email,titleblog,blog_id):
    properties = []
    editeform = EditeForm()
    loginform = LoginForm()

    if 'user' in session and session['user'] == email and blog_id and utils.email_is_valid(email) == True and blog_id.__len__() ==  32:
        data_id =       Users.get_by_email(email)["_id"]
        content = Users.bytitle(titleblog)
        for stuffs in content:
            ids = Users.id_one(blog_id)["_id"]
            if session['user'] == email and blog_id ==  ids:
                editeform.description.data = stuffs['content']
                return render_template('edite.html',editeform=editeform,email=email,blogtitle=titleblog,blog_id=blog_id)
            else:
                flash("checking problem")
                return redirect(url_for('login'))
    return redirect(url_for('login'))