Пример #1
0
	def get(self):
		SetUtf8.set()
		
		data=""

		user = users.get_current_user()
		user_id="";
		if(user):
			user_id=user.user_id()
		
		is_iphone=CssDesign.is_iphone(self)
		is_mobile=is_iphone or CssDesign.is_tablet(self)
		app_key=ApiPerpetuation.get_app_key(self)

		host_url="http://"+MappingId.mapping_host(self.request.host)+"/";

		template_values = {
			'host': host_url,
			'user_id': user_id,
			'is_mobile': is_mobile,
			'is_iphone': is_iphone,
			'app_key': app_key
		}

		self.response.content_type = 'text/javascript'
		path = "/html/api/illustbook.js"
		self.response.out.write(template_select.render(path, template_values))
Пример #2
0
	def show_portal(self,user):
		self.redirect("./?order=chat")
		return

		is_iphone=CssDesign.is_iphone(self)
		is_tablet=CssDesign.is_tablet(self)

		show_room=Chat.get_room_object_list()
	
		is_admin=False
		if(OwnerCheck.is_admin(user)):
			is_admin=True

		#user_name=self.get_user_name(user)

		bookmark=None
		if(user):
			bookmark=ApiObject.get_bookmark_of_user_id(user.user_id())

		template_values = {
			'host': "./",
			'is_iphone': is_iphone,
			'is_tablet': is_tablet,
			'bookmark': bookmark,
			'redirect_url': self.request.path,
			'mode': "chat",
			'header_enable': False,
			'room_list': show_room,
			'is_admin':is_admin,
			#'user_name': user_name,
			'is_english':CssDesign.is_english(self)
		}
		path = '/html/portal.html'
		self.response.out.write(template_select.render(path, template_values))
Пример #3
0
	def _render_comment_core(req,host_url,bbs,thread,com_list_,edit_flag,bbs_key,logined,show_comment_form,is_admin,user_name,user,res_hash,show_ip):
		#レスを取得
		com_list=ShowEntry._get_response(com_list_,res_hash,thread,bbs)

		#コメントの編集を行うか
		comment_edit=req.request.get("comment_edit")

		#iPhoneかどうか
		is_iphone=CssDesign.is_iphone(req)

		#英語版かどうか
		is_english=CssDesign.is_english(req)
		
		#レンダリング
		template_values = {
			'host': host_url,
			'bbs': bbs,
			'thread': thread,
			'com_list':com_list,
			'edit_flag':edit_flag,
			'bbs_key': bbs_key,
			'logined':logined,
			'show_comment_form':show_comment_form,
			'is_admin':is_admin,
			'user_name': user_name,
			'user': user,
			'redirect_url': req.request.path,
			'comment_edit': comment_edit,
			'is_iphone': is_iphone,
			'is_english': is_english,
			'show_ip': show_ip
			}

		path = "/html/thread/thread_comment.html"
		return template_select.render(path, template_values)
Пример #4
0
	def get(self):
		try:
			bbs = db.get(self.request.get("bbs_key"))
		except:
			Alert.alert_msg_with_write(self,"掲示板の編集画面のURLが変更されています。掲示板からログインし、デザインの編集ボタンをクリックして下さい。")
			return

		user = users.get_current_user()
		is_admin=0
		if(user and OwnerCheck.is_admin(user)):
			is_admin=1
		if(bbs.short!="sample" and OwnerCheck.check(bbs,user) and not is_admin):
			Alert.alert_msg_with_write(self,"デザインの編集の権限がありません。")
			return

		error_str=""
		if self.request.get("error_str"):
			error_str=self.request.get("error_str")
		
		is_css_enable=OwnerCheck.is_admin(user)
		
		my_app_list=None
		if(user):
			my_app_list=AppCode.all().filter("user_id =",user.user_id()).filter("mode =",2).fetch(limit=100,offset=0)
		
		tab="all"
		if(self.request.get("tab")):
			tab=self.request.get("tab")

		bbs_css=None
		try:
			bbs_css=bbs.css
		except:
			bbs_css=None

		template_values = {
			'host': './',
			'bbs': bbs,
			'error_str': error_str,
			'is_css_enable': is_css_enable,
			'is_admin': is_admin,
			'is_iphone': CssDesign.is_iphone(self),
			'is_tablet': CssDesign.is_tablet(self),
			'my_app_list': my_app_list,
			'user': user,
			'tab': tab,
			'redirect_url': self.request.path,
			'bbs_css': bbs_css,
			'is_english': CssDesign.is_english(self)
		}

		path = '/html/edit_bbs.html'
		self.response.out.write(template_select.render(path, template_values))
Пример #5
0
	def _render_page(self,template_values):
		host="http://"+MappingId.mapping_host(self.request.host)+"/";
		template_values['host']=host
		template_values['is_iphone']=CssDesign.is_iphone(self)
		template_values['is_tablet']=CssDesign.is_tablet(self)
		template_values['tag_display_n']=40
		template_values['is_maintenance']=MaintenanceCheck.is_appengine_maintenance()
		if(template_values['user']):
			template_values['login_flag']=1
		else:
			template_values['login_flag']=0
		render=template_select.render("/html/pinterest.html", template_values)
		#render=strip_spaces_between_tags(render)
		self.response.out.write(render)
Пример #6
0
	def get(self):
		user = users.get_current_user()
		user_name=ShowEntry.get_user_name(user)

		bbs_list=[]

		if(user):
			user_id=user.user_id()
			
			bookmark_bbs_list=ApiBookmark.bookmark_get_bbs_list(self,user_id)
			rental_bbs_list=ApiUser.user_get_bbs_list(self,user_id)
			
			if(rental_bbs_list):
				bbs_list.extend(rental_bbs_list)
			if(bookmark_bbs_list):
				bbs_list.extend(bookmark_bbs_list)

			sample_bbs={
			"title":"サンプルお絵描き掲示板",
			"key":MappingId.mapping("sample")
			}
			bbs_list.append(sample_bbs)

		temp_key=self.request.get("temp_key")

		args=None
		if(temp_key):
			temp=db.get(temp_key)
			if(temp.args):
				args=temp.args

		target_bbs=self.get_target_bbs(args);
		if(target_bbs):
			bbs_list=target_bbs

		template_values={
		'host':"./",
		'is_iphone':CssDesign.is_iphone(self),
		'is_tablet':CssDesign.is_tablet(self),
		'is_english':CssDesign.is_english(self),
		'temp_key':temp_key,
		'redirect_url':self.request.path+"?temp_key="+temp_key,
		'user':user,
		'bbs_list':bbs_list,
		'args':args,
		'user_name':user_name
		}
		render=template_select.render("/html/upload_temp.html", template_values)
		self.response.out.write(render)
Пример #7
0
	def withdraw(self,bookmark,your_bbs_count):
		user_id=self.request.get("user_id")
		if(not user_id):
			Alert.alert_msg_with_write(self,"ユーザIDが必要です。")
			return True

		user=users.get_current_user()
		bookmark=ApiObject.get_bookmark_of_user_id_for_write(user_id)	#キャッシュから取得するのを防止
		if(not bookmark):
			Alert.alert_msg_with_write(self,"ユーザが見つかりません。")
			return True

		if(OwnerCheck.check_bookmark(bookmark,user)):
			Alert.alert_msg_with_write(self,"退会する権限がありません。")
			return True

		is_english=CssDesign.is_english(self)

		if(your_bbs_count==0):
			#delete_user_thread(user.user_id())	#他人の掲示板に描いたイラストは慎重に削除する必要がある気がする
			bookmark.delete()
			msg="退会が完了しました。"
			if(is_english):
				msg="Complete"
			Alert.alert_msg_with_write(self,msg);
		else:
			msg="退会する前にレンタルしている掲示板を削除する必要があります。<BR>掲示板の削除はマイページのイラストタブで編集を押すことで行うことができます。<BR>残りの掲示板数:"+str(your_bbs_count)
			if(is_english):
				msg="You must delete your BBS before withdraw.<br/>You have "+str(your_bbs_count)+" BBS yet."
			Alert.alert_msg_with_write(self,msg)
			return True

		return True
Пример #8
0
	def alert_msg_notfound(req):
		is_english=CssDesign.is_english(req)
		if(is_english):
			msg="Bbs not found"
		else:
			msg="掲示板が見つかりません。掲示板のURLが間違っている可能性があります。"
		Alert.alert_msg_with_write(req,msg)
Пример #9
0
	def initialize_template_value(self,user,user_id,page,request_page_mode,redirect_api,contents_only):
		search_api="search_tag"

		is_flat=True
		is_english=CssDesign.is_english(self)

		template_values = {
			'user': user,
			'order': None,
			'tag_list': None,
			'thread_list': None,
			'redirect_url': self.request.path,
			'page': page,
			'next_page': page+1,
			'next_query': "",
			'tag': None,
			'user_id': user_id,
			'tab': None,
			'bookmark': None,
			'illust_enable': False,
			'redirect_url': self.request.path,
			'regist_finish': False,
			'redirect_api': redirect_api,
			'search_api': search_api,
			'contents_only': contents_only,
			'search': None,
			'top_page': False,
			'use_masonry': True,
			'infinite_scroll_selecter': ".item",
			'flat_ui': is_flat,
			'is_english': is_english
		}
		return template_values
