publify_core 9.0.0.pre6 → 9.2.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of publify_core might be problematic. Click here for more details.
- checksums.yaml +5 -5
- data/CHANGELOG.md +103 -8
- data/README.md +9 -0
- data/app/assets/javascripts/bootstrap-sprockets.js +8 -0
- data/app/assets/javascripts/bootstrap/affix.js +164 -0
- data/app/assets/javascripts/bootstrap/alert.js +95 -0
- data/app/assets/javascripts/bootstrap/button.js +125 -0
- data/app/assets/javascripts/bootstrap/collapse.js +212 -0
- data/app/assets/javascripts/bootstrap/dropdown.js +165 -0
- data/app/assets/javascripts/bootstrap/modal.js +358 -0
- data/app/assets/javascripts/bootstrap/tab.js +155 -0
- data/app/assets/javascripts/bootstrap/transition.js +59 -0
- data/app/assets/javascripts/lightbox.js +4 -4
- data/app/assets/javascripts/publify_admin.js +1 -35
- data/app/assets/stylesheets/_bootstrap-compass.scss +9 -0
- data/app/assets/stylesheets/_bootstrap-mincer.scss +19 -0
- data/app/assets/stylesheets/_bootstrap-sprockets.scss +9 -0
- data/app/assets/stylesheets/_bootstrap.scss +42 -0
- data/app/assets/stylesheets/administration_structure.css.scss +1 -45
- data/app/assets/stylesheets/bootstrap/_alerts.scss +73 -0
- data/app/assets/stylesheets/bootstrap/_button-groups.scss +242 -0
- data/app/assets/stylesheets/bootstrap/_buttons.scss +168 -0
- data/app/assets/stylesheets/bootstrap/_close.scss +37 -0
- data/app/assets/stylesheets/bootstrap/_code.scss +69 -0
- data/app/assets/stylesheets/bootstrap/_component-animations.scss +38 -0
- data/app/assets/stylesheets/bootstrap/_dropdowns.scss +213 -0
- data/app/assets/stylesheets/bootstrap/_forms.scss +586 -0
- data/app/assets/stylesheets/bootstrap/_grid.scss +94 -0
- data/app/assets/stylesheets/bootstrap/_labels.scss +66 -0
- data/app/assets/stylesheets/bootstrap/_media.scss +66 -0
- data/app/assets/stylesheets/bootstrap/_mixins.scss +37 -0
- data/app/assets/stylesheets/bootstrap/_modals.scss +150 -0
- data/app/assets/stylesheets/bootstrap/_navbar.scss +479 -0
- data/app/assets/stylesheets/bootstrap/_navs.scss +242 -0
- data/app/assets/stylesheets/bootstrap/_normalize.scss +427 -0
- data/app/assets/stylesheets/bootstrap/_pagination.scss +86 -0
- data/app/assets/stylesheets/bootstrap/_panels.scss +222 -0
- data/app/assets/stylesheets/bootstrap/_print.scss +99 -0
- data/app/assets/stylesheets/bootstrap/_scaffolding.scss +160 -0
- data/app/assets/stylesheets/bootstrap/_tables.scss +234 -0
- data/app/assets/stylesheets/bootstrap/_theme.scss +224 -0
- data/app/assets/stylesheets/bootstrap/_type.scss +296 -0
- data/app/assets/stylesheets/bootstrap/_utilities.scss +55 -0
- data/app/assets/stylesheets/bootstrap/_variables.scss +638 -0
- data/app/assets/stylesheets/bootstrap/_wells.scss +29 -0
- data/app/assets/stylesheets/bootstrap/mixins/_alerts.scss +15 -0
- data/app/assets/stylesheets/bootstrap/mixins/_background-variant.scss +12 -0
- data/app/assets/stylesheets/bootstrap/mixins/_border-radius.scss +18 -0
- data/app/assets/stylesheets/bootstrap/mixins/_buttons.scss +56 -0
- data/app/assets/stylesheets/bootstrap/mixins/_center-block.scss +7 -0
- data/app/assets/stylesheets/bootstrap/mixins/_clearfix.scss +22 -0
- data/app/assets/stylesheets/bootstrap/mixins/_forms.scss +82 -0
- data/app/assets/stylesheets/bootstrap/mixins/_gradients.scss +56 -0
- data/app/assets/stylesheets/bootstrap/mixins/_grid-framework.scss +81 -0
- data/app/assets/stylesheets/bootstrap/mixins/_grid.scss +122 -0
- data/app/assets/stylesheets/bootstrap/mixins/_hide-text.scss +21 -0
- data/app/assets/stylesheets/bootstrap/mixins/_image.scss +28 -0
- data/app/assets/stylesheets/bootstrap/mixins/_labels.scss +12 -0
- data/app/assets/stylesheets/bootstrap/mixins/_nav-divider.scss +10 -0
- data/app/assets/stylesheets/bootstrap/mixins/_nav-vertical-align.scss +9 -0
- data/app/assets/stylesheets/bootstrap/mixins/_opacity.scss +7 -0
- data/app/assets/stylesheets/bootstrap/mixins/_pagination.scss +24 -0
- data/app/assets/stylesheets/bootstrap/mixins/_panels.scss +20 -0
- data/app/assets/stylesheets/bootstrap/mixins/_reset-filter.scss +8 -0
- data/app/assets/stylesheets/bootstrap/mixins/_resize.scss +6 -0
- data/app/assets/stylesheets/bootstrap/mixins/_responsive-visibility.scss +17 -0
- data/app/assets/stylesheets/bootstrap/mixins/_size.scss +10 -0
- data/app/assets/stylesheets/bootstrap/mixins/_tab-focus.scss +9 -0
- data/app/assets/stylesheets/bootstrap/mixins/_table-row.scss +28 -0
- data/app/assets/stylesheets/bootstrap/mixins/_text-emphasis.scss +12 -0
- data/app/assets/stylesheets/bootstrap/mixins/_text-overflow.scss +8 -0
- data/app/assets/stylesheets/bootstrap/mixins/_vendor-prefixes.scss +222 -0
- data/app/assets/stylesheets/lightbox.css +3 -3
- data/app/assets/stylesheets/publify_admin.css.scss +0 -1
- data/app/controllers/accounts_controller.rb +2 -0
- data/app/controllers/admin/base_controller.rb +8 -22
- data/app/controllers/admin/content_controller.rb +69 -48
- data/app/controllers/admin/dashboard_controller.rb +20 -74
- data/app/controllers/admin/feedback_controller.rb +45 -36
- data/app/controllers/admin/notes_controller.rb +16 -10
- data/app/controllers/admin/pages_controller.rb +20 -34
- data/app/controllers/admin/post_types_controller.rb +7 -5
- data/app/controllers/admin/profiles_controller.rb +15 -5
- data/app/controllers/admin/redirects_controller.rb +9 -5
- data/app/controllers/admin/resources_controller.rb +7 -4
- data/app/controllers/admin/seo_controller.rb +12 -10
- data/app/controllers/admin/settings_controller.rb +7 -5
- data/app/controllers/admin/sidebar_controller.rb +7 -5
- data/app/controllers/admin/tags_controller.rb +7 -3
- data/app/controllers/admin/themes_controller.rb +10 -7
- data/app/controllers/admin/users_controller.rb +10 -7
- data/app/controllers/articles_controller.rb +92 -81
- data/app/controllers/authors_controller.rb +6 -3
- data/app/controllers/base_controller.rb +9 -11
- data/app/controllers/comments_controller.rb +15 -16
- data/app/controllers/content_controller.rb +12 -19
- data/app/controllers/feedback_controller.rb +7 -39
- data/app/controllers/notes_controller.rb +6 -6
- data/app/controllers/setup_controller.rb +25 -26
- data/app/controllers/tags_controller.rb +16 -16
- data/app/controllers/text_controller.rb +2 -4
- data/app/controllers/textfilter_controller.rb +2 -0
- data/app/controllers/theme_controller.rb +23 -16
- data/app/controllers/xml_controller.rb +13 -59
- data/app/helpers/admin/base_helper.rb +28 -29
- data/app/helpers/admin/feedback_helper.rb +34 -24
- data/app/helpers/articles_helper.rb +4 -2
- data/app/helpers/authors_helper.rb +9 -18
- data/app/helpers/base_helper.rb +66 -55
- data/app/helpers/blog_helper.rb +4 -2
- data/app/helpers/xml_helper.rb +5 -3
- data/app/jobs/application_job.rb +4 -0
- data/app/mailers/notification_mailer.rb +5 -3
- data/app/models/ability.rb +25 -23
- data/app/models/archives_sidebar.rb +18 -18
- data/app/models/article.rb +84 -99
- data/app/models/article/factory.rb +14 -6
- data/app/models/blog.rb +98 -110
- data/app/models/comment.rb +14 -10
- data/app/models/config_manager.rb +4 -2
- data/app/models/content.rb +45 -61
- data/app/models/content_base.rb +7 -6
- data/app/models/feedback.rb +91 -65
- data/app/models/meta_sidebar.rb +5 -3
- data/app/models/note.rb +31 -23
- data/app/models/page.rb +16 -10
- data/app/models/page_sidebar.rb +4 -2
- data/app/models/ping.rb +2 -113
- data/app/models/post_type.rb +4 -3
- data/app/models/redirect.rb +13 -7
- data/app/models/redirection.rb +3 -1
- data/app/models/resource.rb +6 -22
- data/app/models/search_sidebar.rb +4 -2
- data/app/models/sidebar.rb +12 -7
- data/app/models/static_sidebar.rb +15 -13
- data/app/models/tag.rb +23 -15
- data/app/models/tag_sidebar.rb +10 -7
- data/app/models/text_filter.rb +85 -11
- data/app/models/trackback.rb +7 -18
- data/app/models/trigger.rb +8 -19
- data/app/models/user.rb +46 -52
- data/app/services/title_builder.rb +52 -45
- data/app/uploaders/resource_uploader.rb +35 -2
- data/app/views/accounts/confirm.html.erb +3 -4
- data/app/views/admin/content/_article_list.html.erb +24 -9
- data/app/views/admin/content/_form.html.erb +71 -51
- data/app/views/admin/content/autosave.js.erb +2 -2
- data/app/views/admin/content/edit.html.erb +1 -1
- data/app/views/admin/content/index.html.erb +25 -15
- data/app/views/admin/content/new.html.erb +2 -2
- data/app/views/admin/dashboard/_comment.html.erb +5 -5
- data/app/views/admin/dashboard/_comments.html.erb +2 -2
- data/app/views/admin/dashboard/_drafts.html.erb +5 -5
- data/app/views/admin/dashboard/_overview.html.erb +7 -9
- data/app/views/admin/dashboard/_welcome.html.erb +11 -11
- data/app/views/admin/dashboard/index.html.erb +12 -7
- data/app/views/admin/feedback/_button.html.erb +6 -6
- data/app/views/admin/feedback/_feedback.html.erb +3 -3
- data/app/views/admin/feedback/_ham.html.erb +27 -9
- data/app/views/admin/feedback/_spam.html.erb +26 -16
- data/app/views/admin/feedback/article.html.erb +20 -21
- data/app/views/admin/feedback/edit.html.erb +14 -15
- data/app/views/admin/feedback/{ham.js → ham.js.erb} +0 -0
- data/app/views/admin/feedback/index.html.erb +25 -23
- data/app/views/admin/feedback/{spam.js → spam.js.erb} +0 -0
- data/app/views/admin/migrations/show.html.erb +10 -11
- data/app/views/admin/notes/_form.html.erb +13 -13
- data/app/views/admin/notes/_list.html.erb +19 -8
- data/app/views/admin/notes/_note.html.erb +12 -7
- data/app/views/admin/notes/edit.html.erb +6 -1
- data/app/views/admin/notes/index.html.erb +5 -1
- data/app/views/admin/notes/show.html.erb +2 -2
- data/app/views/admin/pages/_form.html.erb +86 -77
- data/app/views/admin/pages/_pages.html.erb +11 -4
- data/app/views/admin/pages/edit.html.erb +3 -1
- data/app/views/admin/pages/index.html.erb +10 -6
- data/app/views/admin/pages/new.html.erb +3 -1
- data/app/views/admin/post_types/_index_and_form.html.erb +15 -16
- data/app/views/admin/post_types/edit.html.erb +1 -1
- data/app/views/admin/post_types/index.html.erb +1 -1
- data/app/views/admin/profiles/index.html.erb +2 -3
- data/app/views/admin/redirects/_index_and_form.html.erb +10 -11
- data/app/views/admin/redirects/edit.html.erb +1 -1
- data/app/views/admin/redirects/index.html.erb +1 -1
- data/app/views/admin/resources/index.html.erb +19 -16
- data/app/views/admin/seo/_general.html.erb +40 -59
- data/app/views/admin/seo/_permalinks.html.erb +17 -17
- data/app/views/admin/seo/_titles.html.erb +81 -82
- data/app/views/admin/seo/show.html.erb +14 -19
- data/app/views/admin/settings/display.html.erb +42 -52
- data/app/views/admin/settings/feedback.html.erb +59 -67
- data/app/views/admin/settings/index.html.erb +30 -31
- data/app/views/admin/settings/write.html.erb +27 -46
- data/app/views/admin/shared/_edit.html.erb +3 -3
- data/app/views/admin/shared/_menu.html.erb +26 -26
- data/app/views/admin/shared/_twitter_alert.html.erb +1 -1
- data/app/views/admin/sidebar/_config.html.erb +5 -5
- data/app/views/admin/sidebar/_target_sidebar.html.erb +4 -4
- data/app/views/admin/sidebar/index.html.erb +7 -7
- data/app/views/admin/tags/_index_and_form.html.erb +11 -12
- data/app/views/admin/tags/edit.html.erb +1 -1
- data/app/views/admin/tags/index.html.erb +1 -1
- data/app/views/admin/themes/index.html.erb +5 -6
- data/app/views/admin/users/_form.html.erb +34 -34
- data/app/views/admin/users/edit.html.erb +2 -2
- data/app/views/admin/users/index.html.erb +10 -12
- data/app/views/admin/users/new.html.erb +2 -2
- data/app/views/archives_sidebar/_content.html.erb +2 -2
- data/app/views/articles/_archives_article.html.erb +9 -0
- data/app/views/articles/_article.html.erb +9 -9
- data/app/views/articles/_article_author.html.erb +4 -0
- data/app/views/articles/_article_collection.html.erb +1 -1
- data/app/views/articles/_article_content.html.erb +2 -2
- data/app/views/articles/_article_excerpt.html.erb +11 -9
- data/app/views/articles/_article_links.html.erb +5 -3
- data/app/views/articles/_comment_errors.html.erb +1 -1
- data/app/views/articles/_comment_form.html.erb +12 -12
- data/app/views/articles/_comment_list.html.erb +5 -5
- data/app/views/articles/_comment_preview.html.erb +3 -3
- data/app/views/articles/_full_article_content.html.erb +4 -2
- data/app/views/articles/_password_form.html.erb +4 -4
- data/app/views/articles/_trackback.html.erb +2 -2
- data/app/views/articles/archives.html.erb +11 -21
- data/app/views/articles/feedback_atom_feed.atom.builder +7 -5
- data/app/views/articles/feedback_rss_feed.rss.builder +11 -11
- data/app/views/articles/index_atom_feed.atom.builder +5 -4
- data/app/views/articles/index_rss_feed.rss.builder +8 -8
- data/app/views/articles/live_search.html.erb +3 -3
- data/app/views/articles/read.html.erb +19 -37
- data/app/views/articles/search.html.erb +3 -3
- data/app/views/articles/trackback.xml.builder +3 -1
- data/app/views/articles/view_page.html.erb +2 -2
- data/app/views/authors/show.html.erb +18 -28
- data/app/views/authors/show_atom_feed.atom.builder +5 -4
- data/app/views/authors/show_rss_feed.rss.builder +8 -8
- data/app/views/comments/_comment.html.erb +17 -16
- data/app/views/devise/mailer/reset_password_instructions.html.erb +7 -9
- data/app/views/devise/passwords/edit.html.erb +4 -4
- data/app/views/devise/passwords/new.html.erb +1 -1
- data/app/views/devise/registrations/new.html.erb +5 -5
- data/app/views/devise/sessions/new.html.erb +3 -3
- data/app/views/errors/404.html.erb +2 -2
- data/app/views/feedback/index.atom.builder +9 -0
- data/app/views/feedback/index.rss.builder +20 -0
- data/app/views/layouts/accounts.html.erb +26 -26
- data/app/views/layouts/administration.html.erb +31 -31
- data/app/views/layouts/default.html.erb +4 -3
- data/app/views/layouts/editor.html.erb +5 -19
- data/app/views/meta_sidebar/_content.html.erb +2 -2
- data/app/views/notes/_note.html.erb +16 -15
- data/app/views/notes/index.html.erb +2 -2
- data/app/views/notes/show_in_reply.html.erb +1 -1
- data/app/views/notification_mailer/_mail_footer.html.erb +3 -5
- data/app/views/notification_mailer/_mail_header.html.erb +2 -0
- data/app/views/notification_mailer/article.html.erb +5 -4
- data/app/views/notification_mailer/comment.html.erb +9 -8
- data/app/views/notification_mailer/notif_user.html.erb +4 -9
- data/app/views/page_sidebar/_content.html.erb +1 -1
- data/app/views/search_sidebar/_content.html.erb +2 -2
- data/app/views/settings/install.html.erb +2 -2
- data/app/views/setup/index.html.erb +9 -5
- data/app/views/shared/_atom_header.atom.builder +4 -4
- data/app/views/shared/_atom_item_article.atom.builder +19 -22
- data/app/views/shared/_atom_item_comment.atom.builder +5 -5
- data/app/views/shared/_atom_item_trackback.atom.builder +5 -4
- data/app/views/shared/_google_analytics.html.erb +8 -0
- data/app/views/shared/_page_header.html.erb +10 -13
- data/app/views/shared/_rss_item_article.rss.builder +12 -15
- data/app/views/shared/_rss_item_comment.rss.builder +2 -1
- data/app/views/shared/_rss_item_trackback.rss.builder +2 -0
- data/app/views/sidebar/display_plugins.html.erb +1 -1
- data/app/views/tag_sidebar/_content.html.erb +1 -1
- data/app/views/tags/index.html.erb +2 -2
- data/app/views/xml/_googlesitemap_item_article.googlesitemap.builder +2 -0
- data/app/views/xml/_googlesitemap_item_category.googlesitemap.builder +2 -0
- data/app/views/xml/_googlesitemap_item_page.googlesitemap.builder +2 -0
- data/app/views/xml/_googlesitemap_item_tag.googlesitemap.builder +2 -0
- data/app/views/xml/sitemap.googlesitemap.builder +9 -0
- data/config/i18n-tasks.yml +0 -5
- data/config/initializers/devise.rb +10 -4
- data/config/initializers/mime_types.rb +3 -2
- data/config/locales/da.yml +140 -108
- data/config/locales/de.yml +147 -111
- data/config/locales/en.yml +133 -102
- data/config/locales/es-MX.yml +141 -106
- data/config/locales/fr.yml +172 -122
- data/config/locales/he.yml +132 -105
- data/config/locales/it.yml +141 -108
- data/config/locales/ja.yml +115 -100
- data/config/locales/lt.yml +158 -110
- data/config/locales/nb-NO.yml +128 -101
- data/config/locales/nl.yml +147 -113
- data/config/locales/pl.yml +335 -275
- data/config/locales/pt-BR.yml +143 -107
- data/config/locales/ro.yml +155 -108
- data/config/locales/ru.yml +166 -105
- data/config/locales/zh-CN.yml +112 -96
- data/config/locales/zh-TW.yml +116 -99
- data/config/routes.rb +70 -87
- data/db/migrate/113_initial_schema.rb +6 -6
- data/db/migrate/114_fixes_buggy_articles_and_notes.rb +8 -6
- data/db/migrate/115_drops_categories_for_tags.rb +7 -6
- data/db/migrate/20150207131657_add_missing_indexes.rb +3 -1
- data/db/migrate/20150807134129_simplify_redirect_relations.rb +6 -1
- data/db/migrate/20150808052637_add_blog_ids.rb +11 -7
- data/db/migrate/20150808191127_add_blog_id_to_redirects.rb +3 -1
- data/db/migrate/20150810094754_add_blog_id_to_tags.rb +3 -1
- data/db/migrate/20160108111120_add_devise_to_users.rb +3 -1
- data/db/migrate/20160108184201_move_last_connection_to_last_sign_in_at.rb +3 -1
- data/db/migrate/20160110094906_remove_profiles_rights.rb +3 -1
- data/db/migrate/20160605103918_replace_profile_id_with_string.rb +3 -3
- data/db/migrate/20160605154632_remove_profiles.rb +12 -7
- data/db/migrate/20160701061851_demand_blog_id_on_contents.rb +3 -1
- data/db/migrate/20160701062604_add_blog_id_to_resources.rb +3 -1
- data/db/migrate/20170528093024_move_resources_to_content.rb +7 -0
- data/db/migrate/20170528094923_move_tags_to_content.rb +8 -0
- data/db/migrate/20170528201606_remove_separate_published_flag.rb +7 -0
- data/db/migrate/20170605071626_remove_extra_state_columns_from_feedback.rb +8 -0
- data/db/migrate/20170702105201_remove_published_at_from_feedback.rb +7 -0
- data/db/migrate/20190208151235_add_text_filter_name_fields.rb +9 -0
- data/db/migrate/20190208152646_move_text_filter_to_name.rb +97 -0
- data/db/migrate/20190209155717_remove_text_filter_ids.rb +19 -0
- data/db/migrate/20190209160610_remove_text_filters.rb +17 -0
- data/db/migrate/20200413140440_add_unique_indexes.rb +10 -0
- data/db/seeds.rb +8 -20
- data/lib/email_notify.rb +3 -1
- data/lib/format.rb +4 -12
- data/lib/publify_core.rb +36 -36
- data/lib/publify_core/engine.rb +11 -4
- data/lib/publify_core/lang.rb +5 -1
- data/lib/publify_core/testing_support/dns_mock.rb +15 -0
- data/lib/publify_core/testing_support/factories.rb +240 -0
- data/lib/publify_core/testing_support/feed_assertions.rb +48 -0
- data/lib/publify_core/testing_support/fixtures/exploit.svg +4 -0
- data/lib/publify_core/testing_support/fixtures/fakepng.png +1 -0
- data/lib/publify_core/testing_support/fixtures/otherfile.txt +1 -0
- data/lib/publify_core/testing_support/fixtures/testfile.png +0 -0
- data/lib/publify_core/testing_support/fixtures/testfile.txt +1 -0
- data/lib/publify_core/testing_support/upload_fixtures.rb +15 -0
- data/lib/publify_core/version.rb +3 -1
- data/lib/publify_guid.rb +4 -2
- data/lib/publify_plugins.rb +10 -5
- data/lib/publify_textfilter_markdown.rb +38 -25
- data/lib/publify_textfilter_none.rb +5 -3
- data/lib/publify_textfilter_smartypants.rb +5 -3
- data/lib/publify_textfilter_textile.rb +7 -4
- data/lib/publify_textfilter_twitterfilter.rb +13 -7
- data/lib/publify_time.rb +6 -2
- data/lib/sidebar_field.rb +29 -20
- data/lib/sidebar_registry.rb +5 -3
- data/lib/spam_protection.rb +19 -17
- data/lib/tasks/i18n.rake +9 -0
- data/lib/tasks/manifest.rake +30 -0
- data/lib/tasks/publify_core_tasks.rake +2 -0
- data/lib/text_filter_plugin.rb +30 -29
- data/lib/theme.rb +5 -5
- data/lib/transforms.rb +22 -20
- data/{app/assets/stylesheets/publify_core/.keep → themes/plain/javascripts/theme.js} +0 -0
- metadata +304 -130
- data/.gitignore +0 -13
- data/.rspec +0 -2
- data/.rubocop.yml +0 -84
- data/.rubocop_todo.yml +0 -148
- data/.travis.yml +0 -27
- data/Gemfile +0 -17
- data/README.rdoc +0 -3
- data/Rakefile +0 -35
- data/app/assets/javascripts/widearea.js +0 -486
- data/app/assets/stylesheets/widearea.css +0 -133
- data/app/controllers/.keep +0 -0
- data/app/controllers/admin/migrations_controller.rb +0 -19
- data/app/controllers/admin/textfilters_controller.rb +0 -6
- data/app/controllers/concerns/.keep +0 -0
- data/app/controllers/trackbacks_controller.rb +0 -36
- data/app/helpers/.keep +0 -0
- data/app/mailers/.keep +0 -0
- data/app/models/.keep +0 -0
- data/app/models/article/states.rb +0 -179
- data/app/models/concerns/.keep +0 -0
- data/app/models/feedback/states.rb +0 -256
- data/app/services/migrator.rb +0 -25
- data/app/views/.keep +0 -0
- data/app/views/admin/dashboard/_inbound.html.erb +0 -31
- data/app/views/admin/notes/_header.html.erb +0 -6
- data/app/views/articles/_protected_article_content.html.erb +0 -6
- data/app/views/comments/index.html.erb +0 -1
- data/app/views/comments/index_atom_feed.atom.builder +0 -8
- data/app/views/comments/index_rss_feed.rss.builder +0 -20
- data/app/views/trackbacks/index_atom_feed.atom.builder +0 -7
- data/app/views/trackbacks/index_rss_feed.rss.builder +0 -20
- data/app/views/trackbacks/trackback.xml.builder +0 -4
- data/app/views/xml/feed.googlesitemap.builder +0 -7
- data/app/views/xml/rsd.rsd.builder +0 -8
- data/lib/stateful.rb +0 -106
- data/publify_core.gemspec +0 -54
@@ -1,10 +1,12 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "text_filter_plugin"
|
2
4
|
|
3
5
|
class PublifyApp
|
4
6
|
class Textfilter
|
5
7
|
class None < TextFilterPlugin::Markup
|
6
|
-
plugin_display_name
|
7
|
-
plugin_description
|
8
|
+
plugin_display_name "None"
|
9
|
+
plugin_description "Raw HTML only"
|
8
10
|
|
9
11
|
def self.filtertext(text)
|
10
12
|
text
|
@@ -1,10 +1,12 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "rubypants"
|
2
4
|
|
3
5
|
class PublifyApp
|
4
6
|
class Textfilter
|
5
7
|
class Smartypants < TextFilterPlugin::PostProcess
|
6
|
-
plugin_display_name
|
7
|
-
plugin_description
|
8
|
+
plugin_display_name "Smartypants"
|
9
|
+
plugin_description "Converts HTML to use typographically correct quotes and dashes"
|
8
10
|
|
9
11
|
def self.filtertext(text)
|
10
12
|
RubyPants.new(text).to_html
|
@@ -1,11 +1,13 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "text_filter_plugin"
|
4
|
+
require "RedCloth"
|
3
5
|
|
4
6
|
class PublifyApp
|
5
7
|
class Textfilter
|
6
8
|
class Textile < TextFilterPlugin::Markup
|
7
|
-
plugin_display_name
|
8
|
-
plugin_description
|
9
|
+
plugin_display_name "Textile (Deprecated)"
|
10
|
+
plugin_description "Textile markup language"
|
9
11
|
|
10
12
|
def self.help_text
|
11
13
|
%{
|
@@ -14,6 +16,7 @@ See [_why's Textile reference](http://hobix.com/textile/).
|
|
14
16
|
end
|
15
17
|
|
16
18
|
def self.filtertext(text)
|
19
|
+
ActiveSupport::Deprecation.warn "Use of Textile is deprecated"
|
17
20
|
RedCloth.new(text).to_html(:textile)
|
18
21
|
end
|
19
22
|
end
|
@@ -1,10 +1,12 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "text_filter_plugin"
|
2
4
|
|
3
5
|
class PublifyApp
|
4
6
|
class Textfilter
|
5
7
|
class Twitterfilter < TextFilterPlugin::PostProcess
|
6
|
-
plugin_display_name
|
7
|
-
plugin_description
|
8
|
+
plugin_display_name "HTML Filter"
|
9
|
+
plugin_description "Strip HTML tags"
|
8
10
|
|
9
11
|
def self.filtertext(text)
|
10
12
|
# First, autolink
|
@@ -16,14 +18,18 @@ class PublifyApp
|
|
16
18
|
# hashtags
|
17
19
|
text.split.grep(/^#\w+/) do |item|
|
18
20
|
# strip_html because Ruby considers "#prouddad</p>" as a word
|
19
|
-
|
20
|
-
|
21
|
+
item = item.strip_html
|
22
|
+
search_item = URI.encode_www_form_component(item)
|
23
|
+
|
24
|
+
uri = "https://twitter.com/search?q=#{search_item}&src=tren&mode=realtime"
|
25
|
+
text = text.gsub(item, "<a href='#{uri}'>#{item}</a>")
|
21
26
|
end
|
22
27
|
|
23
28
|
# @mention
|
24
29
|
text.to_s.split.grep(/@\w+/) do |item|
|
25
|
-
|
26
|
-
|
30
|
+
item = item.strip_html
|
31
|
+
uri = html_escape("https://twitter.com/#{item.delete("@")}")
|
32
|
+
text = text.gsub(item, "<a href='#{uri}'>#{item}</a>")
|
27
33
|
end
|
28
34
|
|
29
35
|
text
|
data/lib/publify_time.rb
CHANGED
@@ -1,14 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
class PublifyTime
|
2
4
|
def self.delta(year = nil, month = nil, day = nil)
|
3
5
|
return nil if year.nil? && month.nil? && day.nil?
|
6
|
+
|
4
7
|
year = year.to_i unless year.nil?
|
5
8
|
month = month.to_i unless month.nil?
|
6
9
|
day = day.to_i unless day.nil?
|
7
10
|
return nil if year.zero?
|
11
|
+
|
8
12
|
from = Time.zone.local(year, month, day)
|
9
13
|
to = from.end_of_year
|
10
|
-
to = from.end_of_month
|
11
|
-
to = from.end_of_day
|
14
|
+
to = from.end_of_month if month.present?
|
15
|
+
to = from.end_of_day if day.present?
|
12
16
|
from..to
|
13
17
|
end
|
14
18
|
|
data/lib/sidebar_field.rb
CHANGED
@@ -1,7 +1,8 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
class SidebarField
|
2
|
-
attr_accessor :key
|
3
|
-
|
4
|
-
attr_accessor :default
|
4
|
+
attr_accessor :key, :options, :default
|
5
|
+
|
5
6
|
include ActionView::Helpers::TagHelper
|
6
7
|
include ActionView::Helpers::FormTagHelper
|
7
8
|
include ActionView::Helpers::FormOptionsHelper
|
@@ -13,20 +14,19 @@ class SidebarField
|
|
13
14
|
end
|
14
15
|
|
15
16
|
def label
|
16
|
-
options[:label] || key.humanize.gsub(/url/i,
|
17
|
+
options[:label] || key.humanize.gsub(/url/i, "URL")
|
17
18
|
end
|
18
19
|
|
19
20
|
def label_html(_sidebar)
|
20
|
-
|
21
|
+
tag.label(label)
|
21
22
|
end
|
22
23
|
|
23
24
|
def input_html(sidebar)
|
24
|
-
text_field_tag(input_name(sidebar), sidebar
|
25
|
+
text_field_tag(input_name(sidebar), current_value(sidebar), class: "form-control")
|
25
26
|
end
|
26
27
|
|
27
28
|
def line_html(sidebar)
|
28
|
-
|
29
|
-
html << content_tag(:div, input_html(sidebar), class: 'form-group')
|
29
|
+
tag.div(label_html(sidebar) + input_html(sidebar), class: "form-group")
|
30
30
|
end
|
31
31
|
|
32
32
|
def input_name(sidebar)
|
@@ -37,29 +37,37 @@ class SidebarField
|
|
37
37
|
value
|
38
38
|
end
|
39
39
|
|
40
|
+
def current_value(sidebar)
|
41
|
+
canonicalize(sidebar.config[key])
|
42
|
+
end
|
43
|
+
|
40
44
|
class SelectField < self
|
41
45
|
def input_html(sidebar)
|
42
46
|
select_tag(input_name(sidebar),
|
43
|
-
options_for_select(options[:choices], sidebar
|
47
|
+
options_for_select(options[:choices], current_value(sidebar)),
|
44
48
|
options)
|
45
49
|
end
|
46
50
|
end
|
47
51
|
|
48
52
|
class TextAreaField < self
|
49
53
|
def input_html(sidebar)
|
50
|
-
html_options = {
|
51
|
-
|
54
|
+
html_options = { "rows" => "10", "class" => "form-control" }.
|
55
|
+
update(options.stringify_keys)
|
56
|
+
text_area_tag(input_name(sidebar), current_value(sidebar), html_options)
|
52
57
|
end
|
53
58
|
end
|
54
59
|
|
55
60
|
class RadioField < self
|
56
61
|
def input_html(sidebar)
|
57
|
-
options[:choices].map do |choice|
|
62
|
+
choices = options[:choices].map do |choice|
|
58
63
|
value = value_for(choice)
|
59
|
-
radio_button_tag(input_name(sidebar),
|
60
|
-
|
61
|
-
|
62
|
-
|
64
|
+
radio_button = radio_button_tag(input_name(sidebar),
|
65
|
+
value,
|
66
|
+
value == current_value(sidebar),
|
67
|
+
options)
|
68
|
+
tag.div(tag.label(radio_button + label_for(choice)), class: "radio")
|
69
|
+
end
|
70
|
+
safe_join(choices)
|
63
71
|
end
|
64
72
|
|
65
73
|
def label_for(choice)
|
@@ -73,14 +81,15 @@ class SidebarField
|
|
73
81
|
|
74
82
|
class CheckBoxField < self
|
75
83
|
def line_html(sidebar)
|
76
|
-
hidden_field_tag(input_name(sidebar), 0) +
|
77
|
-
|
78
|
-
|
84
|
+
content = hidden_field_tag(input_name(sidebar), 0) +
|
85
|
+
tag.label(check_box_tag(input_name(sidebar), 1,
|
86
|
+
current_value(sidebar), options) + label)
|
87
|
+
tag.div(content, class: "checkbox")
|
79
88
|
end
|
80
89
|
|
81
90
|
def canonicalize(value)
|
82
91
|
case value
|
83
|
-
when
|
92
|
+
when "0"
|
84
93
|
false
|
85
94
|
else
|
86
95
|
true
|
data/lib/sidebar_registry.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
class SidebarRegistry
|
2
4
|
class << self
|
3
5
|
def register_sidebar(klass_name)
|
@@ -13,14 +15,14 @@ class SidebarRegistry
|
|
13
15
|
end
|
14
16
|
|
15
17
|
def register_sidebar_directory(plugins_root, paths)
|
16
|
-
separator = plugins_root.include?(
|
18
|
+
separator = plugins_root.include?("/") ? "/" : '\\'
|
17
19
|
|
18
|
-
Dir.glob(File.join(plugins_root,
|
20
|
+
Dir.glob(File.join(plugins_root, "*_sidebar")).select do |file|
|
19
21
|
plugin_name = file.split(separator).last
|
20
22
|
register_sidebar plugin_name.classify
|
21
23
|
# TODO: Move Sidebars to app/models, and views to app/views so this can
|
22
24
|
# be simplified.
|
23
|
-
paths << File.join(plugins_root, plugin_name,
|
25
|
+
paths << File.join(plugins_root, plugin_name, "lib")
|
24
26
|
end
|
25
27
|
end
|
26
28
|
|
data/lib/spam_protection.rb
CHANGED
@@ -1,8 +1,10 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "format"
|
2
4
|
|
3
5
|
class SpamProtection
|
4
|
-
IP_RBLS = [
|
5
|
-
HOST_RBLS = [
|
6
|
+
IP_RBLS = ["opm.blitzed.us", "bsb.empty.us"].freeze
|
7
|
+
HOST_RBLS = ["multi.surbl.org", "bsb.empty.us"].freeze
|
6
8
|
SECOND_LEVEL = %w(co com net org gov).freeze
|
7
9
|
|
8
10
|
attr_accessor :this_blog
|
@@ -25,7 +27,7 @@ class SpamProtection
|
|
25
27
|
|
26
28
|
if reason
|
27
29
|
logger.info("[SP] Hit: #{reason}")
|
28
|
-
|
30
|
+
true
|
29
31
|
end
|
30
32
|
end
|
31
33
|
|
@@ -33,11 +35,12 @@ class SpamProtection
|
|
33
35
|
|
34
36
|
def scan_ip(ip_address)
|
35
37
|
logger.info("[SP] Scanning IP #{ip_address}")
|
36
|
-
query_rbls(IP_RBLS, ip_address.split(
|
38
|
+
query_rbls(IP_RBLS, ip_address.split(".").reverse.join("."))
|
37
39
|
end
|
38
40
|
|
39
41
|
def scan_text(string)
|
40
|
-
|
42
|
+
# FIXME: Unify HTTP URI matchers
|
43
|
+
uri_list = string.scan(%r{(http://[^\s"]+)}m).flatten
|
41
44
|
|
42
45
|
check_uri_count(uri_list)
|
43
46
|
scan_uris(uri_list)
|
@@ -48,9 +51,8 @@ class SpamProtection
|
|
48
51
|
def check_uri_count(uris)
|
49
52
|
limit = this_blog.sp_url_limit
|
50
53
|
return if limit.to_i.zero?
|
51
|
-
|
52
|
-
|
53
|
-
end
|
54
|
+
|
55
|
+
throw :hit, "Hard URL Limit hit: #{uris.size} > #{limit}" if uris.size > limit
|
54
56
|
end
|
55
57
|
|
56
58
|
def scan_uris(uris = [])
|
@@ -60,9 +62,9 @@ class SpamProtection
|
|
60
62
|
rescue URI::InvalidURIError
|
61
63
|
next
|
62
64
|
end
|
63
|
-
return scan_ip(host) if
|
65
|
+
return scan_ip(host) if Format::IP_ADDRESS.match?(host)
|
64
66
|
|
65
|
-
host_parts = host.split(
|
67
|
+
host_parts = host.split(".").reverse
|
66
68
|
domain = []
|
67
69
|
|
68
70
|
# Check for two level TLD
|
@@ -70,9 +72,9 @@ class SpamProtection
|
|
70
72
|
domain.unshift(host_parts.shift)
|
71
73
|
end
|
72
74
|
|
73
|
-
logger.info("[SP] Scanning domain #{domain.join(
|
74
|
-
query_rbls(HOST_RBLS, host, domain.join(
|
75
|
-
logger.info("[SP] Finished domain scan #{domain.join(
|
75
|
+
logger.info("[SP] Scanning domain #{domain.join(".")}")
|
76
|
+
query_rbls(HOST_RBLS, host, domain.join("."))
|
77
|
+
logger.info("[SP] Finished domain scan #{domain.join(".")}")
|
76
78
|
return false
|
77
79
|
end
|
78
80
|
end
|
@@ -81,8 +83,8 @@ class SpamProtection
|
|
81
83
|
rbls.each do |rbl|
|
82
84
|
subdomains.uniq.each do |d|
|
83
85
|
begin
|
84
|
-
response = IPSocket.getaddress([d, rbl].join(
|
85
|
-
if response
|
86
|
+
response = IPSocket.getaddress([d, rbl].join("."))
|
87
|
+
if response.start_with?("127.0.0.")
|
86
88
|
throw :hit,
|
87
89
|
"#{rbl} positively resolved subdomain #{d} => #{response}"
|
88
90
|
end
|
@@ -96,6 +98,6 @@ class SpamProtection
|
|
96
98
|
end
|
97
99
|
|
98
100
|
def logger
|
99
|
-
@logger ||= ::Rails.logger || Logger.new(
|
101
|
+
@logger ||= ::Rails.logger || Logger.new($stdout)
|
100
102
|
end
|
101
103
|
end
|
data/lib/tasks/i18n.rake
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
namespace :manifest do
|
4
|
+
def gemmable_files
|
5
|
+
`git ls-files -z`.split("\x0").reject do |file|
|
6
|
+
file.match(%r{^(bin|spec)/}) ||
|
7
|
+
file.end_with?("/.keep") ||
|
8
|
+
file.start_with?(".") ||
|
9
|
+
%w(Manifest.txt Gemfile Rakefile publify_core.gemspec).include?(file)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def manifest_files
|
14
|
+
File.open("Manifest.txt").readlines.map(&:chomp)
|
15
|
+
end
|
16
|
+
|
17
|
+
desc "Create manifest"
|
18
|
+
task :create do
|
19
|
+
File.open("Manifest.txt", "w") do |manifest|
|
20
|
+
gemmable_files.each { |file| manifest.puts file }
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
desc "Check manifest"
|
25
|
+
task :check do
|
26
|
+
unless gemmable_files == manifest_files
|
27
|
+
raise "Manifest check failed, try recreating the manifest"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
data/lib/text_filter_plugin.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "publify_plugins"
|
2
4
|
|
3
5
|
class TextFilterPlugin
|
4
6
|
class << self
|
@@ -9,7 +11,9 @@ class TextFilterPlugin
|
|
9
11
|
|
10
12
|
@@filter_map = {}
|
11
13
|
def self.inherited(sub)
|
12
|
-
|
14
|
+
super
|
15
|
+
|
16
|
+
if sub.to_s.start_with?("Plugin", "PublifyApp::Textfilter")
|
13
17
|
name = sub.short_name
|
14
18
|
@@filter_map[name] = sub
|
15
19
|
end
|
@@ -25,11 +29,11 @@ class TextFilterPlugin
|
|
25
29
|
|
26
30
|
def self.available_filter_types
|
27
31
|
unless @cached_filter_types
|
28
|
-
types = {
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
32
|
+
types = { "macropre" => [],
|
33
|
+
"macropost" => [],
|
34
|
+
"markup" => [],
|
35
|
+
"postprocess" => [],
|
36
|
+
"other" => [] }
|
33
37
|
|
34
38
|
available_filters.each { |filter| types[filter.filter_type].push(filter) }
|
35
39
|
|
@@ -42,8 +46,8 @@ class TextFilterPlugin
|
|
42
46
|
available_filters.select { |filter| TextFilterPlugin::Macro > filter }
|
43
47
|
end
|
44
48
|
|
45
|
-
plugin_display_name
|
46
|
-
plugin_description
|
49
|
+
plugin_display_name "Unknown Text Filter"
|
50
|
+
plugin_description "Unknown Text Filter Description"
|
47
51
|
|
48
52
|
def self.reloadable?
|
49
53
|
false
|
@@ -66,7 +70,7 @@ class TextFilterPlugin
|
|
66
70
|
end
|
67
71
|
|
68
72
|
def self.filter_type
|
69
|
-
|
73
|
+
"other"
|
70
74
|
end
|
71
75
|
|
72
76
|
def self.default_config
|
@@ -74,15 +78,14 @@ class TextFilterPlugin
|
|
74
78
|
end
|
75
79
|
|
76
80
|
def self.help_text
|
77
|
-
|
81
|
+
""
|
78
82
|
end
|
79
83
|
|
80
84
|
def self.sanitize(*args)
|
81
85
|
(@sanitizer ||= Rails::Html::WhiteListSanitizer.new).sanitize(*args)
|
82
86
|
end
|
83
87
|
|
84
|
-
def self.default_helper_module
|
85
|
-
end
|
88
|
+
def self.default_helper_module!; end
|
86
89
|
|
87
90
|
# Look up a config paramater, falling back to the default as needed.
|
88
91
|
def self.config_value(params, name)
|
@@ -90,13 +93,13 @@ class TextFilterPlugin
|
|
90
93
|
end
|
91
94
|
|
92
95
|
def self.logger
|
93
|
-
@logger ||= ::Rails.logger || Logger.new(
|
96
|
+
@logger ||= ::Rails.logger || Logger.new($stdout)
|
94
97
|
end
|
95
98
|
end
|
96
99
|
|
97
100
|
class TextFilterPlugin::PostProcess < TextFilterPlugin
|
98
101
|
def self.filter_type
|
99
|
-
|
102
|
+
"postprocess"
|
100
103
|
end
|
101
104
|
end
|
102
105
|
|
@@ -120,47 +123,45 @@ class TextFilterPlugin::Macro < TextFilterPlugin
|
|
120
123
|
end
|
121
124
|
|
122
125
|
def self.filtertext(text)
|
123
|
-
regex1 =
|
124
|
-
regex2 =
|
126
|
+
regex1 = %r{<publify:#{short_name}(?:[ \t][^>]*)?/>}
|
127
|
+
regex2 = %r{<publify:#{short_name}([ \t][^>]*)?>(.*?)</publify:#{short_name}>}m
|
125
128
|
|
126
129
|
new_text = text.gsub(regex1) do |match|
|
127
130
|
macrofilter(attributes_parse(match))
|
128
131
|
end
|
129
132
|
|
130
|
-
new_text
|
133
|
+
new_text.gsub(regex2) do |_match|
|
131
134
|
macrofilter(attributes_parse(Regexp.last_match[1].to_s), Regexp.last_match[2].to_s)
|
132
135
|
end
|
133
|
-
|
134
|
-
new_text
|
135
136
|
end
|
136
137
|
end
|
137
138
|
|
138
139
|
class TextFilterPlugin::MacroPre < TextFilterPlugin::Macro
|
139
140
|
def self.filter_type
|
140
|
-
|
141
|
+
"macropre"
|
141
142
|
end
|
142
143
|
end
|
143
144
|
|
144
145
|
class TextFilterPlugin::MacroPost < TextFilterPlugin::Macro
|
145
146
|
def self.filter_type
|
146
|
-
|
147
|
+
"macropost"
|
147
148
|
end
|
148
149
|
end
|
149
150
|
|
150
151
|
class TextFilterPlugin::Markup < TextFilterPlugin
|
151
152
|
def self.filter_type
|
152
|
-
|
153
|
+
"markup"
|
153
154
|
end
|
154
155
|
end
|
155
156
|
|
156
157
|
class PublifyApp
|
157
158
|
class Textfilter
|
158
159
|
class MacroPost < TextFilterPlugin
|
159
|
-
plugin_display_name
|
160
|
-
plugin_description
|
160
|
+
plugin_display_name "MacroPost"
|
161
|
+
plugin_description "Macro expansion meta-filter (post-markup)"
|
161
162
|
|
162
163
|
def self.filtertext(text)
|
163
|
-
macros = TextFilterPlugin.available_filter_types[
|
164
|
+
macros = TextFilterPlugin.available_filter_types["macropost"]
|
164
165
|
macros.reduce(text) do |new_text, macro|
|
165
166
|
macro.filtertext(new_text)
|
166
167
|
end
|
@@ -168,11 +169,11 @@ class PublifyApp
|
|
168
169
|
end
|
169
170
|
|
170
171
|
class MacroPre < TextFilterPlugin
|
171
|
-
plugin_display_name
|
172
|
-
plugin_description
|
172
|
+
plugin_display_name "MacroPre"
|
173
|
+
plugin_description "Macro expansion meta-filter (pre-markup)"
|
173
174
|
|
174
175
|
def self.filtertext(text)
|
175
|
-
macros = TextFilterPlugin.available_filter_types[
|
176
|
+
macros = TextFilterPlugin.available_filter_types["macropre"]
|
176
177
|
macros.reduce(text) do |new_text, macro|
|
177
178
|
macro.filtertext(new_text)
|
178
179
|
end
|