Exemple #1
0
def search():
    if not is_logged_in():
        return redirect("/login")
    search_term = request.args.get("term")
    return render_template("search_results.html",
                           search_term=search_term,
                           messages=messages.search(search_term, user_id()))
Exemple #2
0
def search():
    srch_word = request.form["srch"]
    if srch_word == "":
        return redirect("/")
    t = request.form["thrd"]
    m = request.form["mssg"]
    title_list = []
    message_list = []
    from_t = False
    from_m = False
    if t == "t":
        from_t = True
        title_list = threads.search(srch_word)
    if m == "m":
        from_m = True
        message_list = messages.search(srch_word)
    return render_template("search_results.html",
                           title_list=title_list,
                           message_list=message_list,
                           from_m=from_m,
                           from_t=from_t)
Exemple #3
0
def search():
	user_id = users.user_id()
	if user_id == 0 and request.method == "GET":
		return render_template("search.html")
	if is_user_banned():
		return redirect("/banned")
	if request.method == "GET":
		return render_template("search.html", admin = users.check_if_admin(user_id))
	if request.method == "POST":
		if user_id != 0:
			check_csrf()
		search_content = request.form.get("search_content")
		if not search_content:
			return redirect("/search")
		search_users = users.search(search_content)
		search_threads = threads.search(search_content)
		search_messages = messages.search(search_content)
		show_results = True
		return render_template("search.html",
		 search_users = search_users, search_threads = search_threads, 
		 search_messages = search_messages, search_content = search_content, 
		 show_results = show_results)
Exemple #4
0
 def search(self, filter):
     for key, peer in self.peers_protocol.items():
         searchMessage = messages.search(self.nodeid, filter)
         peer.sendLine(searchMessage)