Пример #10
0
	def get(self):
		#移動
		if(self.request.host=="illust-book.appspot.com"):
			self.redirect(str("http://www.illustbook.net/"))
			return
	
		SetUtf8.set()

		#ホストチェック
		if SpamCheck.is_deny(self.request):
			self.response.set_status(401)
			return
		
		#メンテナンス画面
		is_maintenance=0
		if(MaintenanceCheck.is_appengine_maintenance()):
			is_maintenance=1
		
		#BBS COUNT
		cache=SiteAnalyzer.get_cache()
		bbs_n=cache["bbs_n"]
		illust_n=cache["illust_n"]
		
		#最近のタグ
		tag_list=SearchTag.get_recent_tag("search_tag")
		
		#デベロッパーオプション
		user = users.get_current_user()
		is_dev_enable=OwnerCheck.is_admin(user)

		#iPhoneモードかどうか
		is_iphone=CssDesign.is_iphone(self)

		#リダイレクト
		if(BbsConst.PINTEREST_MODE):
			if((user and OwnerCheck.is_admin(user)) or BbsConst.PINTEREST_MODE==2):
				return Pinterest.get_core(self,Pinterest.PAGE_MODE_NORMAL)

		#URL生成
		template_values = {
			'host': "./",
			'mes_bord_url': 'mes_bord',
			'new_url': 'create_new_thread',
			'bbs_n':bbs_n,
			'illust_n':illust_n,
			'tag_list':tag_list,
			'is_dev_enable':is_dev_enable,
			'is_maintenance': is_maintenance,
			'is_iphone': is_iphone,
			'user': user,
			'redirect_url': self.request.path,
			'top_page': True,
			'mode': "index"
		}

		path = '/html/index.html'
		self.response.out.write(template_select.render(path, template_values))
Пример #11
0
	def get(req,mode,header_enable):
		is_iphone=CssDesign.is_iphone(req)

		template_values = {
			'host': "./",
			'is_iphone': is_iphone,
			'user': users.get_current_user(),
			'redirect_url': req.request.path,
			'mode': mode,
			'header_enable': header_enable
		}

		path = '/html/portal.html'
		req.response.out.write(template_select.render(path, template_values))
Пример #12
0
	def get(self):
		try:
			bbs = db.get(self.request.get("bbs_key"))
		except:
			bbs=None
		try:
			thread = db.get(self.request.get("thread_key"))
		except:
			thread=None
		
		if(not bbs or not thread):
			self.response.out.write(Alert.alert_msg("削除対象が見つかりません。",self.request.host))
			return

		is_english=CssDesign.is_english(self)
		
		del_ok=0		
		if(self.request.get("del_key")):
			if(thread.delete_key):
				if(thread.delete_key==self.request.get("del_key")):
					del_ok=1
				else:
					msg="削除キーが一致しません。"
					if(is_english):
						msg="invalid key"
					self.response.out.write(Alert.alert_msg(msg,self.request.host))
					return;
		
		user = users.get_current_user()

		bbs_owner = not OwnerCheck.check(bbs,user)
		thread_owner=False
		if(user and user.user_id()==thread.user_id):
			thread_owner=True
		
		if(del_ok==0):
			if(not bbs_owner and not thread_owner and not OwnerCheck.is_admin(user)):
				self.response.out.write(Alert.alert_msg("削除権限がありません。",self.request.host))
				return

		DelThread.delete_thread_core(thread)

		bbs.cached_thumbnail_key=None
		bbs.put()

		ApiFeed.invalidate_cache()

		url=MappingId.get_usr_url("./",bbs)
		self.redirect(str(url))
Пример #13
0
	def get(self):
		is_iphone=CssDesign.is_iphone(self)

		page=1
		page_unit=20
		if(self.request.get("page")):
			page=int(self.request.get("page"))
		
		rank=Ranking.get_or_insert(BbsConst.THREAD_RANKING_KEY_NAME)
		ranking_mode=self.request.get("mode")
		
		ranking_id_list=rank.user_id_ranking_list[(page-1)*page_unit:page*page_unit]
		ranking_list=[]
		for user_id in ranking_id_list:
			obj=ApiObject.get_bookmark_of_user_id(user_id)
			if(obj):
				if(obj.disable_rankwatch):
					ranking_list.append(None)
					continue
				obj=ApiObject.create_user_object(self,obj)
				ranking_list.append(obj)

		user = users.get_current_user()
		user_rank=0
		if(user):
			rank=Ranking.get_by_key_name(BbsConst.THREAD_RANKING_KEY_NAME)
			if(rank):
				user_rank=rank.get_user_rank(user.user_id())

		template_values = {
			'host': "./",
			'is_iphone': is_iphone,
			'user': user,
			'user_rank': user_rank,
			'redirect_url': self.request.path,
			'mode': "ranking",
			'header_enable': False,
			'ranking_list': ranking_list,
			'ranking_mode': ranking_mode,
			'page': page,
			'page_unit': page_unit
		}

		path = '/html/portal.html'
		self.response.out.write(template_select.render(path, template_values))
Пример #14
0
	def get(self):
		host_url="http://"+MappingId.mapping_host(self.request.host)+"/"
		bbs_key=self.request.get("bbs_key")
		thread_key=self.request.get("thread_key")

		try:
			bbs = db.get(self.request.get("bbs_key"))
			thread = db.get(self.request.get("thread_key"))
		except:
			bbs = None
			thread = None
		
		if(bbs==None or thread==None):
			self.response.out.write(Alert.alert_msg("スレッドが見つかりません。",self.request.host))
			return
		
		image=thread.image_key#db.get(thread.image);
		width=400
		height=400
		if(image.width):
			width=image.width
		if(image.height):
			height=image.height
		if(self.request.get("width")):
			width=self.request.get("width")
		if(self.request.get("height")):
			height=self.request.get("height")
		
		if(CssDesign.is_iphone(self)==1):
			if(width>=300):
				height=300*height/width
				width=300
		
		template_values = {
		'host': host_url,
		'bbs': bbs,
		'bbs_key': bbs_key,
		'thread': thread,
		'thread_key': thread_key,
		'width': width,
		'height': height
		}		  
		path = '/html/moper/moper_embedded.htm'
		self.response.out.write(template_select.render(path, template_values))
Пример #15
0
	def _text_search(self,search,user,user_id,page,request_page_mode,redirect_api,contents_only):
		template_values=Pinterest.initialize_template_value(self,user,user_id,page,request_page_mode,redirect_api,contents_only)

		search_api="search_tag"
		unit=BbsConst.PINTEREST_PAGE_UNIT

		thread_list=SearchThread.search(search,page,unit,BbsConst.SEARCH_THREAD_INDEX_NAME)
		if(thread_list!=None):
			thread_list=ApiObject.create_thread_object_list(self,thread_list,"search")
			search_api_error=False
		else:
			search_api_error=True

		if(search=="empty"):
			thread_list=None

		if(search_api_error):
			#例外が起きた場合はTagSearchの結果を使う場合がある
			thread_list=Pinterest.get_tag_image(self,search,page,unit)["thread_list"]
			if(thread_list):
				search_api_error=False

		today=datetime.date.today()
		ranking_month_list=Pinterest._get_ranking_month_list(today,CssDesign.is_english(self))

		template_values['thread_list']=thread_list
		template_values['next_query']="search="+urllib.quote_plus(str(search))
		template_values['tag_list']=SearchTag.get_recent_tag(search_api)
		template_values['page_mode']="search"
		template_values['illust_enable']=True
		template_values['search']=search
		template_values['search_api_error']=search_api_error
		template_values['top_page']=True
		template_values['ranking_month_list']=ranking_month_list
		template_values['month_query']=""

		if(search=="empty"):
			order="new"
			Pinterest._update_event_list(self,template_values,order,contents_only)
			Pinterest._update_room_list(self,template_values,order,contents_only)
			Pinterest._update_tweet_list(self,template_values,order,contents_only)
			template_values["bbs_list"]=ApiFeed.feed_get_bbs_list(self,"hot",0,8)

		Pinterest._render_page(self,template_values)
Пример #16
0
	def get(self):
		SetUtf8.set()

		is_english=CssDesign.is_english(self)

		short=self.request.get('id')
		if(MappingId.key_format_check(short)):
			txt="IDは半角英数である必要があります。"
			if(is_english):
				txt="ID must be 16 characters or less"
			Alert.alert_msg_with_write(self,txt)
			return
		if(MappingId.check_capability(short,"")==0):
			txt="ID:"+short+"は既に登録されていて利用できません。"
			if(is_english):
				txt="ID:"+short+" is not available"
			Alert.alert_msg_with_write(self,txt)
			return
		txt="ID:"+short+"は利用可能です。"
		if(is_english):
			txt="ID:"+short+" is available"
		Alert.alert_msg_with_write(self,txt)
Пример #17
0
	def get(self):
		host_url=MappingId.mapping_host_with_scheme(self.request)+"/"
		bbs_key=self.request.get("bbs_key")
		thread_key=self.request.get("thread_key")
		try:
			bbs = db.get(self.request.get("bbs_key"))
		except:
			 bbs=None
		if(bbs==None):
			Alert.alert_msg_with_write(self,"ブックが見つかりません。")
			return

		ipad=CssDesign.is_tablet(self)
		iphone=CssDesign.is_iphone(self)
		if(ipad or iphone):
			Alert.alert_msg_with_write(self,"iPhoneやiPadでは動画お絵かきツールは使用できません。")
			return

		draw_time=0
		summary=""
		author=""
		title=""

		if(thread_key!=""):
			try:
				thread=db.get(thread_key)
			except:
				thread=None
			if(thread==None):
				Alert.alert_msg_with_write(self,"スレッドが見つかりません。")
				return
			draw_time=thread.draw_time

			summary=ReeditEscape.escape(thread.summary)
			author=ReeditEscape.escape(thread.author)
			title=ReeditEscape.escape(thread.title)

		canvas_url=self.request.get("canvas_url");
		if(canvas_url!=""):
			canvas_url=host_url+"moper_load?id="+canvas_url
			
		force=0
		canvas_width=400
		canvas_height=400
		if(self.request.get("canvas_width")):
			canvas_width=self.request.get("canvas_width")
		if(self.request.get("canvas_height")):
			canvas_height=self.request.get("canvas_height")
		if(self.request.get("force")):
			force=self.request.get("force")
		
		template_values = {
		'host': host_url,
		'bbs': bbs,
		'thread_key': thread_key,
		'bbs_key': bbs_key,
		'canvas_url': canvas_url,
		'canvas_width': canvas_width,
		'canvas_height': canvas_height,
		'force': force,
		'draw_time': draw_time,
		'summary': summary,
		'author': author,
		'title': title
		}
		path = '/html/tools/draw_window_moper.htm'
		self.response.out.write(template_select.render(path, template_values))
