From c8c6cddb1fe23276928b123879fed52f1af84215 Mon Sep 17 00:00:00 2001 From: Owen Date: Tue, 1 Sep 2015 12:32:09 -0400 Subject: [PATCH] - fixed ssl for facebook - changed plugins list for documentation link - added crop and resize function --- app/helpers/uploader_helper.rb | 8 +++--- .../admin/plugins/_plugins_list.html.erb | 25 ++----------------- config/initializers/fix_ssl.rb | 12 ++++++--- 3 files changed, 15 insertions(+), 30 deletions(-) diff --git a/app/helpers/uploader_helper.rb b/app/helpers/uploader_helper.rb index 4ced0442b..abcd7ae68 100644 --- a/app/helpers/uploader_helper.rb +++ b/app/helpers/uploader_helper.rb @@ -37,7 +37,7 @@ def upload_file(uploaded_io, settings = {}) settings[:folder] = settings[:folder].to_s if settings[:create_folder] && !File.directory?(settings[:folder]) FileUtils.mkdir_p(settings[:folder]) - FileUtils.chmod(0655, settings[:folder]) + FileUtils.chmod(0777, settings[:folder]) end # folder validation @@ -157,7 +157,7 @@ def crop_image(file, w, h, w_offset, h_offset, resize = nil ) # h: (Integer) height # gravity: (Sym, default :north_east) Crop position: :north_west, :north, :north_east, :east, :south_east, :south, :south_west, :west, :center # overwrite: (Boolean, default true) true for overwrite current image with resized resolutions, false: create other file called with prefix "crop_" - # Return: Image object + # Return: (String) file path where saved this cropped def cama_resize_and_crop(file, w, h, settings = {}) settings = {gravity: :north_east, overwrite: true}.merge(settings) img = MiniMagick::Image.open(file) @@ -182,8 +182,8 @@ def cama_resize_and_crop(file, w, h, settings = {}) end img.write(file) if settings[:overwrite] - img.write(uploader_verify_name(File.join(File.dirname(file), "crop_#{File.basename(file)}"))) unless settings[:overwrite] - img + img.write(file = uploader_verify_name(File.join(File.dirname(file), "crop_#{File.basename(file)}"))) unless settings[:overwrite] + file end private diff --git a/app/views/admin/plugins/_plugins_list.html.erb b/app/views/admin/plugins/_plugins_list.html.erb index 329acb696..aba16396b 100644 --- a/app/views/admin/plugins/_plugins_list.html.erb +++ b/app/views/admin/plugins/_plugins_list.html.erb @@ -18,7 +18,7 @@ <%= plugin["title"] %>
- <% r[:links] << (link_to("#{t('admin.sidebar.information')}", plugin_asset_path(plugin["key"], "docs/index.html"), onclick: "do_modal_plugin2(this, '#{plugin["title"]}'); return false;", title: "#{plugin["title"]}")) if File.exist?(File.join(plugin["path"], "assets", "docs/index.html")) %> + <% r[:links] << (link_to("#{t('admin.sidebar.information')}", "http://camaleon.tuzitio.com/store/plugins/info/#{plugin["key"]}", target: "_blank", title: "#{plugin["title"]}")) %> <% hook_run(plugin, "plugin_options", r) if status %> <%= raw r[:links].join(" | ") %> @@ -27,8 +27,6 @@ <%= t("admin.plugins.status_#{status}") %> <%= link_to raw(""), {action: :toggle, id: plugin["key"], status: status }, class: "btn btn-default btn-xs", title: "#{status ? t('admin.button.disable_plugin') : t('admin.button.activate_plugin') }" %> - <%#= link_to raw(''), { action: :destroy, id: plugin["key"] }, - method: :delete, data: { confirm: t('admin.message.delete_item') }, class: "btn btn-danger btn-xs", title: "#{t('admin.button.delete')}" if plugin_can_be_deleted?(plugin["key"]) %> <% end %> @@ -37,23 +35,4 @@ <%= content_tag("div", raw(t('admin.message.data_found_list')), class: "alert alert-warning") if plugins.empty? %> - - - - + \ No newline at end of file diff --git a/config/initializers/fix_ssl.rb b/config/initializers/fix_ssl.rb index b7f7e5ba8..fb9456462 100644 --- a/config/initializers/fix_ssl.rb +++ b/config/initializers/fix_ssl.rb @@ -8,12 +8,18 @@ class HTTP # fix ssl for facebook connection def use_ssl=(flag) if @address.include?("facebook.com") - self.ca_file = Rails.root.join('lib/ca-bundle.crt').to_s + self.ca_file = File.join($camaleon_engine_dir, 'lib/ca-bundle.crt').to_s self.verify_mode = OpenSSL::SSL::VERIFY_PEER self.original_use_ssl = flag - else - super + + else # original method + flag = flag ? true : false + if started? and @use_ssl != flag + raise IOError, "use_ssl value changed, but session already started" + end + @use_ssl = flag end + end end end \ No newline at end of file