Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Redmine 3.2.x support #27

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
end
else
RedmineApp::Application.routes.draw do
match 'projects/:id/wiki/decode', :to => 'redmine_wikicipher', :action => 'decode'
get 'projects/:id/wiki/decode', :to => 'redmine_wikicipher', :action => 'decode'
end
end
4 changes: 2 additions & 2 deletions lib/redmine_wikicipher/hooks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ def view_wiki_contextual(context={ })
current = current.title

if context[:toggle]=='1'
link = "<a href=\"/projects/"+context[:id]+"/wiki/"+current+"?version="+context[:version].to_s+"&decode="+context[:toggle]+"\" class=\"icon icon-decrypt\"><%= t 'redmine_wikicipher.decode' %></a>"
link = "<a href=\""+projects_path+"/"+context[:id]+"/wiki/"+current+"?version="+context[:version].to_s+"&decode="+context[:toggle]+"\" class=\"icon icon-decrypt\"><%= t 'redmine_wikicipher.decode' %></a>"
link = link.force_encoding("UTF-8")
else
link = "<a href=\"/projects/"+context[:id]+"/wiki/"+current+"?version="+context[:version].to_s+"&decode="+context[:toggle]+"\" class=\"icon icon-encrypt\"><%= t 'redmine_wikicipher.encode' %></a>"
link = "<a href=\""+projects_path+"/"+context[:id]+"/wiki/"+current+"?version="+context[:version].to_s+"&decode="+context[:toggle]+"\" class=\"icon icon-encrypt\"><%= t 'redmine_wikicipher.encode' %></a>"
link = link.force_encoding("UTF-8")
end
hideLink=1
Expand Down
12 changes: 6 additions & 6 deletions lib/wiki_controller_patch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def encrypt(originalText)
def decrypt(encodedContent)
e = OpenSSL::Cipher::Cipher.new 'DES-EDE3-CBC'
e.decrypt $key
s = encodedContent.to_a.pack("H*").unpack("C*").pack("c*")
s = Array(encodedContent).pack("H*").unpack("C*").pack("c*")
s = e.update s
decoded = s << e.final
return decoded
Expand Down Expand Up @@ -171,11 +171,11 @@ def show_with_decryption
if User.current.allowed_to?(:export_wiki_pages, @project)
if params[:format] == 'pdf'
params[:decode]='1'
@content.text = decodeContent(@content.text,params,0,1);
clone = @page.clone
clone.content = @content
send_data(wiki_page_to_pdf(clone, @project), :type => 'application/pdf', :filename => "#{clone.title}.pdf")
@content.text = decodeContent(@content.text,params,0,1);
@page = @page.dup
@page.content = @content
#send_data(wiki_page_to_pdf(clone, @project), :type => 'application/pdf', :filename => "#{clone.title}.pdf")
send_file_headers! :type => 'application/pdf', :filename => "#{@page.title}.pdf"
return
elsif params[:format] == 'html'
params[:decode]='1'
Expand Down