Пример #18
0
	def post(self):
		SetUtf8.set()
		is_english=CssDesign.is_english(self)

		#エラーコードはFlash向けかどうか
		is_flash=False
		if(self.request.get('image')):
			is_flash=True

		#書き込み対象のコメントを取得
		if(self.request.get("entry_key")):	#上書きモード
			entry = db.get(self.request.get("entry_key"))
			overwrite = True
		else:
			entry = Entry()
			overwrite = False
	
		#コメント
		if(self.request.get('comment')):
			entry.content = self.request.get('comment')
		else:
			if(self.request.get('image')):
				entry.content = ""
			else:
				if(is_english):
					self.write_status(is_flash,"Please input comment");
				else:
					self.write_status(is_flash,"コメントを入力して下さい。");
				return

		#名前
		if(self.request.get('author')):
			entry.editor = cgi.escape(self.request.get('author'))
		else:
			entry.editor = "no_name"
			if(is_english):
				self.write_status(is_flash,"Please input name");
			else:
				self.write_status(is_flash,"名前を入力して下さい。");
			return
			

		if(not self.request.get('image')):
			if(self.request.get("seed")!=BbsConst.SUBMIT_SEED):
				self.write_status(is_flash,"シードが一致しません。");
				return

		if(self.request.get('mail_addr')):
			entry.mail=self.request.get('mail_addr')
		else:
			entry.mail=""
		
		if(self.request.get('homepage_addr') and self.request.get('homepage_addr')!="http://"):
			entry.homepage_addr=self.request.get('homepage_addr')
		else:
			entry.homepage_addr=""

		user = users.get_current_user()

		thread=db.Key(self.request.get("thread_key"))
		bbs = db.get(self.request.get("bbs_key"))

		if(SpamCheck.check_all(self,entry.content,self.request.get("remote_host"),user,bbs,is_flash,is_english)):
			return

		#二重投稿ブロック
		if(entry.content!="" and memcache.get("add_entry_double_block")==entry.content):
			if(is_flash):
				self.write_status(is_flash,"二重投稿を検出しました。時間を置いて、再度、投稿して下さい。");
			else:
				url=MappingThreadId.get_thread_url("./",bbs,db.get(self.request.get("thread_key")))
				self.redirect(str(url))
			return
		
		#コメント禁止
		if(db.get(thread).prohibit_comment):
			self.write_status(is_flash,"このイラストへのコメントは禁止されています。");
			return
		
		#書き込み権限確認
		if(bbs.comment_login_require):
			if(not(user)):
				self.write_status(is_flash,"この掲示板ではコメントする際にログインが必須です。");
				return

		#上書き権限確認
		if(overwrite):
			bbs=db.get(self.request.get("bbs_key"))
			if(OwnerCheck.check(bbs,user)):
				if(user and entry.user_id!=user.user_id()):
					self.write_status(is_flash,"上書き投稿する権限がありません。");
					return
		
		#イラストの設定
		delete_thread_image=None
		if(self.request.get('image')):
			if(overwrite):
				delete_thread_image=entry.illust_reply_image_key
			timage=ThreadImage()
			timage.bbs_key=bbs

			if(self.request.get("base64") and self.request.get("base64")=="1"):
				timage.image=db.Blob(base64.b64decode(self.request.get("image")))
				timage.thumbnail=db.Blob(base64.b64decode(self.request.get("thumbnail")))
			else:
				timage.image=db.Blob(self.request.get("image"))
				timage.thumbnail=db.Blob(self.request.get("thumbnail"))
			timage.thumbnail2=None
			timage.illust_mode=1;
			try:
				timage.put()
			except:
				if(is_english):
					self.write_status(is_flash,"Too big image");
				else:
					self.write_status(is_flash,"画像サイズが大きすぎます。");
				return

			entry.illust_reply=1
			entry.illust_reply_image_key=timage
		else:
			entry.content=cgi.escape(entry.content)
			entry.content=EscapeComment.auto_link(entry.content)

		entry.content=EscapeComment.escape_br(entry.content)

		entry.thread_key = thread
		entry.bbs_key = bbs
		entry.del_flag = 1
		if(self.request.get("regulation")):
			entry.adult=int(self.request.get("regulation"))

		#プロフィールにリンクするか
		link_to_profile=StackFeed.is_link_to_profile(self)
		if(link_to_profile and user):
			entry.user_id=user.user_id()

		#スレッドを取得
		thread = db.get(self.request.get("thread_key"))

		#基本情報を設定
		if(not overwrite):
			self.set_basic_info(entry,thread)

		#保存
		if(not SyncPut.put_sync(entry)):
			message="コメントの投稿は成功しましたが表示が遅延しています。反映まで数分お待ちください。"
			memcache.set(BbsConst.OBJECT_THREAD_MESSAGE_HEADER+str(thread.key()),message,BbsConst.OBJECT_THREAD_MESSAGE_CACHE_TIME)
			memcache.set(BbsConst.OBJECT_BBS_MESSAGE_HEADER+str(bbs.key()),message,BbsConst.OBJECT_BBS_MESSAGE_CACHE_TIME)

		#スレッドと掲示板の情報を更新
		if(not overwrite):
			self.update_thread_and_bbs_information(thread,bbs,entry)

		#上書き投稿時の昔のイラストの削除
		if(delete_thread_image):
			delete_thread_image.delete()

		#ステータスコードを出力
		if(self.request.get('image')):
			self.response.headers ['Content-type'] = "text/html;charset=utf-8"  
			self.response.out.write("success")			
		else:
			url=MappingThreadId.get_thread_url("./",bbs,thread)
			if(self.request.get("redirect_url")):
				url=self.request.get("redirect_url")
			self.redirect(str(url))

		#二重投稿ブロック
		memcache.set("add_entry_double_block",self.request.get("comment"),30)
		
		#ランキング
		is_owner=False
		if(thread.user_id and entry.user_id and thread.user_id == entry.user_id):
			is_owner=True
		if(not is_owner): #自分のスレッドへのコメントはランキングに反映しない
			Ranking.add_rank_global(thread,BbsConst.SCORE_ENTRY)

		#フィード
		if(not link_to_profile):
			user=None
		try:
			StackFeed.feed_new_comment_thread(user,thread,entry)
		except:
			logging.error("new entry stackfeed add error")
