Fix vulnerable.

This commit is contained in:
BoHung Chiu 2022-10-24 18:04:57 +08:00
parent 8b71e8e54f
commit 9cb912be75
1 changed files with 2 additions and 2 deletions

View File

@ -3,14 +3,14 @@ class PageContentsController < OrbitAdminController
def index
params = OrbitHelper.params
if params["wiki"].present?
page = WikiPage.where(:uid => params["wiki"]).first
page = WikiPage.where(:uid => params["wiki"].to_s).first
page.view_count += 1
page.save
name = page.title rescue ""
html = page.content rescue ""
url_to_edit = OrbitHelper.user_can_edit?(page) ? "/admin/wiki_pages/#{page.id}/edit?page_id=#{page.page.id.to_s}" : ""
else
page = Page.where(:page_id => params[:page_id]).first
page = Page.where(:page_id => params[:page_id].to_s).first
name = page.name rescue ""
html = page.page_contexts.order(:version=>-1).first.content rescue ""
url_to_edit = OrbitHelper.user_can_edit?(page) ? "/admin/page_contents/new?page_id=#{page.id.to_s}" : ""