2013-02-05 14:16:51 -05:00
|
|
|
require 'site_setting_extension'
|
|
|
|
|
|
|
|
class SiteSetting < ActiveRecord::Base
|
|
|
|
extend SiteSettingExtension
|
|
|
|
|
|
|
|
validates_presence_of :name
|
|
|
|
validates_presence_of :data_type
|
|
|
|
|
|
|
|
# settings available in javascript under Discourse.SiteSettings
|
|
|
|
client_setting(:title, "Discourse")
|
2013-09-11 15:33:05 -04:00
|
|
|
setting(:site_description, '')
|
2013-02-11 23:06:34 -05:00
|
|
|
client_setting(:logo_url, '/assets/d-logo-sketch.png')
|
|
|
|
client_setting(:logo_small_url, '/assets/d-logo-sketch-small.png')
|
2013-04-24 11:15:37 -04:00
|
|
|
setting(:contact_email, '')
|
2013-02-26 15:50:29 -05:00
|
|
|
setting(:company_full_name, 'My Unconfigured Forum Ltd.')
|
|
|
|
setting(:company_short_name, 'Unconfigured Forum')
|
|
|
|
setting(:company_domain, 'www.example.com')
|
2013-06-27 13:01:04 -04:00
|
|
|
client_setting(:tos_url, '')
|
2013-06-27 03:15:59 -04:00
|
|
|
client_setting(:faq_url, '')
|
2013-06-27 13:01:04 -04:00
|
|
|
client_setting(:privacy_policy_url, '')
|
2013-03-25 21:04:28 -04:00
|
|
|
setting(:api_key, '')
|
2013-02-05 14:16:51 -05:00
|
|
|
client_setting(:traditional_markdown_linebreaks, false)
|
2013-04-24 04:05:35 -04:00
|
|
|
client_setting(:top_menu, 'latest|new|unread|favorited|categories')
|
2013-02-05 14:16:51 -05:00
|
|
|
client_setting(:post_menu, 'like|edit|flag|delete|share|bookmark|reply')
|
2013-04-12 18:06:36 -04:00
|
|
|
client_setting(:share_links, 'twitter|facebook|google+|email')
|
2013-02-05 14:16:51 -05:00
|
|
|
client_setting(:track_external_right_clicks, false)
|
|
|
|
client_setting(:must_approve_users, false)
|
|
|
|
client_setting(:ga_tracking_code, "")
|
2013-05-03 15:58:10 -04:00
|
|
|
client_setting(:ga_domain_name, "")
|
2013-07-05 07:59:39 -04:00
|
|
|
client_setting(:enable_escaped_fragments, false)
|
|
|
|
client_setting(:enable_noscript_support, true)
|
2013-02-05 14:16:51 -05:00
|
|
|
client_setting(:enable_long_polling, true)
|
|
|
|
client_setting(:polling_interval, 3000)
|
|
|
|
client_setting(:anon_polling_interval, 30000)
|
|
|
|
client_setting(:min_post_length, Rails.env.test? ? 5 : 20)
|
2013-06-13 04:18:17 -04:00
|
|
|
client_setting(:min_private_message_post_length, Rails.env.test? ? 5 : 10)
|
2013-02-05 14:16:51 -05:00
|
|
|
client_setting(:max_post_length, 16000)
|
2013-03-11 01:45:55 -04:00
|
|
|
client_setting(:min_topic_title_length, 15)
|
2013-02-05 14:16:51 -05:00
|
|
|
client_setting(:max_topic_title_length, 255)
|
2013-06-04 17:58:25 -04:00
|
|
|
client_setting(:min_private_message_title_length, 2)
|
2013-05-24 16:49:08 -04:00
|
|
|
client_setting(:allow_uncategorized_topics, true)
|
2013-03-07 10:52:01 -05:00
|
|
|
client_setting(:min_search_term_length, 3)
|
2013-02-05 14:16:51 -05:00
|
|
|
client_setting(:flush_timings_secs, 5)
|
2013-06-21 00:41:04 -04:00
|
|
|
client_setting(:suppress_reply_directly_below, true)
|
2013-07-07 21:13:45 -04:00
|
|
|
client_setting(:suppress_reply_directly_above, true)
|
2013-02-13 22:24:32 -05:00
|
|
|
client_setting(:email_domains_blacklist, 'mailinator.com')
|
2013-03-18 15:48:56 -04:00
|
|
|
client_setting(:email_domains_whitelist)
|
2013-02-21 10:19:02 -05:00
|
|
|
client_setting(:version_checks, true)
|
2013-08-16 17:28:36 -04:00
|
|
|
setting(:new_version_emails, true)
|
2013-03-14 14:45:29 -04:00
|
|
|
client_setting(:min_title_similar_length, 10)
|
|
|
|
client_setting(:min_body_similar_length, 15)
|
2013-03-16 20:24:52 -04:00
|
|
|
# cf. https://github.com/discourse/discourse/pull/462#issuecomment-14991562
|
|
|
|
client_setting(:category_colors, 'BF1E2E|F1592A|F7941D|9EB83B|3AB54A|12A89D|25AAE2|0E76BD|652D90|92278F|ED207B|8C6238|231F20|808281|B3B5B4|283890')
|
2013-02-05 14:16:51 -05:00
|
|
|
|
2013-04-10 05:00:50 -04:00
|
|
|
# auto-replace rules for title
|
|
|
|
setting(:title_prettify, true)
|
|
|
|
|
2013-07-15 19:59:23 -04:00
|
|
|
client_setting(:max_image_size_kb, 2048)
|
|
|
|
client_setting(:max_attachment_size_kb, 1024)
|
2013-06-30 20:19:03 -04:00
|
|
|
client_setting(:authorized_extensions, '.jpg|.jpeg|.png|.gif')
|
2013-03-19 03:19:05 -04:00
|
|
|
|
2013-02-05 14:16:51 -05:00
|
|
|
# settings only available server side
|
2013-04-19 18:11:38 -04:00
|
|
|
setting(:auto_track_topics_after, 240000)
|
2013-02-14 01:32:58 -05:00
|
|
|
setting(:new_topic_duration_minutes, 60 * 48)
|
2013-02-05 14:16:51 -05:00
|
|
|
setting(:long_polling_interval, 15000)
|
|
|
|
setting(:flags_required_to_hide_post, 3)
|
|
|
|
setting(:cooldown_minutes_after_hiding_posts, 10)
|
2013-02-06 00:22:11 -05:00
|
|
|
|
2013-05-31 11:41:40 -04:00
|
|
|
setting(:num_flags_to_block_new_user, 3)
|
|
|
|
setting(:num_users_to_block_new_user, 3)
|
2013-09-05 11:27:15 -04:00
|
|
|
setting(:notify_mods_when_user_blocked, false)
|
2013-05-31 11:41:40 -04:00
|
|
|
|
2013-02-06 00:22:11 -05:00
|
|
|
# used mainly for dev, force hostname for Discourse.base_url
|
|
|
|
# You would usually use multisite for this
|
|
|
|
setting(:force_hostname, '')
|
2013-02-07 10:45:24 -05:00
|
|
|
setting(:port, Rails.env.development? ? 3000 : '')
|
2013-02-05 14:16:51 -05:00
|
|
|
setting(:enable_private_messages, true)
|
|
|
|
setting(:use_ssl, false)
|
|
|
|
setting(:queue_jobs, !Rails.env.test?)
|
2013-02-07 10:45:24 -05:00
|
|
|
setting(:crawl_images, !Rails.env.test?)
|
2013-02-05 14:16:51 -05:00
|
|
|
setting(:max_image_width, 690)
|
2013-08-25 18:24:24 -04:00
|
|
|
setting(:max_image_height, 500)
|
2013-08-07 16:18:50 -04:00
|
|
|
setting(:create_thumbnails, true)
|
2013-02-20 13:15:50 -05:00
|
|
|
client_setting(:category_featured_topics, 6)
|
2013-02-05 14:16:51 -05:00
|
|
|
setting(:topics_per_page, 30)
|
2013-06-20 17:20:08 -04:00
|
|
|
client_setting(:posts_per_page, 20)
|
2013-02-05 14:16:51 -05:00
|
|
|
setting(:invite_expiry_days, 14)
|
|
|
|
setting(:active_user_rate_limit_secs, 60)
|
|
|
|
setting(:previous_visit_timeout_hours, 1)
|
2013-06-07 20:15:49 -04:00
|
|
|
client_setting(:favicon_url, '/assets/default-favicon.ico')
|
2013-06-06 17:32:34 -04:00
|
|
|
setting(:apple_touch_icon_url, '/assets/default-apple-touch-icon.png')
|
2013-02-05 14:16:51 -05:00
|
|
|
|
|
|
|
setting(:ninja_edit_window, 5.minutes.to_i)
|
2013-08-12 11:12:12 -04:00
|
|
|
client_setting(:edit_history_visible_to_public, true)
|
2013-08-02 13:35:42 -04:00
|
|
|
client_setting(:delete_removed_posts_after, 24) # hours
|
2013-02-05 14:16:51 -05:00
|
|
|
setting(:post_undo_action_window_mins, 10)
|
2013-09-06 03:28:37 -04:00
|
|
|
setting(:site_contact_username, '')
|
2013-04-01 17:31:07 -04:00
|
|
|
setting(:max_mentions_per_post, 10)
|
2013-04-17 19:11:13 -04:00
|
|
|
setting(:newuser_max_mentions_per_post, 2)
|
2013-02-05 14:16:51 -05:00
|
|
|
|
2013-05-06 11:22:39 -04:00
|
|
|
client_setting(:uncategorized_name, 'uncategorized')
|
|
|
|
client_setting(:uncategorized_color, 'AB9364');
|
|
|
|
client_setting(:uncategorized_text_color, 'FFFFFF');
|
2013-02-05 14:16:51 -05:00
|
|
|
|
|
|
|
setting(:unique_posts_mins, Rails.env.test? ? 0 : 5)
|
|
|
|
|
|
|
|
# Rate Limits
|
|
|
|
setting(:rate_limit_create_topic, 5)
|
|
|
|
setting(:rate_limit_create_post, 5)
|
|
|
|
setting(:max_topics_per_day, 20)
|
|
|
|
setting(:max_private_messages_per_day, 20)
|
2013-04-30 15:45:27 -04:00
|
|
|
setting(:max_likes_per_day, 50)
|
2013-02-05 14:16:51 -05:00
|
|
|
setting(:max_bookmarks_per_day, 20)
|
|
|
|
setting(:max_flags_per_day, 20)
|
|
|
|
setting(:max_edits_per_day, 30)
|
|
|
|
setting(:max_favorites_per_day, 20)
|
|
|
|
|
2013-04-19 17:59:11 -04:00
|
|
|
setting(:email_time_window_mins, 10)
|
2013-07-22 15:06:37 -04:00
|
|
|
setting(:email_posts_context, 5)
|
2013-08-23 17:35:01 -04:00
|
|
|
setting(:default_digest_email_frequency, '7', enum: 'DigestEmailSiteSetting')
|
2013-02-07 10:45:24 -05:00
|
|
|
|
2013-02-05 14:16:51 -05:00
|
|
|
# How many characters we can import into a onebox
|
|
|
|
setting(:onebox_max_chars, 5000)
|
|
|
|
|
|
|
|
setting(:suggested_topics, 5)
|
|
|
|
|
|
|
|
setting(:allow_duplicate_topic_titles, false)
|
2013-02-07 10:45:24 -05:00
|
|
|
|
2013-05-27 12:45:10 -04:00
|
|
|
setting(:staff_like_weight, 3)
|
|
|
|
|
2013-02-10 19:43:07 -05:00
|
|
|
setting(:add_rel_nofollow_to_user_content, true)
|
2013-02-11 02:58:19 -05:00
|
|
|
setting(:exclude_rel_nofollow_domains, '')
|
2013-02-05 14:16:51 -05:00
|
|
|
setting(:post_excerpt_maxlength, 300)
|
|
|
|
setting(:post_onebox_maxlength, 500)
|
|
|
|
setting(:best_of_score_threshold, 15)
|
|
|
|
setting(:best_of_posts_required, 50)
|
|
|
|
setting(:best_of_likes_required, 1)
|
2013-03-23 11:14:07 -04:00
|
|
|
setting(:best_of_percent_filter, 20)
|
2013-02-05 14:16:51 -05:00
|
|
|
|
2013-02-07 10:45:24 -05:00
|
|
|
# we need to think of a way to force users to enter certain settings, this is a minimal config thing
|
2013-02-05 14:16:51 -05:00
|
|
|
setting(:notification_email, 'info@discourse.org')
|
2013-07-09 12:19:10 -04:00
|
|
|
setting(:email_custom_headers, 'Auto-Submitted: auto-generated')
|
2013-02-05 14:16:51 -05:00
|
|
|
|
2013-02-10 19:02:57 -05:00
|
|
|
setting(:allow_index_in_robots_txt, true)
|
|
|
|
|
2013-02-05 14:16:51 -05:00
|
|
|
setting(:send_welcome_message, true)
|
|
|
|
|
2013-06-05 14:06:05 -04:00
|
|
|
client_setting(:invite_only, false)
|
|
|
|
|
2013-06-04 18:30:16 -04:00
|
|
|
client_setting(:login_required, false)
|
|
|
|
|
2013-05-23 16:44:14 -04:00
|
|
|
client_setting(:enable_local_logins, true)
|
|
|
|
client_setting(:enable_local_account_create, true)
|
|
|
|
|
2013-02-27 22:46:56 -05:00
|
|
|
client_setting(:enable_google_logins, true)
|
|
|
|
client_setting(:enable_yahoo_logins, true)
|
|
|
|
|
2013-08-26 03:36:08 -04:00
|
|
|
client_setting(:enable_twitter_logins, true)
|
2013-02-05 14:16:51 -05:00
|
|
|
setting(:twitter_consumer_key, '')
|
|
|
|
setting(:twitter_consumer_secret, '')
|
2013-02-07 10:45:24 -05:00
|
|
|
|
2013-08-26 03:36:08 -04:00
|
|
|
# note we set this (and twitter to true for 2 reasons)
|
|
|
|
# 1. its an upgrade nightmare to change it to false, lots of people will complain
|
|
|
|
# 2. it advertises the feature (even though it is broken)
|
|
|
|
client_setting(:enable_facebook_logins, true)
|
2013-02-05 14:16:51 -05:00
|
|
|
setting(:facebook_app_id, '')
|
|
|
|
setting(:facebook_app_secret, '')
|
|
|
|
|
2013-05-23 16:40:50 -04:00
|
|
|
client_setting(:enable_cas_logins, false)
|
|
|
|
setting(:cas_hostname, '')
|
|
|
|
setting(:cas_domainname, '')
|
|
|
|
|
2013-02-25 23:28:32 -05:00
|
|
|
client_setting(:enable_github_logins, false)
|
|
|
|
setting(:github_client_id, '')
|
|
|
|
setting(:github_client_secret, '')
|
|
|
|
|
2013-03-04 12:01:20 -05:00
|
|
|
client_setting(:enable_persona_logins, false)
|
2013-03-01 14:51:00 -05:00
|
|
|
|
2013-02-05 14:16:51 -05:00
|
|
|
setting(:enforce_global_nicknames, true)
|
|
|
|
setting(:discourse_org_access_key, '')
|
2013-06-13 04:18:17 -04:00
|
|
|
|
2013-02-05 14:16:51 -05:00
|
|
|
setting(:enable_s3_uploads, false)
|
2013-05-30 21:13:37 -04:00
|
|
|
setting(:s3_access_key_id, '')
|
|
|
|
setting(:s3_secret_access_key, '')
|
2013-06-11 14:23:52 -04:00
|
|
|
setting(:s3_region, '', enum: 'S3RegionSiteSetting')
|
2013-02-05 14:16:51 -05:00
|
|
|
setting(:s3_upload_bucket, '')
|
|
|
|
|
2013-07-06 13:42:30 -04:00
|
|
|
setting(:enable_flash_video_onebox, false)
|
|
|
|
|
2013-02-05 14:16:51 -05:00
|
|
|
setting(:default_trust_level, 0)
|
|
|
|
setting(:default_invitee_trust_level, 1)
|
|
|
|
|
|
|
|
# Import/Export settings
|
|
|
|
setting(:allow_import, false)
|
|
|
|
|
|
|
|
# Trust related
|
|
|
|
setting(:basic_requires_topics_entered, 5)
|
2013-02-13 04:23:02 -05:00
|
|
|
setting(:basic_requires_read_posts, 50)
|
2013-03-24 02:52:34 -04:00
|
|
|
setting(:basic_requires_time_spent_mins, 15)
|
2013-02-05 14:16:51 -05:00
|
|
|
|
2013-06-23 00:32:37 -04:00
|
|
|
setting(:regular_requires_topics_entered, 20)
|
2013-04-05 00:29:46 -04:00
|
|
|
setting(:regular_requires_read_posts, 100)
|
|
|
|
setting(:regular_requires_time_spent_mins, 60)
|
|
|
|
setting(:regular_requires_days_visited, 15)
|
|
|
|
setting(:regular_requires_likes_received, 1)
|
|
|
|
setting(:regular_requires_likes_given, 1)
|
|
|
|
setting(:regular_requires_topic_reply_count, 3)
|
|
|
|
|
2013-09-03 19:12:22 -04:00
|
|
|
setting(:min_trust_to_create_topic, 0, enum: 'MinTrustToCreateTopicSetting')
|
|
|
|
|
2013-06-10 16:46:08 -04:00
|
|
|
# Reply by Email Settings
|
|
|
|
setting(:reply_by_email_enabled, false)
|
2013-06-13 18:11:10 -04:00
|
|
|
setting(:reply_by_email_address, '')
|
|
|
|
|
|
|
|
setting(:pop3s_polling_enabled, false)
|
|
|
|
setting(:pop3s_polling_host, '')
|
|
|
|
setting(:pop3s_polling_port, 995)
|
|
|
|
setting(:pop3s_polling_username, '')
|
|
|
|
setting(:pop3s_polling_password, '')
|
2013-06-10 16:46:08 -04:00
|
|
|
|
2013-02-06 20:09:31 -05:00
|
|
|
# Entropy checks
|
|
|
|
setting(:title_min_entropy, 10)
|
|
|
|
setting(:body_min_entropy, 7)
|
|
|
|
setting(:max_word_length, 30)
|
|
|
|
|
2013-04-17 19:11:13 -04:00
|
|
|
setting(:newuser_max_links, 2)
|
2013-07-04 18:43:54 -04:00
|
|
|
client_setting(:newuser_max_images, 0)
|
2013-07-21 20:39:17 -04:00
|
|
|
client_setting(:newuser_max_attachments, 0)
|
2013-02-13 16:12:30 -05:00
|
|
|
|
2013-05-10 16:58:23 -04:00
|
|
|
setting(:newuser_spam_host_threshold, 3)
|
|
|
|
|
2013-02-19 16:08:23 -05:00
|
|
|
setting(:title_fancy_entities, true)
|
|
|
|
|
2013-02-28 14:31:39 -05:00
|
|
|
# The default locale for the site
|
2013-06-11 11:39:55 -04:00
|
|
|
setting(:default_locale, 'en', enum: 'LocaleSiteSetting')
|
2013-02-28 14:31:39 -05:00
|
|
|
|
2013-02-14 12:10:53 -05:00
|
|
|
client_setting(:educate_until_posts, 2)
|
|
|
|
|
2013-03-19 13:51:25 -04:00
|
|
|
setting(:max_similar_results, 7)
|
|
|
|
|
2013-04-23 15:06:13 -04:00
|
|
|
# Settings for topic heat
|
|
|
|
client_setting(:topic_views_heat_low, 1000)
|
|
|
|
client_setting(:topic_views_heat_medium, 2000)
|
|
|
|
client_setting(:topic_views_heat_high, 5000)
|
|
|
|
|
2013-06-19 13:13:12 -04:00
|
|
|
setting(:minimum_topics_similar, 50)
|
|
|
|
|
2013-08-24 02:28:51 -04:00
|
|
|
client_setting(:relative_date_duration, 30)
|
2013-07-10 12:38:43 -04:00
|
|
|
|
2013-08-13 03:41:23 -04:00
|
|
|
client_setting(:delete_user_max_age, 14)
|
2013-07-26 15:40:08 -04:00
|
|
|
setting(:delete_all_posts_max, 10)
|
|
|
|
|
2013-08-12 14:54:52 -04:00
|
|
|
setting(:username_change_period, 3) # days
|
2013-09-07 22:42:41 -04:00
|
|
|
setting(:email_editable, true)
|
2013-08-12 14:54:52 -04:00
|
|
|
|
2013-08-05 00:08:08 -04:00
|
|
|
client_setting(:allow_uploaded_avatars, true)
|
2013-08-23 12:48:29 -04:00
|
|
|
client_setting(:allow_animated_avatars, false)
|
2013-08-02 18:31:25 -04:00
|
|
|
|
2013-09-11 15:14:18 -04:00
|
|
|
setting(:detect_custom_avatars, false)
|
|
|
|
setting(:max_daily_gravatar_crawls, 500)
|
|
|
|
|
2013-09-13 13:49:34 -04:00
|
|
|
setting(:sequential_replies_threshold, 2)
|
|
|
|
|
2013-03-25 21:04:28 -04:00
|
|
|
def self.generate_api_key!
|
2013-03-27 16:17:49 -04:00
|
|
|
self.api_key = SecureRandom.hex(32)
|
2013-03-25 21:04:28 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def self.api_key_valid?(tested)
|
2013-03-27 16:17:49 -04:00
|
|
|
t = tested.strip
|
2013-03-25 21:04:28 -04:00
|
|
|
t.length == 64 && t == self.api_key
|
|
|
|
end
|
|
|
|
|
2013-02-14 12:57:26 -05:00
|
|
|
def self.call_discourse_hub?
|
2013-03-04 19:42:44 -05:00
|
|
|
self.enforce_global_nicknames? && self.discourse_org_access_key.present?
|
2013-02-05 14:16:51 -05:00
|
|
|
end
|
|
|
|
|
2013-02-26 11:27:59 -05:00
|
|
|
def self.topic_title_length
|
|
|
|
min_topic_title_length..max_topic_title_length
|
|
|
|
end
|
|
|
|
|
2013-06-04 17:58:25 -04:00
|
|
|
def self.private_message_title_length
|
|
|
|
min_private_message_title_length..max_topic_title_length
|
|
|
|
end
|
|
|
|
|
2013-02-28 13:54:12 -05:00
|
|
|
def self.post_length
|
|
|
|
min_post_length..max_post_length
|
|
|
|
end
|
2013-03-28 09:01:13 -04:00
|
|
|
|
2013-06-13 04:18:17 -04:00
|
|
|
def self.private_message_post_length
|
|
|
|
min_private_message_post_length..max_post_length
|
|
|
|
end
|
|
|
|
|
2013-06-21 16:31:40 -04:00
|
|
|
def self.top_menu_items
|
|
|
|
top_menu.split('|').map { |menu_item| TopMenuItem.new(menu_item) }
|
|
|
|
end
|
|
|
|
|
2013-03-28 09:01:13 -04:00
|
|
|
def self.homepage
|
2013-06-21 16:31:40 -04:00
|
|
|
top_menu_items[0].name
|
2013-03-28 09:01:13 -04:00
|
|
|
end
|
|
|
|
|
2013-07-15 19:59:23 -04:00
|
|
|
def self.anonymous_menu_items
|
|
|
|
@anonymous_menu_items ||= Set.new ['latest', 'hot', 'categories', 'category']
|
|
|
|
end
|
|
|
|
|
2013-03-28 09:01:13 -04:00
|
|
|
def self.anonymous_homepage
|
2013-07-15 19:59:23 -04:00
|
|
|
top_menu_items.map { |item| item.name }
|
|
|
|
.select { |item| anonymous_menu_items.include?(item) }
|
|
|
|
.first
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.authorized_uploads
|
|
|
|
authorized_extensions.tr(" ", "")
|
|
|
|
.split("|")
|
2013-08-01 19:27:48 -04:00
|
|
|
.map { |extension| (extension.start_with?(".") ? extension[1..-1] : extension).gsub(".", "\.") }
|
2013-03-28 09:01:13 -04:00
|
|
|
end
|
|
|
|
|
2013-07-15 19:59:23 -04:00
|
|
|
def self.authorized_upload?(file)
|
2013-08-01 19:27:48 -04:00
|
|
|
authorized_uploads.count > 0 && file.original_filename =~ /\.(#{authorized_uploads.join("|")})$/i
|
2013-07-10 16:54:05 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def self.images
|
2013-08-01 19:27:48 -04:00
|
|
|
@images ||= Set.new ["jpg", "jpeg", "png", "gif", "tif", "tiff", "bmp"]
|
2013-07-15 19:59:23 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def self.authorized_images
|
|
|
|
authorized_uploads.select { |extension| images.include?(extension) }
|
2013-07-10 16:54:05 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def self.authorized_image?(file)
|
2013-08-01 19:27:48 -04:00
|
|
|
authorized_images.count > 0 && file.original_filename =~ /\.(#{authorized_images.join("|")})$/i
|
2013-07-10 16:54:05 -04:00
|
|
|
end
|
|
|
|
|
2013-02-05 14:16:51 -05:00
|
|
|
end
|
2013-05-23 22:48:32 -04:00
|
|
|
|
|
|
|
# == Schema Information
|
|
|
|
#
|
|
|
|
# Table name: site_settings
|
|
|
|
#
|
|
|
|
# id :integer not null, primary key
|
|
|
|
# name :string(255) not null
|
|
|
|
# data_type :integer not null
|
|
|
|
# value :text
|
|
|
|
# created_at :datetime not null
|
|
|
|
# updated_at :datetime not null
|
|
|
|
#
|
|
|
|
|