Пример #19
0
	def post(self):
		is_flash=self.request.get('mode')=="illust" or self.request.get('mode')=="illust_all";
		is_english=CssDesign.is_english(self)

		if(self.request.get('thread_title')==""):
			if(is_english):
				self.write_status(is_flash,"Please input title");
			else:
				self.write_status(is_flash,"スレッドタイトルを入力して下さい。");
			return                        
		if(self.request.get('author')==""):
			if(is_english):
				self.write_status(is_flash,"Please input author");
			else:
				self.write_status(is_flash,"投稿者名を入力して下さい。");
			return

		permission_error_str="スレッドを作成する権限がありません。"
		if(is_english):
			permission_error_str="Permission denied"

		login_require="ログインが必要です。"
		if(is_english):
			login_require="Login require"

		bbs = db.get(self.request.get("bbs_key"))
		user = users.get_current_user()

		if(not user and self.request.get('mode')=="illust_all"):
			self.write_status(is_flash,login_require);
			return

		if(bbs.bbs_mode==BbsConst.BBS_MODE_ONLY_ADMIN):
			if(OwnerCheck.check(bbs,user)):
				self.write_status(is_flash,permission_error_str);
				return
		if(bbs.bbs_mode==BbsConst.BBS_MODE_NO_IMAGE):
			if(bbs.disable_create_new_thread==1):
				if(OwnerCheck.check(bbs,user)):
					self.write_status(is_flash,permission_error_str);
					return
			if(bbs.disable_create_new_thread==2):
				if(not user):
					self.write_status(is_flash,permission_error_str);
					return

		if(SpamCheck.check_all(self,self.request.get('thread_title'),self.request.get("remote_host"),user,bbs,is_flash,is_english)):
			return

		homepage_addr=""
		if(self.request.get('homepage_addr') and self.request.get('homepage_addr')!="http://"):
			homepage_addr=self.request.get('homepage_addr')
		
		overwrite_mode=False
		if(self.request.get("thread_key")):	#上書きモード
			#上書きの場合
			overwrite_mode=True
			new_thread=db.get(self.request.get("thread_key"))
			if(OwnerCheck.check(bbs,user)):
				if((not user) or (not new_thread.user_id) or new_thread.user_id!=user.user_id()):
					if(self.request.get("delete_key")!=new_thread.delete_key or new_thread.delete_key==""):
						self.write_status(is_flash,"上書きをする権限がありません。");
						return;
		else:
			#新規作成の場合
			new_thread = MesThread()
			new_thread.put()	#キーの確保
			
			new_thread.score = None
			
			new_thread.comment_cnt=0

			bbs.illust_n=bbs.illust_n+1
			bbs.cached_threads_num=None	#キャッシュ更新リクエスト
			bbs.put()
			
			#上書きモードの場合は作成日を更新しない
			new_thread.create_date=datetime.datetime.today()
		
		#更新日は更新する
		new_thread.date=datetime.datetime.today()
		
		#各種設定値を書き込み
		new_thread.illust_mode = int(self.request.get('illust_mode'))
		new_thread.title = cgi.escape(self.request.get('thread_title'))
		if(self.request.get('mode')=="illust_all"):
			new_thread.summary = self.request.get('comment')
		else:
			new_thread.summary = cgi.escape(self.request.get('comment'))
		new_thread.bbs_key = db.Key(self.request.get('bbs_key'))

		new_thread.summary=EscapeComment.escape_br(new_thread.summary)

		new_thread.homepage_addr=homepage_addr
		new_thread.author=self.request.get('author')
		if(self.request.get("draw_time")):
			new_thread.draw_time=int(self.request.get("draw_time"))
		if(self.request.get("delete_key")):
			new_thread.delete_key=self.request.get("delete_key")

		if(self.request.get("category")):
			new_thread.category=self.request.get("category")
			CategoryList.add_new_category(bbs,new_thread.category)

		if(self.request.get("event_id")):
			new_thread.event_id=self.request.get("event_id")

		if(self.request.get("regulation")):
			new_thread.adult=int(self.request.get("regulation"))

		if(self.request.get("dont_show_in_portal")):
			new_thread.violate_photo=1

		if(self.request.get("is_png")):
			new_thread.is_png=1
		else:
			new_thread.is_png=0
		
		#プロフィールにリンクするか
		link_to_profile=StackFeed.is_link_to_profile(self)
		if(link_to_profile and user):
			new_thread.user_id=user.user_id()
		
		#通常投稿モード(MOPER)
		if(self.request.get('mode')=="illust"):
			new_thread.image_key=db.get(self.request.get('thread_image'))
			new_thread.mail=self.request.get('thread_mail')

			compiled_line = re.compile("(http://[-_.!~*\'()a-zA-Z0-9;\/?:\@&=+\$,%#]+)")
			new_thread.summary = compiled_line.sub(r'<a href=\1 TARGET="_blank">\1</a>', new_thread.summary)

			if(user):
				new_thread.user_id=user.user_id()	#必ずプロフィールにマップ

		#一括投稿モード(新エディタ)
		timage=None
		if((self.request.get('mode')=="illust_all" or self.request.get('mode')=="illust_temp") and new_thread.illust_mode!=BbsConst.ILLUSTMODE_TEXT):
			timage=ThreadImage()
			timage.bbs_key=db.get(self.request.get("bbs_key"))
			
			if(self.request.get('mode')=="illust_temp"):
				try:
					temp_image=db.get(self.request.get("temp_illust_key"))
				except:
					temp_image=None
				if(not temp_image):
					self.write_status(is_flash,"画像データが見つかりません。")
					return
				timage.image=temp_image.image
				timage.thumbnail=temp_image.thumbnail
			else:
				if(self.request.get("base64") and self.request.get("base64")=="1"):
					timage.image=db.Blob(base64.b64decode(self.request.get("image")))
					timage.thumbnail=db.Blob(base64.b64decode(self.request.get("thumbnail")))
					new_thread.is_ipad=1
				else:
					timage.image=db.Blob(self.request.get("image"))
					timage.thumbnail=db.Blob(self.request.get("thumbnail"))
			
			if(len(timage.image)<=0 or len(timage.thumbnail)<=0):
				self.write_status(is_flash,"画像データが不正です。");
				return

			timage.illust_mode=new_thread.illust_mode
			timage.is_png=new_thread.is_png
			timage.thumbnail2=None

			try:
				timage.put()
			except:
				if(is_english):
					self.write_status(is_flash,"Too big image");
				else:
					self.write_status(is_flash,"画像の容量が大きすぎます。");
				return
			new_thread.image_key=timage
			ImageFile.invalidate_cache(str(timage.key()))

		#url assign
		MappingThreadId.assign(bbs,new_thread,False)
		
		#IPアドレスを書き込み
		new_thread.remote_addr=self.request.remote_addr
		new_thread.remote_host=self.request.get("remote_host")
		new_thread.thumbnail2_version=0
		new_thread.search_index_version=0

		#put
		if(not SyncPut.put_sync(new_thread)):
			message="イラストの投稿は成功しましたが表示が遅延しています。反映まで数分お待ちください。"
			memcache.set(BbsConst.OBJECT_BBS_MESSAGE_HEADER+str(bbs.key()),message,BbsConst.OBJECT_BBS_MESSAGE_CACHE_TIME)

		#サムネイル更新
		if(timage):
			if(new_thread.adult==0):
				bbs.cached_thumbnail_key=str(timage.key())
				bbs.put()

		#新着イラストのキャッシュ無効化
		RecentCommentCache.invalidate(bbs)
		
		#ステータスを出力
		if(is_flash):
			self.write_status(is_flash,"success")
		else:
			self.redirect(str('./bbs_index?bbs_key='+self.request.get('bbs_key')))
		
		#feed
		if(not link_to_profile):
			user=None
		url=self.get_thread_url(bbs,new_thread)

		if(not overwrite_mode):
			try:
				StackFeed.feed_new_thread(user,bbs,new_thread)
			except:
				logging.error("new thread stack feed add error")

		#submit thread count
		if(user):
			ApiUser.invalidate_thread_count(user.user_id())
		
		#news
		ApiFeed.invalidate_cache()

		#Rss
		RssFeed.invalidate_cache(str(bbs.key()))
Пример #20
0
	def ret(main,mode,app_key):

		is_play=0
		if(mode=="play"):
			is_play=1

		is_run=0
		if(mode=="run"):
			is_run=1
		
		is_code=0
		if(mode=="code"):
			is_code=1

		is_plugin=0
		if(mode=="plugin"):
			is_plugin=1
		
		is_portal=1
		if(is_play or is_code or is_run or is_plugin):
			is_portal=0
		
		app_list=AppPortal.get_app_list(is_portal)
		
		app=None
		if(app_key and (is_play or is_code or is_run or is_plugin)):
			app=db.get(app_key)

		plugin_code=AppPortal.get_plugin_code(main,app_key,app)
		
		app_code=""
		if(app):
			if(app.mode==2):
				app_code=app.css_code
			else:
				app_code=app.js_code
			if(AppPortal.add_support_forum(main,app)):
				return
		if(is_code):
			app_code=cgi.escape(app_code.encode("utf-8"))

		user = users.get_current_user()
		logined=0
		if(user):
			logined=1
		if user:
			url_log = users.create_logout_url(main.request.url)
		else:
			url_log = users.create_login_url(main.request.url)

		#iPhoneモードかどうか
		is_iphone=CssDesign.is_iphone(main)

		template_values = {
			'host': "./",
			'hot_app_list': app_list["hot_app"],
			'hot_plugin_list': app_list["hot_plugin"],
			'hot_css_list': app_list["hot_css"],
			'new_app_list': app_list["new_app"],
			'is_play': is_play,
			'is_portal': is_portal,
			'is_code': is_code,
			'app_code': app_code,
			'app': app,
			'plugin_code': plugin_code,
			'url_log': url_log,
			'logined': logined,
			'is_iphone': is_iphone,
			'user': users.get_current_user(),
			'redirect_url': main.request.path
		}
		
		url='/html/app.html'
		if(is_run or is_plugin):
			url='/html/app/app_run.html'
		
		path = url
		main.response.out.write(template_select.render(path, template_values))
Пример #21
0
	def alert_msg_with_write(req,msg):
		is_iphone=CssDesign.is_iphone(req)
		is_english=CssDesign.is_english(req)
		host_url=MappingId.mapping_host_with_scheme(req.request)+"/";
		req.response.out.write(Alert._alert_msg_core(msg,host_url,is_iphone,is_english))
Пример #22
0
	def create_feed_object(req,feed,user_hash,object_hash,feed_key):
		#フィードが削除された
		if(feed==None):
			deleted_feed={"mode":"deleted","from_user":"","to_user":"","follow_user":"","bbs":"","thread":"","message":"ツイートは削除されました。","create_date":"","key":str(feed_key)}
			return deleted_feed

		#送信元ユーザ取得
		from_user=""
		if(feed.from_user_id):
			from_user=user_hash[feed.from_user_id]

		#送信先ユーザ取得
		to_user=""
		if(feed.to_user_id):
			to_user=user_hash[feed.to_user_id]

		#フォローユーザ取得
		follow_user=""
		if(feed.user_key):
			follow_user=user_hash[feed.user_key]
		
		#イベント発生掲示板取得
		bbs_object_key=StackFeedData.bbs_key.get_value_for_datastore(feed)
		bbs=""
		bbs_object=None
		if(bbs_object_key):
			bbs_object=object_hash[bbs_object_key]
			if(bbs_object):
				bbs=ApiObject.create_bbs_object(req,bbs_object)
			else:
				bbs=None
			if(not bbs):
				bbs={"title":"","bbs_url":""}	#deleted bbs
			
		#イベント発生スレッド取得
		thread_object_key=StackFeedData.thread_key.get_value_for_datastore(feed)
		thread=""
		if(thread_object_key):
			thread_object=object_hash[thread_object_key]
			if(thread_object):
				only_image=False
				thread=ApiObject._create_thread_object_core(req,thread_object,bbs_object,only_image)
			else:
				thread=None
			if(not thread):
				thread={"title":"","thread_url":""}	#deleted thread

		#発生日取得
		is_english=CssDesign.is_english(req)
		create_date=TimeProgress.get_date_diff_str(feed.create_date,"",is_english)
		
		#コメントを取得
		message=feed.message
		entry=[]
		if(feed.feed_mode=="new_comment_thread"):
			entry_mes_obj=ApiObject._get_entry_comment(feed,object_hash)
			message=entry_mes_obj["message"]
			author=entry_mes_obj["author"]
			image_key=entry_mes_obj["image_key"]
			thumbnail_url=None
			thumbnail2_url=None
			if(image_key):
				if(req):
					url_header="http://"+req.request.host
				else:
					url_header="."
				thumbnail_url=url_header+"/thumbnail/"+str(image_key)+".jpg"
				thumbnail2_url=url_header+"/thumbnail2/"+str(image_key)+".jpg"
			entry={"key":str(StackFeedData.entry_key.get_value_for_datastore(feed)),"author":author,"thumbnail_url":thumbnail_url,"thumbnail2_url":thumbnail2_url}

		#オブジェクトを返す
		one_dic={"mode":feed.feed_mode,"from_user":from_user,"to_user":to_user,"follow_user":follow_user,"bbs":bbs,"thread":thread,"entry":entry,"message":message,"create_date":create_date,"key":str(feed.key())}
		return one_dic
Пример #23
0
	def get(self):
		SetUtf8.set()

		try:
			bbs = db.get(self.request.get("bbs_key"))
		except:
			Alert.alert_msg_with_write(self,"掲示板の取得に失敗しました。")
			return

		user = users.get_current_user()
		if(OwnerCheck.check(bbs,user) and not OwnerCheck.is_admin(user)):
			Alert.alert_msg_with_write(self,"削除する権限がありません。")
			return

		user = users.get_current_user()

		page=1
		if(self.request.get("page")):
			page=int(self.request.get("page"))

		order="new"
		if(self.request.get("order")):
			order=self.request.get("order")
		
		limit=20
		offset=(page-1)*limit

		query=db.Query(MesThread,keys_only=True)
		query.filter("bbs_key =",bbs)
		if(order=="new"):
			query.order("-create_date")
		else:
			query.order("create_date")

		thread_key_list=query.fetch(offset=offset,limit=limit)
		thread_list=[]
		for thread_key in thread_key_list:
			try:
				thread_list.append(db.get(thread_key))
			except:
				continue

		deleted_count=self.request.get("deleted_count")
		category_count=self.request.get("category_count")
		link_count=self.request.get("link_count")

		if(deleted_count):
			deleted_count=int(deleted_count)
		if(category_count):
			category_count=int(category_count)
		if(link_count):
			link_count=int(link_count)

		category_list=CategoryList.get_category_list(bbs)

		template_values = {
			'host': './',
			'bbs': bbs,
			'user': user,
			'thread_list': thread_list,
			'redirect_url': self.request.path,
			'page': page,
			'order': order,
			'deleted_count': deleted_count,
			'category_count': category_count,
			'link_count': link_count,
			'is_iphone': CssDesign.is_iphone(self),
			'is_tablet': CssDesign.is_tablet(self),
			'category_list': category_list,
			'is_english': CssDesign.is_english(self)
		}

		path = '/html/edit_thread_list.html'
		self.response.out.write(template_select.render(path, template_values))
Пример #24
0
	def _user_page(self,user,user_id,page,request_page_mode,redirect_api,contents_only):
		illust_enable=False
		submit_illust_exist=True
		submit_moper_exist=True
		bookmark_illust_exist=True
		thread_list=None

		#プロフィール
		bookmark=None
		if(user_id):
			bookmark=ApiObject.get_bookmark_of_user_id(user_id)

		#イラストの存在を検出
		submit_illust_count=ApiUser.user_get_is_submit_thread_exist(self,user_id,bookmark)
		submit_moper_count=ApiUser.user_get_is_submit_moper_exist(self,user_id,bookmark)
		bookmark_illust_count=ApiBookmark.bookmark_get_is_bookmark_thread_exist(self,user_id,bookmark)
		if(bookmark_illust_count==0):
			bookmark_illust_exist=False
		if(submit_illust_count==0):
			submit_illust_exist=False
		if(submit_moper_count==0):
			submit_moper_exist=False

		#マイユーザか
		view_mode=1
		if(user):
			if(user_id==user.user_id()):
				view_mode=0

		#管理モード
		if(self.request.get("admin")):
			if(OwnerCheck.is_admin(user)):
				view_mode=0

		#タブ
		tab=Pinterest._decide_default_tab(self,bookmark_illust_exist,submit_illust_exist,submit_moper_exist,view_mode,bookmark,user,request_page_mode)

		#フィード数の消化
		new_feed_count=Pinterest._get_new_feed_count(user,view_mode,bookmark)
		new_my_feed_count=Pinterest._get_new_my_feed_count(user,view_mode,bookmark)
		if(tab=="feed"):
			bookmark=Pinterest._consume_feed(user,view_mode,bookmark)

		#プロフィールを編集
		edit_profile=Pinterest.get_profile_for_edit(bookmark,view_mode)

		#編集モードかどうか
		edit_mode=0
		if(self.request.get("edit")):
			edit_mode=int(self.request.get("edit"))

		bookmark_bbs_list=None
		rental_bbs_list=None
		bookmark_mute_bbs_list=None
		if(tab=="bbs"):
			thread_list=None
			illust_enable=False
			bookmark_bbs_list=ApiBookmark.bookmark_get_bbs_list(self,user_id)
			bookmark_mute_bbs_list=ApiBookmark.bookmark_get_mute_bbs_list(self,user_id)
			rental_bbs_list=ApiUser.user_get_bbs_list(self,user_id)
		
		timeline=None
		timeline_unit=0
		use_masonry=True
		is_timeline_enable=0
		infinite_scroll_selecter=".item"
		if(tab=="feed" or tab=="timeline"):
			thread_list=None
			is_timeline_enable=1
			illust_enable=False
			if(tab=="feed" and not view_mode):
				timeline=ApiUser.user_get_home_timeline(self,user_id)
			else:
				timeline=ApiUser.user_get_timeline(self,user_id)
			timeline_unit=len(timeline)
			use_masonry=False
			infinite_scroll_selecter=".feed"
	
		only_one_page=False
		if(tab=="bookmark"):
			thread_list=ApiBookmark.bookmark_get_thread_list(self,user_id,bookmark)
			if(bookmark_illust_count<=BbsConst.PINTEREST_MYPAGE_PAGE_UNIT):
				only_one_page=True
	
		if(tab=="submit" or tab=="moper"):
			#イラストが消去されている場合を考慮してスレッドが見つかるまでページを進める
			if(tab=="submit"):
				max_page_src=submit_illust_count
			else:
				max_page_src=submit_moper_count
			max_page=(max_page_src+BbsConst.PINTEREST_MYPAGE_PAGE_UNIT-1)/BbsConst.PINTEREST_MYPAGE_PAGE_UNIT
			thread_list=[]

			original_page=page
			while(page<=max_page):
				limit=BbsConst.PINTEREST_MYPAGE_PAGE_UNIT
				offset=limit*(page-1)
				illust_mode=BbsConst.ILLUSTMODE_ILLUST
				if(tab=="moper"):
					illust_mode=BbsConst.ILLUSTMODE_MOPER
				thread_list=ApiUser.user_get_thread_list_core(self,user_id,offset,limit,illust_mode)
				if(len(thread_list)>=1):
					break
				page=page+1

			if(max_page<=1):
				only_one_page=True

			submit_illust_list=thread_list

			if(len(thread_list)==0 and original_page==1):
				ApiUser.invalidate_thread_count(user_id)	#削除した場合に0になったことを考慮
			
		page_mode="user"
		view_user=ApiUser.user_get_user(self,user_id,bookmark)
		view_user_profile=ApiUser.user_get_profile(self,user_id,bookmark)
		tag_list=None

		next_query="user_id="+user_id+"&amp;tab="+tab+"&amp;edit="+str(edit_mode)
		if(only_one_page):
			next_query=None
		
		only_icon=True
		if(edit_mode):
			only_icon=False

		follow=ApiUser.user_get_follow(self,user_id,only_icon,bookmark)
		follower=ApiUser.user_get_follower(self,user_id,only_icon)
		following=Pinterest.is_following(user,user_id,view_mode)
		age=Pinterest.get_age(bookmark)

		mute_user_list=[]
		mute_bbs_list=[]
		if(bookmark):
			mute_user_list=bookmark.get_mute_user_list()
			mute_bbs_list=bookmark.get_mute_bbs_list()

		#詳細情報の存在
		detail_exist=False
		if(bookmark):
			if(bookmark.sex or age):
				detail_exist=True
			if(bookmark.birthday_month or bookmark.birthday_day or bookmark.birthday_year):
				detail_exist=True
			if(bookmark.homepage or bookmark.mail or bookmark.twitter_id):
				detail_exist=True

		#凍結
		if(bookmark and bookmark.frozen):
			thread_list=None

		#アイコンの規約違反
		violate_icon=False
		if(bookmark):
			if(bookmark.thumbnail_created==2):
				violate_icon=True

		is_flat=True
		is_english=CssDesign.is_english(self)

		template_values = {
			'user': user,
			'thread_list': thread_list,
			'redirect_url': self.request.path,
			'page': page,
			'next_page': page+1,
			'next_query': next_query,
			'page_mode': page_mode,
			'tag': None,
			'view_user': view_user,
			'view_user_profile': view_user_profile,
			'user_id': user_id,
			'follow': follow,
			'follower': follower,
			'muting': mute_user_list,
			'mute_user_list': mute_user_list,
			'mute_bbs_list': mute_bbs_list,
			'view_mode': view_mode,
			'edit_mode': edit_mode,
			'tab': tab,
			'bookmark': bookmark,
			'is_timeline_enable': is_timeline_enable,
			'following':following,
			'bookmark_bbs_list': bookmark_bbs_list,
			'bookmark_mute_bbs_list': bookmark_mute_bbs_list,
			'rental_bbs_list': rental_bbs_list,
			'illust_enable': illust_enable,
			'edit_profile': edit_profile,
			'redirect_url': self.request.path,
			'new_feed_count': new_feed_count,
			'new_my_feed_count': new_my_feed_count,
			'submit_illust_exist': submit_illust_exist,
			'submit_moper_exist': submit_moper_exist,
			'bookmark_illust_exist': bookmark_illust_exist,
			'regist_finish': (request_page_mode==Pinterest.PAGE_MODE_REGIST),
			'redirect_api': redirect_api,
			'age': age,
			'contents_only': contents_only,
			'search': None,
			'top_page': False,
			'detail_exist': detail_exist,
			'is_admin': OwnerCheck.is_admin(user),
			'use_masonry': use_masonry,
			'timeline': timeline,
			'timeline_unit': timeline_unit,
			'infinite_scroll_selecter': infinite_scroll_selecter,
			'flat_ui': is_flat,
			'violate_icon': violate_icon,
			'is_english': is_english
		}
		Pinterest._render_page(self,template_values)
Пример #25
0
    def get(self):
        SetUtf8.set()

        page_name = ""
        mode = "access"
        if self.request.get("mode"):
            mode = self.request.get("mode")

        bbs = None

        user = None
        if page_name == "":
            try:
                bbs = db.get(self.request.get("bbs_key"))
            except:
                bbs = None
            if bbs == None:
                Alert.alert_msg_notfound(self)
                return

            user = users.get_current_user()
            if user:
                if bbs.user_id != user.user_id():
                    user = None

            page_name = bbs.bbs_name

        if self.request.get("start_date"):
            start_date = self.request.get("start_date")
            if not self.validate_date(start_date):
                Alert.alert_msg_with_write(self, "日付指定は0000-00-00形式である必要があります。")
                return
        else:
            start_date = str(datetime.date.today() + datetime.timedelta(days=-31))

        if self.request.get("end_date"):
            end_date = self.request.get("end_date")
            if not self.validate_date(end_date):
                Alert.alert_msg_with_write(self, "日付指定は0000-00-00形式である必要があります。")
                return
        else:
            end_date = str(datetime.date.today() + datetime.timedelta(days=-1))

        start_day = datetime.datetime.strptime(start_date, "%Y-%m-%d")
        end_day = datetime.datetime.strptime(end_date, "%Y-%m-%d")
        if start_day > end_day:
            Alert.alert_msg_with_write(self, "終了日よりも開始日の方が大きくなっています。")
            return

        bbs_id = bbs.short
        is_admin = OwnerCheck.is_admin(user)
        if is_admin:
            if self.request.get("bbs_id"):
                bbs_id = self.request.get("bbs_id")
                if bbs.short != bbs_id:
                    page_name = bbs_id

        page_list = None
        ref_list = None
        keyword_list = None
        access_list = None

        show_analyze = False
        if user or bbs.short == "sample":
            show_analyze = True

        if show_analyze:
            try:
                result = self.get_analytics(mode, bbs_id, start_date, end_date)
            except:
                time.sleep(1)
                try:
                    result = self.get_analytics(mode, bbs_id, start_date, end_date)
                except:
                    Alert.alert_msg_with_write(self, "Analytics APIへのアクセスに失敗しました。リロードして下さい")
                    logging.error("failed analytics api")
                    return

            if mode == "page":
                page_list = result
            if mode == "ref":
                ref_list = result
            if mode == "keyword":
                keyword_list = result
            if mode == "access":
                access_list = result

        quota_error = mode == "access" and not access_list

        redirect_api = (
            "analyze?start_date="
            + start_date
            + "&amp;end_date="
            + end_date
            + "&amp;bbs_id="
            + bbs_id
            + "&amp;bbs_key="
            + str(bbs.key())
            + "&amp;"
        )

        host_url = "./"
        template_values = {
            "host": host_url,
            "mode": mode,
            "redirect_api": redirect_api,
            "quota_error": quota_error,
            "bbs": bbs,
            "bbs_id": bbs_id,
            "page_name": page_name,
            "is_admin": is_admin,
            "user": user,
            "show_analyze": show_analyze,
            "ref_list": ref_list,
            "page_list": page_list,
            "keyword_list": keyword_list,
            "access_list": access_list,
            "start_date": start_date,
            "end_date": end_date,
            "is_iphone": CssDesign.is_iphone(self),
            "is_tablet": CssDesign.is_tablet(self),
            "is_english": CssDesign.is_english(self),
            "redirect_url": self.request.path,
        }
        path = "/html/analyze.html"
        self.response.out.write(template_select.render(path, template_values))
Пример #26
0
	def post(self):
		SetUtf8.set()

		mode = self.request.get("mode")
		name = self.request.get("name")
		profile = self.request.get("profile")
		homepage = self.request.get("homepage")
		mail = self.request.get("mail")
		twitter = self.request.get("twitter")
		birthday_year = self.request.get("birthday_year")
		birthday_month = self.request.get("birthday_month")
		birthday_day = self.request.get("birthday_day")

		regulation=0
		if(self.request.get("regulation_r15_nl")):
			regulation+=1
		if(self.request.get("regulation_r15_bl")):
			regulation+=2
		if(self.request.get("regulation_r15_gl")):
			regulation+=4

		privacy_rental_bbs=1
		if(self.request.get("privacy_rental_bbs")):
			privacy_rental_bbs=0

		disable_global_tweet=1
		if(self.request.get("privacy_tweet")):
			disable_global_tweet=0

		disable_rankwatch=1
		if(self.request.get("privacy_user_ranking")):
			disable_rankwatch=0

		if(disable_global_tweet):
			cache_id=BbsConst.OBJECT_CACHE_HEADER+BbsConst.OBJECT_TWEET_LIST_HEADER
			memcache.delete(cache_id)

		is_english=CssDesign.is_english(self)

		if(name==""):
			if(is_english):
				Alert.alert_msg_with_write(self,"No name");
			else:
				Alert.alert_msg_with_write(self,"名前がありません。");
			return

		#if(profile==""):
		#	Alert.alert_msg_with_write(self,"プロフィールがありません。");
		#	return

		user = users.get_current_user()
		if(not(user)):
			Alert.alert_msg_with_write(self,"ログインが必要です。");
			return
		
		bookmark=ApiObject.get_bookmark_of_user_id_for_write(user.user_id())
		if(bookmark==None):
			Alert.alert_msg_with_write(self,"プロフィールの取得に失敗しました。");
			return
		
		profile = cgi.escape(profile)
		compiled_line = re.compile("\r\n|\r|\n")
		profile = compiled_line.sub(r'<br/>', profile)

		if(mail=="None"):
			mail=""
		if(homepage=="None"):
			homepage=""
		if(twitter=="None"):
			twitter=""

		bookmark.name=name
		bookmark.profile=profile
		bookmark.mail=mail
		bookmark.twitter_id=twitter
		bookmark.homepage=homepage
		bookmark.owner=user
		bookmark.disable_rankwatch=disable_rankwatch
		bookmark.disable_global_tweet=disable_global_tweet
		bookmark.regulation=regulation
		bookmark.privacy_rental_bbs=privacy_rental_bbs

		if(self.request.get("my_color")=="" or self.request.get("my_color")=="#f2f2f2"):
			bookmark.my_color=None
		else:
			bookmark.my_color=self.request.get("my_color")
		
		bookmark.sex=int(self.request.get("sex"))

		if(birthday_year):
			try:
				birthday_year=int(birthday_year)
			except:
				if is_english:
					Alert.alert_msg_with_write(self,"Birthday must be number");
				else:
					Alert.alert_msg_with_write(self,"生まれた年は半角数字である必要があります。");
				return
		else:
			birthday_year=0

		if(birthday_month):
			try:
				birthday_month=int(birthday_month)
			except:
				if is_english:
					Alert.alert_msg_with_write(self,"Birthday must be number");
				else:
					Alert.alert_msg_with_write(self,"生まれた月は半角数字である必要があります。");
				return
		else:
			birthday_month=0
		
		if(birthday_day):
			try:
				birthday_day=int(birthday_day)
			except:
				if is_english:
					Alert.alert_msg_with_write(self,"Birthday must be number");
				else:
					Alert.alert_msg_with_write(self,"生まれた日は半角数字である必要があります。");
				return
		else:
			birthday_day=0
		
		bookmark.birthday_year=birthday_year
		bookmark.birthday_month=birthday_month
		bookmark.birthday_day=birthday_day
		
		bookmark.icon_mini=None	#サムネイルの再作成を要求
		bookmark.thumbnail_created=0

		age=Pinterest.get_age(bookmark)
		if(bookmark.regulation and age>=1 and age<=14):
			Alert.alert_msg_with_write(self,"制限付きコンテンツを表示するには15歳以上である必要があります。");
			return


		if(self.request.get("icon")):
			bookmark.icon=db.Blob(self.request.get("icon"))
			img = self.request.body_file.vars['icon']
			bookmark.icon_content_type=img.headers['content-type']
			if(not ApiObject.create_user_thumbnail(bookmark)):
				if is_english:
					Alert.alert_msg_with_write(self,"Too big icon image");
				else:
					Alert.alert_msg_with_write(self,"アイコン画像が大きすぎます。");
				return

		try:
			SyncPut.put_sync(bookmark)
		except:
			Alert.alert_msg_with_write(self,"データストアへの保存に失敗しました。アイコンの容量が1MBを超えている場合は縮小してからアップロードして下さい。");
			return

		self.redirect(str("./mypage"))
Пример #27
0
	def tool(self,user):
		bbs=None
		bbs_key=""
		thread_key=""

		if(self.request.get("key")=="always"):
			try:
				room_key=ChatRoom.all().filter("is_always =",1).fetch(1)[0].key()
			except:
				room_key=None
		else:
			room_key=self.request.get("key")
		if(not room_key):
			Alert.alert_msg_with_write(self,"ルームキーが必要です。")
			return

		ipad=CssDesign.is_tablet(self)
		viewmode=self.request.get("viewmode")
		password=self.request.get("pass")

		try:
			room=ChatRoom.get(room_key)#db.get(room_key)
		except:
			room=None

		alert_footer=""#<BR><A HREF='./chat'><IMG SRC='./static_files/chat/logo.png'/></A>"

		login_message=""
		if(not user):
			login_url=users.create_login_url(self.request.url)
			login_message="<BR><A HREF='"+login_url+"' class='g-button'>Googleアカウントでログイン</A><BR>"

		if(not room):
			Alert.alert_msg_with_write(self,"このチャットルームは終了されています。"+alert_footer)
			return
		
		if(room.password and room.password!=password):
			Alert.alert_msg_with_write(self,"チャットルームのパスワードが一致しません。"+alert_footer)
			return
		
		#if(not user):
		#	Alert.alert_msg_with_write(self,"チャットルームへの参加にはログインが必要です。<BR>"+login_message+alert_footer)
		#	return

		canvas_width=room.canvas_width
		canvas_height=room.canvas_height

		if(user):
			user_id=user.user_id()
			#user_name=self.get_user_name(user)
		else:
			user_id=0
		
		user_name=self.request.get("name")

		server_time=Chat.get_sec(datetime.datetime.now())
		
		if(user):
			bbs_list=Bbs.all().filter("user_id =",user.user_id()).filter("del_flag =",0).fetch(limit=10)
		else:
			bbs_list=None

		quote_name=urllib.quote_plus(str(user_name)).replace("%","-")
		client_id=str(user_id)+"_"+str(server_time)+"_"+quote_name
		token = channel.create_channel(client_id)

		#排他制御が必要
		Chat.add_user(room_key,client_id)

		template_values = {
		'host': "./",
		'bbs': bbs,
		'bbs_key': bbs_key,
		'thread_key': thread_key,
		'entry_key': "",
		'draw_time': "",
		'canvas_width': canvas_width,
		'canvas_height': canvas_height,
		'canvas_url': "",
		'reply': False,
		'summary': "",
		'author': "",
		'title': "",
		'chat': room_key,
		'ipad': ipad,
		'user_id':user_id,
		'user_name':user_name,
		'server_time':server_time,
		'bbs_list':bbs_list,
		'logined':True,
		'viewmode':viewmode,
		'room_name':room.name,
		'token':token,
		'client_id':client_id,
		'is_english':CssDesign.is_english(self)
		}
		
		path = '/html/tools/draw_window_ipad.htm'
		self.response.out.write(template_select.render(path, template_values))
Пример #28
0
	def get(self,bbs_key):
		#日本語対応
		SetUtf8.set()

		#英語版かどうか
		is_english=CssDesign.is_english(self)

		
		#メンテナンス中かどうか
		is_maintenance=0
		if(MaintenanceCheck.is_appengine_maintenance()):
			is_maintenance=1

		#掲示板を取得
		bbs=ShowBbs.get_bbs(self,bbs_key)
		if(bbs==None):
			return

		#掲示板削除チェック
		if(bbs.del_flag) :
			if(is_english):
				Alert.alert_msg_with_write(self,"This bbs was deleted.")
			else:
				Alert.alert_msg_with_write(self,"この掲示板は削除されました。")
			return

		#ページ取得
		page = 1
		if self.request.get("page"):
			try:
				page = int(self.request.get("page"))
			except:
				Alert.alert_msg_with_write(self,"ページ番号が異常です。")
				return
			if page<1 :
				page=1

		#描画順を取得
		order=ShowBbs.get_order(self,bbs)
		
		#カテゴリ取得
		category=""
		if(self.request.get("category")):
			category=self.request.get("category")
		
		#スレッド一覧を取得
		thread_query=ShowBbs.get_thread_query(bbs,category,order)
		
		#1ページのイラスト数を取得
		col_num=ShowBbs.get_col_num(bbs,order)

		#スレッド数とスレッドを取得
		count_limit=(BbsConst.PAGE_LIST_COUNT+page)*col_num	#ページ番号生成用にしか使わないのでページ番号のMaxがわかれば良い
		if(category==""):
			threads_num = bbs.cached_threads_num
		else:
			threads_num = thread_query.count(limit=count_limit)
		all_threads = thread_query.fetch(limit=col_num, offset=(page-1)*col_num)
		
		#返信イラストを取得
		all_entries = None
		#if(order=="thumbnail"):
		#	all_entries=ShowBbs.get_illust_reply(bbs,page,col_num)
		#	if(threads_num<all_entries["count"]):
		#		threads_num=all_entries["count"]
		#	all_entries=all_entries["entry"]
		
		#ホストURLを取得
		host_url="http://"+MappingId.mapping_host(self.request.host)+"/";
		
		#URLを作成
		mapped_category=urllib.quote(category.encode('utf-8'))
		page_url=MappingId.get_usr_url(host_url,bbs)
		page_url_base=MappingId.get_usr_url(host_url,bbs)+'?order='+order+'&amp;category='+mapped_category+'&amp;page='
		page_url_order_base=MappingId.get_usr_url(host_url,bbs)+'?page=1&amp;category='+mapped_category+'&amp;order='
		page_url_category_base=MappingId.get_usr_url(host_url,bbs)+'?page=1&amp;order='+order+"&amp;category="

		#ページリストを作成
		page_list=PageGenerate.generate_page(page,threads_num,col_num)
		
		#ログインユーザを取得
		user = users.get_current_user()

		logined=0
		if(user):
			logined=1
		
		owner=user
		if(OwnerCheck.check(bbs,user)):
			owner=None
		
		#サイドバーコメントを取得
		side_comment=RecentCommentCache.get_entry(bbs)
		side_thread=RecentCommentCache.get_thread(bbs)
		
		#カテゴリ一覧を取得
		category_list=None
		if(bbs.category_list):
			if(bbs.category_list!=""):
				category_list=CategoryList.get_category_list(bbs) #bbs.category_list.split(",")

		#ページデザインを取得
		css_key=self.request.get("css_key")
		design=CssDesign.get_design_object(self,bbs,host_url,0)

		#サイドバー一覧を作成
		sidebar_list=ShowBbs.get_sidebar(bbs,category_list,side_comment,side_thread)

		#新規スレッドを作成できるか
		can_create_thread=ShowBbs.get_can_create_thread(bbs,user,logined)
		can_create_new_image=ShowBbs.get_can_create_new_image(bbs,owner)

		#スレッドを全て取得
		all_threads_cached=ApiObject.get_cached_object_list(all_threads)
		
		#コメントフォームを表示するか
		show_comment_form=1
		if(bbs.comment_login_require and not(owner)):
			show_comment_form=0

		#フルコメントデバッグ
		if(self.request.get("full_comment")):
			bbs.enable_full_comment=1

		#フルフラット表示をデフォルト化
		if(bbs.bbs_mode==BbsConst.BBS_MODE_NO_IMAGE):
			bbs.enable_full_flat=0
			bbs.enable_full_comment=0
		else:
			bbs.enable_full_flat=1
			#bbs.enable_full_comment=1 #デフォルト化を止める

		#コメントを全て取得
		#user_name=""
		user_name=ShowEntry.get_user_name(user)
		if(bbs.enable_full_comment):
			admin_user=OwnerCheck.is_admin(user)
			ShowEntry.render_comment_list(self,all_threads_cached,host_url,bbs,show_comment_form,logined,admin_user,user_name,user)

		#デザインの編集ができるか
		can_edit_design=False
		is_admin=OwnerCheck.is_admin(user)
		if(owner or (is_admin and bbs.bbs_mode==BbsConst.BBS_MODE_EVERYONE)):
			can_edit_design=True

		#infinite_scrollを使用するかどうか
		infinite_scroll=False
		#if(bbs.bbs_mode!=BbsConst.BBS_MODE_NO_IMAGE):# and design["is_iphone"]):
		infinite_scroll=True

		#infinite_scrollの2ページ目以降
		contents_only=0
		if(self.request.get("contents_only")=="1"):
			contents_only=1

		#メッセージ
		message=memcache.get(BbsConst.OBJECT_BBS_MESSAGE_HEADER+str(bbs.key()))

		#カウントアップコメント
		if(bbs.counter):
			bbs.counter.new_day_update()
		count_up_comment=None
		#if(bbs.dont_count_owner):
		#	if(owner):
		#		count_up_comment="管理人"
		#	else:
		#		count_up_comment="ユーザ"

		#カテゴリリスト
		show_category_list=False
		if(self.request.get("show_category_list")=="1"):
			show_category_list=True

		#レンダリング
		template_values = {
			'host': host_url,
			'usrhost': MappingId.get_usr_url(host_url,bbs),
			'threads': all_threads_cached,
			'all_entries':all_entries,
			'bbs':bbs,
			'new_url': 'create_new_thread',
			'page':page,
			'page_url':page_url,
			'page_url_base':page_url_base,
			'order':order,
			'page_url_order_base':page_url_order_base,
			'page_list':page_list,
			'user':user,
			'owner': owner,
			'side_comment':side_comment,
			'side_thread':side_thread,
			'logined':logined,
			'can_create_thread':can_create_thread,
			'category_list':category_list,
			'page_url_category_base':page_url_category_base,
			'now_category':category,
			'can_create_new_image':can_create_new_image,
			'template_path':design["template_path"],
			'css_name':design["css_name"],
			'is_iphone':design["is_iphone"],
			'is_tablet':design["is_tablet"],
			'template_base_color':design["template_base_color"],
			'sidebar_list': sidebar_list,
			'is_maintenance': is_maintenance,
			'css_key': css_key,
			'redirect_url': self.request.path,
			'show_comment_form': show_comment_form,
			'user_name': user_name,
			'is_admin': is_admin,
			'can_edit_design': can_edit_design,
			'infinite_scroll': infinite_scroll,
			'infinite_scroll_selecter': ".entry",
			'contents_only': contents_only,
			'message': message,
			'is_english': is_english,
			'count_up_comment': count_up_comment,
			'show_category_list': show_category_list
		}

		path = "/html/"+design["base_name"]
		self.response.out.write(template_select.render(path, template_values))
		
		if(is_maintenance):
			return
		
		CounterWorker.update_counter(self,bbs,None,owner)
Пример #29
0
	def get(self,bbs_key,thread_key):
		SetUtf8.set()

		#ホストチェック
		if SpamCheck.is_deny(self.request):
			self.response.set_status(401)
			return

		#英語版かどうか
		is_english=CssDesign.is_english(self)

		#BBSを取得
		bbs_key=MappingId.mapping(bbs_key)
		bbs=ApiObject.get_cached_object(bbs_key)
		if(bbs == None):
			Alert.alert_msg_notfound(self)
			return

		#BBSが削除されていた場合
		if(bbs.del_flag) :
			if(is_english):
				Alert.alert_msg_with_write(self,"This bbs was deleted.")
			else:
				Alert.alert_msg_with_write(self,"このBBSは削除されました。")
			return
		
		#ページ番号を取得
		col_num = 10
		page = 1
		if self.request.get("page"):
			page = int(self.request.get("page"))
			if page < 1:
				page=1
		
		#メンテナンス画面
		is_maintenance=0
		if(MaintenanceCheck.is_appengine_maintenance()):
			is_maintenance=1

		#オーダー取得
		order="update"
		if(bbs.default_comment_order==1):
			order="new"
		if self.request.get("order"):
			order=self.request.get("order")
		
		#スレッド取得
		thread=ShowThread.get_thread(bbs,thread_key)
		if(thread == None):
			Alert.alert_msg_notfound(self)
			return

		#コメント数を更新
		if(bbs.page_comment_n):
			col_num=bbs.page_comment_n
		if(self.request.get("limit")):
			col_num=int(self.request.get("limit"))

		#コメントの一覧を取得
		query=ShowThread.get_comment_query(thread,order)
		entry_num = query.count()
		if(entry_num==0):
			com_list_ = []
		else:
			com_list_ = query.fetch(limit=col_num, offset=(page-1)*col_num)
		
		#検索
		search=""
		if(self.request.get("search")):
			search=self.request.get("search")
			query=""+search+' thread_key:"'+str(thread.key())+'"'
			com_list_=SearchThread.search(query,page,col_num,BbsConst.SEARCH_ENTRY_INDEX_NAME)
		
		#実体への変換
		com_list_=ApiObject.get_cached_object_list(com_list_)

		#現在のスレッドへのURLを取得
		host_url=MappingId.mapping_host_with_scheme(self.request)+"/"
		
		#編集モードか
		user = users.get_current_user()
		edit_flag = 0
		if(not OwnerCheck.check(bbs,user)):
			edit_flag = 1

		logined=0
		if(user):
			logined=1

		owner=user
		if(OwnerCheck.check(bbs,user)):
			owner=None

		admin_user=OwnerCheck.is_admin(user)

		#ページリンクを作成
		page_url_base = MappingId.get_usr_url(host_url,bbs)+thread_key+'.html?page='
		page_list=ShowThread.create_page_list(page,entry_num,col_num)
		
		#掲示板のデザインを取得
		design=CssDesign.get_design_object(self,bbs,host_url,1)

		#コメントフォームを取得する
		show_comment_form=1
		if(bbs.comment_login_require and not(owner)):
			show_comment_form=0
		
		#名前取得
		user_name=ShowEntry.get_user_name(user)
		
		#自分のイラストか
		my_illust=False
		if(user and thread.user_id==user.user_id()):
			my_illust=True

		#IPを表示するかどうか
		show_ip=False
		if(self.request.get("show_ip") and (owner or admin_user)):
			show_ip=True

		#コメントのレンダリング
		comment=ShowEntry.render_comment(self,host_url,bbs,thread,com_list_,edit_flag,bbs_key,logined,show_comment_form,admin_user,user_name,user,show_ip)
		
		#凍結されているか
		frozen=ApiObject.is_frozen_thread(thread)

		#拍手が有効かどうか
		applause_enable=not (user and thread.user_id and thread.user_id==user.user_id())

		#メッセージ
		message=memcache.get(BbsConst.OBJECT_THREAD_MESSAGE_HEADER+str(thread.key()))

		#関連イラスト
		related=self._get_related(bbs,thread,design["is_iphone"],design["is_tablet"])

		#スパム対策
		force_login_to_create_new_image=BbsConst.FORCE_LOGIN_TO_CREATE_NEW_IMAGE
		force_login_to_create_new_comment=BbsConst.FORCE_LOGIN_TO_CREATE_NEW_COMMENT

		#描画
		template_values = {
			'host': host_url,
			'usrhost': MappingId.get_usr_url(host_url,bbs),
			'bbs': bbs,
			'bbs_str_key': str(bbs.key()),
			'thread': thread,
			'edit_flag':edit_flag,
			'url': 'edit',
			'url_linktext': 'edit blogs',
			'bbs_key': bbs_key,
			'page':page,
			'page_url_base':page_url_base,
			'page_list':page_list,
			'logined':logined,
			'user':user,
			'owner':owner,
			'my_illust':my_illust,
			'template_path':design["template_path"],
			'css_name':design["css_name"],
			'is_iphone':design["is_iphone"],
			'is_tablet':design["is_tablet"],
			'template_base_color':design["template_base_color"],
			'admin_user':admin_user,
			'order':order,
			'is_maintenance':is_maintenance,
			'redirect_url': self.request.path,
			'comment':comment,
			'show_comment_form':show_comment_form,
			'user_name':user_name,
			'search': search,
			'limit': col_num,
			'frozen': frozen,
			'applause_enable': applause_enable,
			'message': message,
			'is_english': is_english,
			'related': related,
			'show_ip': show_ip,
			'force_login_to_create_new_image': force_login_to_create_new_image,
			'force_login_to_create_new_comment': force_login_to_create_new_comment
			}

		path = "/html/"+design["base_name"]
		self.response.out.write(template_select.render(path, template_values))

		CounterWorker.update_counter(self,bbs,thread,owner)
Пример #30
0
	def _index(self,user,user_id,page,request_page_mode,redirect_api,contents_only):
		unit=BbsConst.PINTEREST_PAGE_UNIT

		order="new"
		if(self.request.get("order")):
			order=self.request.get("order")

		month_query=""
		if(self.request.get("query")):
			month_query=self.request.get("query")

		search_api="search_tag"
		ranking_month_list=[]
		search_api_error=False

		if(order=="monthly"):
			if(month_query):
				today=datetime.datetime.strptime(month_query,"%Y-%m-%d")
			else:
				today=datetime.date.today()

			ranking_month_list=Pinterest._get_ranking_month_list(today,CssDesign.is_english(self))
			thread_list=ApiFeed.feed_get_ranking_thread_list(month_query,page,unit)

			if(thread_list!=None):
				thread_list=ApiObject.create_thread_object_list(self,thread_list,"search")
				search_api_error=False
			else:
				search_api_error=True
		else:
			if(order=="lecture"):
				search_str="tag = 講座 OR category = 講座"
				no_reduct=False	#日付における重み付けを外すか
				thread_list=SearchThread.search(search_str,page,unit,BbsConst.SEARCH_THREAD_INDEX_NAME,no_reduct)
				if(thread_list!=None):
					thread_list=ApiObject.create_thread_object_list(self,thread_list,"search")
					search_api_error=False
				else:
					search_api_error=True
			else:
				if(order=="chat"):
					thread_list=None
				else:
					thread_list=ApiFeed.feed_get_thread_list(self,order,(page-1)*unit,unit)
		
		bbs_list=None
		if(order=="hot" and not contents_only):
			bbs_list=ApiFeed.feed_get_bbs_list(self,"hot",0,8)

		recent_tag=None
		if(order=="hot" and not contents_only):
			recent_tag=SearchTag.get_recent_tag(search_api)

		my_color_bookmark=None
		if(user):
			my_color_bookmark=ApiObject.get_bookmark_of_user_id(user.user_id())

		mute_bbs_list=[]
		mute_user_list=[]
		if(my_color_bookmark):
			mute_bbs_list=my_color_bookmark.get_mute_bbs_list()
			mute_user_list=my_color_bookmark.get_mute_user_list()

		template_values=Pinterest.initialize_template_value(self,user,user_id,page,request_page_mode,redirect_api,contents_only)
		template_values['thread_list']=thread_list
		template_values['next_query']="order="+order+"&amp;query="+month_query
		template_values['tag_list']=recent_tag
		template_values['top_page']=True
		template_values['order']=order
		template_values['page_mode']="index"
		template_values['illust_enable']=True
		template_values['bbs_list']=bbs_list
		template_values['ranking_month_list']=ranking_month_list
		template_values['month_query']=month_query
		template_values['search_api_error']=search_api_error

		template_values['bookmark']=my_color_bookmark
		template_values['mute_bbs_list']=mute_bbs_list
		template_values['mute_user_list']=mute_user_list

		Pinterest._update_event_list(self,template_values,order,contents_only)
		Pinterest._update_room_list(self,template_values,order,contents_only)
		Pinterest._update_tweet_list(self,template_values,order,contents_only)
		
		template_values['is_admin']=OwnerCheck.is_admin(user)

		Pinterest._render_page(self,template_values)