camaleon_cms 2.2.1 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of camaleon_cms might be problematic. Click here for more details.

Files changed (139) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +16 -3
  3. data/app/apps/plugins/attack/admin_controller.rb +1 -9
  4. data/app/apps/plugins/attack/attack_helper.rb +1 -9
  5. data/app/apps/plugins/attack/config/custom_models.rb +1 -1
  6. data/app/apps/plugins/attack/models/attack.rb +1 -10
  7. data/app/apps/plugins/authoring_post/authoring_post_helper.rb +51 -0
  8. data/app/apps/plugins/authoring_post/config/config.json +24 -0
  9. data/app/apps/plugins/front_cache/admin_controller.rb +0 -8
  10. data/app/apps/plugins/front_cache/config/initializer.rb +1 -1
  11. data/app/apps/plugins/front_cache/front_cache_helper.rb +0 -8
  12. data/app/apps/plugins/visibility_post/visibility_post_helper.rb +1 -9
  13. data/app/apps/themes/camaleon_first/main_helper.rb +1 -9
  14. data/app/apps/themes/default/default_helper.rb +1 -9
  15. data/app/apps/themes/default/views/partials/_forms.html.erb +1 -1
  16. data/app/apps/themes/new/custom_helper.rb +1 -9
  17. data/app/assets/javascripts/camaleon_cms/admin/_custom_fields.js +3 -3
  18. data/app/controllers/camaleon_cms/admin/appearances/nav_menus_controller.rb +2 -10
  19. data/app/controllers/camaleon_cms/admin/appearances/themes_controller.rb +0 -8
  20. data/app/controllers/camaleon_cms/admin/appearances/widgets/assign_controller.rb +1 -9
  21. data/app/controllers/camaleon_cms/admin/appearances/widgets/main_controller.rb +2 -10
  22. data/app/controllers/camaleon_cms/admin/appearances/widgets/sidebar_controller.rb +2 -10
  23. data/app/controllers/camaleon_cms/admin/categories_controller.rb +2 -12
  24. data/app/controllers/camaleon_cms/admin/comments_controller.rb +0 -8
  25. data/app/controllers/camaleon_cms/admin/installers_controller.rb +1 -9
  26. data/app/controllers/camaleon_cms/admin/media_controller.rb +2 -10
  27. data/app/controllers/camaleon_cms/admin/plugins_controller.rb +0 -8
  28. data/app/controllers/camaleon_cms/admin/post_tags_controller.rb +2 -12
  29. data/app/controllers/camaleon_cms/admin/posts/drafts_controller.rb +2 -10
  30. data/app/controllers/camaleon_cms/admin/posts_controller.rb +7 -15
  31. data/app/controllers/camaleon_cms/admin/sessions_controller.rb +2 -10
  32. data/app/controllers/camaleon_cms/admin/settings/custom_fields_controller.rb +5 -12
  33. data/app/controllers/camaleon_cms/admin/settings/post_types_controller.rb +1 -9
  34. data/app/controllers/camaleon_cms/admin/settings/sites_controller.rb +2 -10
  35. data/app/controllers/camaleon_cms/admin/settings_controller.rb +1 -9
  36. data/app/controllers/camaleon_cms/admin/user_roles_controller.rb +2 -10
  37. data/app/controllers/camaleon_cms/admin/users_controller.rb +3 -11
  38. data/app/controllers/camaleon_cms/admin_controller.rb +0 -8
  39. data/app/controllers/camaleon_cms/apps/plugins_admin_controller.rb +0 -8
  40. data/app/controllers/camaleon_cms/apps/plugins_front_controller.rb +0 -8
  41. data/app/controllers/camaleon_cms/apps/themes_admin_controller.rb +0 -8
  42. data/app/controllers/camaleon_cms/apps/themes_front_controller.rb +0 -8
  43. data/app/controllers/camaleon_cms/camaleon_controller.rb +0 -8
  44. data/app/controllers/camaleon_cms/frontend_controller.rb +17 -27
  45. data/app/controllers/concerns/camaleon_cms/frontend_concern.rb +2 -10
  46. data/app/decorators/camaleon_cms/application_decorator.rb +1 -9
  47. data/app/decorators/camaleon_cms/category_decorator.rb +0 -8
  48. data/app/decorators/camaleon_cms/custom_field_decorator.rb +0 -8
  49. data/app/decorators/camaleon_cms/custom_fields_concern.rb +1 -9
  50. data/app/decorators/camaleon_cms/metas_decorator_methods.rb +1 -9
  51. data/app/decorators/camaleon_cms/nav_menu_item_decorator.rb +0 -8
  52. data/app/decorators/camaleon_cms/plugin_decorator.rb +0 -8
  53. data/app/decorators/camaleon_cms/post_comment_decorator.rb +0 -8
  54. data/app/decorators/camaleon_cms/post_decorator.rb +0 -8
  55. data/app/decorators/camaleon_cms/post_tag_decorator.rb +0 -8
  56. data/app/decorators/camaleon_cms/post_type_decorator.rb +0 -8
  57. data/app/decorators/camaleon_cms/site_decorator.rb +0 -8
  58. data/app/decorators/camaleon_cms/term_taxonomy_decorator.rb +0 -8
  59. data/app/decorators/camaleon_cms/theme_decorator.rb +0 -8
  60. data/app/decorators/camaleon_cms/user_decorator.rb +0 -8
  61. data/app/decorators/camaleon_cms/widget_decorator.rb +0 -8
  62. data/app/helpers/camaleon_cms/admin/application_helper.rb +1 -9
  63. data/app/helpers/camaleon_cms/admin/breadcrumb_helper.rb +1 -9
  64. data/app/helpers/camaleon_cms/admin/category_helper.rb +1 -9
  65. data/app/helpers/camaleon_cms/admin/custom_fields_helper.rb +1 -9
  66. data/app/helpers/camaleon_cms/admin/menus_helper.rb +0 -8
  67. data/app/helpers/camaleon_cms/admin/post_type_helper.rb +1 -9
  68. data/app/helpers/camaleon_cms/camaleon_helper.rb +0 -8
  69. data/app/helpers/camaleon_cms/captcha_helper.rb +0 -8
  70. data/app/helpers/camaleon_cms/comment_helper.rb +1 -1
  71. data/app/helpers/camaleon_cms/content_helper.rb +1 -9
  72. data/app/helpers/camaleon_cms/frontend/application_helper.rb +0 -8
  73. data/app/helpers/camaleon_cms/frontend/nav_menu_helper.rb +0 -8
  74. data/app/helpers/camaleon_cms/frontend/seo_helper.rb +0 -8
  75. data/app/helpers/camaleon_cms/frontend/site_helper.rb +0 -8
  76. data/app/helpers/camaleon_cms/hooks_helper.rb +0 -8
  77. data/app/helpers/camaleon_cms/html_helper.rb +0 -8
  78. data/app/helpers/camaleon_cms/plugins_helper.rb +12 -16
  79. data/app/helpers/camaleon_cms/session_helper.rb +0 -8
  80. data/app/helpers/camaleon_cms/short_code_helper.rb +0 -8
  81. data/app/helpers/camaleon_cms/site_helper.rb +0 -8
  82. data/app/helpers/camaleon_cms/theme_helper.rb +0 -8
  83. data/app/helpers/camaleon_cms/uploader_helper.rb +0 -8
  84. data/app/helpers/camaleon_cms/user_roles_helper.rb +1 -9
  85. data/app/mailers/camaleon_cms/html_mailer.rb +0 -8
  86. data/app/models/camaleon_cms/ability.rb +6 -8
  87. data/app/models/camaleon_cms/category.rb +0 -8
  88. data/app/models/camaleon_cms/custom_field.rb +1 -9
  89. data/app/models/camaleon_cms/custom_field_group.rb +0 -8
  90. data/app/models/camaleon_cms/custom_fields_relationship.rb +1 -9
  91. data/app/models/camaleon_cms/meta.rb +1 -9
  92. data/app/models/camaleon_cms/nav_menu.rb +0 -8
  93. data/app/models/camaleon_cms/nav_menu_item.rb +1 -9
  94. data/app/models/camaleon_cms/plugin.rb +0 -8
  95. data/app/models/camaleon_cms/post.rb +1 -9
  96. data/app/models/camaleon_cms/post_comment.rb +1 -10
  97. data/app/models/camaleon_cms/post_default.rb +6 -14
  98. data/app/models/camaleon_cms/post_relationship.rb +1 -9
  99. data/app/models/camaleon_cms/post_tag.rb +0 -8
  100. data/app/models/camaleon_cms/post_type.rb +1 -9
  101. data/app/models/camaleon_cms/site.rb +2 -10
  102. data/app/models/camaleon_cms/term_relationship.rb +0 -9
  103. data/app/models/camaleon_cms/term_taxonomy.rb +3 -11
  104. data/app/models/camaleon_cms/theme.rb +0 -8
  105. data/app/models/camaleon_cms/user.rb +3 -13
  106. data/app/models/camaleon_cms/user_relationship.rb +1 -9
  107. data/app/models/camaleon_cms/user_role.rb +0 -8
  108. data/app/models/camaleon_cms/widget.rb +1 -9
  109. data/app/models/camaleon_cms/widget/assigned.rb +1 -9
  110. data/app/models/camaleon_cms/widget/main.rb +1 -9
  111. data/app/models/camaleon_cms/widget/sidebar.rb +0 -8
  112. data/app/models/concerns/camaleon_cms/categories_tags_for_posts.rb +1 -9
  113. data/app/models/concerns/camaleon_cms/custom_fields_read.rb +2 -10
  114. data/app/models/concerns/camaleon_cms/metas.rb +6 -14
  115. data/app/models/plugins.rb +0 -8
  116. data/app/models/themes.rb +0 -8
  117. data/app/uploaders/camaleon_cms_aws_uploader.rb +1 -1
  118. data/app/uploaders/camaleon_cms_local_uploader.rb +2 -2
  119. data/app/uploaders/camaleon_cms_uploader.rb +1 -1
  120. data/app/views/camaleon_cms/admin/posts/form.html.erb +1 -1
  121. data/app/views/camaleon_cms/admin/sessions/forgot.html.erb +1 -1
  122. data/app/views/camaleon_cms/admin/sessions/login.html.erb +1 -1
  123. data/app/views/camaleon_cms/admin/sessions/register.html.erb +1 -1
  124. data/app/views/camaleon_cms/admin/users/form.html.erb +1 -1
  125. data/app/views/camaleon_cms/default_theme/partials/_forms.html.erb +1 -1
  126. data/app/views/layouts/camaleon_cms/admin.html.erb +1 -1
  127. data/app/views/layouts/camaleon_cms/admin/_ajax.html.erb +1 -1
  128. data/config/initializers/action_view.rb +33 -17
  129. data/config/initializers/active_record_extension.rb +0 -8
  130. data/config/initializers/assets.rb +2 -9
  131. data/config/initializers/custom_initializers.rb +0 -8
  132. data/config/locales/camaleon_cms/admin/en.yml +12 -12
  133. data/db/migrate/20150611161134_post_table_into_utf8.rb +22 -14
  134. data/db/migrate/20151212095328_add_confirm_token_to_users.rb +3 -3
  135. data/db/migrate/20160504155653_move_first_name_of_users.rb +3 -3
  136. data/lib/camaleon_cms/engine.rb +1 -2
  137. data/lib/camaleon_cms/version.rb +1 -1
  138. data/lib/plugin_routes.rb +1 -2
  139. metadata +4 -30
@@ -1,12 +1,4 @@
1
- =begin
2
- Camaleon CMS is a content management system
3
- Copyright (C) 2015 by Owen Peredo Diaz
4
- Email: owenperedo@gmail.com
5
- This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
6
- This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
7
- See the GNU Affero General Public License (GPLv3) for more details.
8
- =end
9
1
  class CamaleonCms::Meta < ActiveRecord::Base
10
2
  self.table_name = "#{PluginRoutes.static_system_info["db_prefix"]}metas"
11
- attr_accessible :objectid, :key, :value, :object_class
3
+ # attr_accessible :objectid, :key, :value, :object_class
12
4
  end
@@ -1,11 +1,3 @@
1
- =begin
2
- Camaleon CMS is a content management system
3
- Copyright (C) 2015 by Owen Peredo Diaz
4
- Email: owenperedo@gmail.com
5
- This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
6
- This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
7
- See the GNU Affero General Public License (GPLv3) for more details.
8
- =end
9
1
  class CamaleonCms::NavMenu < CamaleonCms::TermTaxonomy
10
2
  default_scope { where(taxonomy: :nav_menu).order(id: :asc) }
11
3
  alias_attribute :site_id, :parent_id
@@ -1,17 +1,9 @@
1
- =begin
2
- Camaleon CMS is a content management system
3
- Copyright (C) 2015 by Owen Peredo Diaz
4
- Email: owenperedo@gmail.com
5
- This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
6
- This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
7
- See the GNU Affero General Public License (GPLv3) for more details.
8
- =end
9
1
  class CamaleonCms::NavMenuItem < CamaleonCms::TermTaxonomy
10
2
  alias_attribute :site_id, :term_group
11
3
  alias_attribute :label, :name
12
4
  alias_attribute :url, :description
13
5
  alias_attribute :kind, :slug
14
- attr_accessible :label, :url, :kind
6
+ # attr_accessible :label, :url, :kind
15
7
  default_scope { where(taxonomy: :nav_menu_item).order(id: :asc) }
16
8
  has_many :metas, ->{ where(object_class: 'NavMenuItem')}, :class_name => "CamaleonCms::Meta", foreign_key: :objectid, dependent: :destroy
17
9
  belongs_to :parent, class_name: "CamaleonCms::NavMenu", inverse_of: :children
@@ -1,11 +1,3 @@
1
- =begin
2
- Camaleon CMS is a content management system
3
- Copyright (C) 2015 by Owen Peredo Diaz
4
- Email: owenperedo@gmail.com
5
- This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
6
- This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
7
- See the GNU Affero General Public License (GPLv3) for more details.
8
- =end
9
1
  class CamaleonCms::Plugin < CamaleonCms::TermTaxonomy
10
2
  # attrs:
11
3
  # term_group => status active (1, nil)
@@ -1,11 +1,3 @@
1
- =begin
2
- Camaleon CMS is a content management system
3
- Copyright (C) 2015 by Owen Peredo Diaz
4
- Email: owenperedo@gmail.com
5
- This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
6
- This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
7
- See the GNU Affero General Public License (GPLv3) for more details.
8
- =end
9
1
  class CamaleonCms::PostUniqValidator < ActiveModel::Validator
10
2
  def validate(record)
11
3
  if record.status != 'draft'
@@ -247,4 +239,4 @@ class CamaleonCms::Post < CamaleonCms::PostDefault
247
239
  def decorator_class
248
240
  (self.post_type.get_option('cama_post_decorator_class', 'CamaleonCms::PostDecorator') rescue 'CamaleonCms::PostDecorator').constantize
249
241
  end
250
- end
242
+ end
@@ -1,16 +1,7 @@
1
- =begin
2
- Camaleon CMS is a content management system
3
- Copyright (C) 2015 by Owen Peredo Diaz
4
- Email: owenperedo@gmail.com
5
- This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
6
- This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
7
- See the GNU Affero General Public License (GPLv3) for more details.
8
- =end
9
1
  class CamaleonCms::PostComment < ActiveRecord::Base
10
2
  include CamaleonCms::Metas
11
3
  self.table_name = "#{PluginRoutes.static_system_info["db_prefix"]}comments"
12
- attr_accessible :user_id, :post_id, :content, :author, :author_email, :author_url, :author_IP,
13
- :approved, :agent, :agent, :typee, :comment_parent, :is_anonymous
4
+ # attr_accessible :user_id, :post_id, :content, :author, :author_email, :author_url, :author_IP, :approved, :agent, :agent, :typee, :comment_parent, :is_anonymous
14
5
  attr_accessor :is_anonymous
15
6
 
16
7
  #default_scope order('comments.created_at ASC')
@@ -1,20 +1,12 @@
1
- =begin
2
- Camaleon CMS is a content management system
3
- Copyright (C) 2015 by Owen Peredo Diaz
4
- Email: owenperedo@gmail.com
5
- This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
6
- This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
7
- See the GNU Affero General Public License (GPLv3) for more details.
8
- =end
9
1
  class CamaleonCms::PostDefault < ActiveRecord::Base
10
2
  include CamaleonCms::Metas
11
3
  include CamaleonCms::CustomFieldsRead
12
4
  self.table_name = "#{PluginRoutes.static_system_info["db_prefix"]}posts"
13
5
 
14
- attr_accessible :user_id, :title, :slug, :content, :content_filtered, :status, :visibility, :visibility_value, :post_order, :post_type_key, :taxonomy_id, :published_at, :post_parent, :post_order, :is_feature
6
+ # attr_accessible :user_id, :title, :slug, :content, :content_filtered, :status, :visibility, :visibility_value, :post_order, :post_type_key, :taxonomy_id, :published_at, :post_parent, :post_order, :is_feature
15
7
  attr_accessor :draft_id
16
- attr_accessible :data_options
17
- attr_accessible :data_metas
8
+ # attr_accessible :data_options
9
+ # attr_accessible :data_metas
18
10
  cattr_accessor :current_user
19
11
  cattr_accessor :current_site
20
12
 
@@ -60,10 +52,10 @@ class CamaleonCms::PostDefault < ActiveRecord::Base
60
52
  end
61
53
 
62
54
  # Set the meta, field values and the post keywords here
63
- def set_params(meta, field_options, post_data_keywords)
55
+ def set_params(meta, custom_fields, options)
64
56
  self.set_metas(meta)
65
- self.set_field_values(field_options)
66
- self.set_option("keywords", post_data_keywords)
57
+ self.set_field_values(custom_fields)
58
+ self.set_options(options)
67
59
  end
68
60
 
69
61
  private
@@ -1,16 +1,8 @@
1
- =begin
2
- Camaleon CMS is a content management system
3
- Copyright (C) 2015 by Owen Peredo Diaz
4
- Email: owenperedo@gmail.com
5
- This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
6
- This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
7
- See the GNU Affero General Public License (GPLv3) for more details.
8
- =end
9
1
 
10
2
  # DEPRECATED MODEL, NOT USED ANY MORE
11
3
  class CamaleonCms::PostRelationship < ActiveRecord::Base
12
4
  self.table_name = "#{PluginRoutes.static_system_info["db_prefix"]}term_relationships"
13
- attr_accessible :objectid, :term_taxonomy_id, :term_order
5
+ # attr_accessible :objectid, :term_taxonomy_id, :term_order
14
6
  default_scope ->{ order(term_order: :asc) }
15
7
 
16
8
  belongs_to :post_type, :class_name => "CamaleonCms::PostType", foreign_key: :term_taxonomy_id, inverse_of: :post_relationships
@@ -1,11 +1,3 @@
1
- =begin
2
- Camaleon CMS is a content management system
3
- Copyright (C) 2015 by Owen Peredo Diaz
4
- Email: owenperedo@gmail.com
5
- This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
6
- This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
7
- See the GNU Affero General Public License (GPLv3) for more details.
8
- =end
9
1
  class CamaleonCms::PostTag < CamaleonCms::TermTaxonomy
10
2
  default_scope { where(taxonomy: :post_tag) }
11
3
  has_many :metas, ->{ where(object_class: 'PostTag')}, :class_name => "CamaleonCms::Meta", foreign_key: :objectid, dependent: :destroy
@@ -1,11 +1,3 @@
1
- =begin
2
- Camaleon CMS is a content management system
3
- Copyright (C) 2015 by Owen Peredo Diaz
4
- Email: owenperedo@gmail.com
5
- This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
6
- This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
7
- See the GNU Affero General Public License (GPLv3) for more details.
8
- =end
9
1
  class CamaleonCms::PostType < CamaleonCms::TermTaxonomy
10
2
  alias_attribute :site_id, :parent_id
11
3
  default_scope { where(taxonomy: :post_type) }
@@ -89,7 +81,7 @@ class CamaleonCms::PostType < CamaleonCms::TermTaxonomy
89
81
  if manage_categories?
90
82
  cat = self.categories.find_by_slug("uncategorized")
91
83
  unless cat.present?
92
- cat = self.categories.create({name: 'Uncategorized', slug: 'uncategorized', parent: self.id})
84
+ cat = self.categories.create({name: 'Uncategorized', slug: 'uncategorized', parent_id: self.id})
93
85
  cat.set_option("not_deleted", true)
94
86
  end
95
87
  cat
@@ -1,11 +1,3 @@
1
- =begin
2
- Camaleon CMS is a content management system
3
- Copyright (C) 2015 by Owen Peredo Diaz
4
- Email: owenperedo@gmail.com
5
- This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
6
- This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
7
- See the GNU Affero General Public License (GPLv3) for more details.
8
- =end
9
1
  class CamaleonCms::Site < CamaleonCms::TermTaxonomy
10
2
  # attrs: [name, description, slug]
11
3
  default_scope { where(taxonomy: :site).reorder(term_group: :desc) }
@@ -294,7 +286,7 @@ class CamaleonCms::Site < CamaleonCms::TermTaxonomy
294
286
  else
295
287
  title = "Welcome"
296
288
  slug = 'welcome'
297
- content = "<p style='text-align: center;'><img width='155' height='155' src='http://camaleon.tuzitio.com/media/132/logo2.png' alt='logo' /></p><p><strong>Camaleon CMS</strong>&nbsp;is a free and open-source tool and a fexible content management system (CMS) based on <a href='rubyonrails.org'>Ruby on Rails 4</a>&nbsp;and MySQL.&nbsp;</p> <p>With Camaleon you can do the following:</p> <ul> <li>Create instantly a lot of sites&nbsp;in the same installation</li> <li>Manage your content information in several languages</li> <li>Extend current functionality by&nbsp;plugins (MVC structure and no more echo or prints anywhere)</li> <li>Create or install different themes for each site</li> <li>Create your own structure without coding anything (adapt Camaleon as you want&nbsp;and not you for Camaleon)</li> <li>Create your store and start to sell your products using our plugins</li> <li>Avoid web attacks</li> <li>Compare the speed and enjoy the speed of your new Camaleon site</li> <li>Customize or create your themes for mobile support</li> <li>Support&nbsp;more visitors at the same time</li> <li>Manage your information with a panel like wordpress&nbsp;</li> <li>All urls are oriented for SEO</li> <li>Multiples roles of users</li> </ul>"
289
+ content = "<p style='text-align: center;'><img width='155' height='155' src='http://camaleon.tuzitio.com/media/132/logo2.png' alt='logo' /></p><p><strong>Camaleon CMS</strong>&nbsp;is a free and open-source tool and a fexible content management system (CMS) based on <a href='http://rubyonrails.org'>Ruby on Rails 4</a>&nbsp;and MySQL.&nbsp;</p> <p>With Camaleon you can do the following:</p> <ul> <li>Create instantly a lot of sites&nbsp;in the same installation</li> <li>Manage your content information in several languages</li> <li>Extend current functionality by&nbsp;plugins (MVC structure and no more echo or prints anywhere)</li> <li>Create or install different themes for each site</li> <li>Create your own structure without coding anything (adapt Camaleon as you want&nbsp;and not you for Camaleon)</li> <li>Create your store and start to sell your products using our plugins</li> <li>Avoid web attacks</li> <li>Compare the speed and enjoy the speed of your new Camaleon site</li> <li>Customize or create your themes for mobile support</li> <li>Support&nbsp;more visitors at the same time</li> <li>Manage your information with a panel like wordpress&nbsp;</li> <li>All urls are oriented for SEO</li> <li>Multiples roles of users</li> </ul>"
298
290
  end
299
291
  user = self.users.admin_scope.first
300
292
  user = self.users.admin_scope.create({email: 'admin@local.com', username: 'admin', password: 'admin', password_confirmation: 'admin', first_name: 'Administrator'}) unless user.present?
@@ -328,4 +320,4 @@ class CamaleonCms::Site < CamaleonCms::TermTaxonomy
328
320
  self.name = slug unless self.name.present?
329
321
  self.slug = slug.to_s.try(:downcase)
330
322
  end
331
- end
323
+ end
@@ -1,14 +1,5 @@
1
- =begin
2
- Camaleon CMS is a content management system
3
- Copyright (C) 2015 by Owen Peredo Diaz
4
- Email: owenperedo@gmail.com
5
- This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
6
- This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
7
- See the GNU Affero General Public License (GPLv3) for more details.
8
- =end
9
1
  class CamaleonCms::TermRelationship < ActiveRecord::Base
10
2
  self.table_name = "#{PluginRoutes.static_system_info["db_prefix"]}term_relationships"
11
- attr_accessible :objectid, :term_taxonomy_id, :term_order
12
3
  default_scope ->{ order(term_order: :asc) }
13
4
 
14
5
  belongs_to :term_taxonomies, :class_name => "CamaleonCms::TermTaxonomy", foreign_key: :term_taxonomy_id, inverse_of: :term_relationships
@@ -1,11 +1,3 @@
1
- =begin
2
- Camaleon CMS is a content management system
3
- Copyright (C) 2015 by Owen Peredo Diaz
4
- Email: owenperedo@gmail.com
5
- This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
6
- This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
7
- See the GNU Affero General Public License (GPLv3) for more details.
8
- =end
9
1
  class CamaleonCms::UniqValidator < ActiveModel::Validator
10
2
  def validate(record)
11
3
  unless record.skip_slug_validation?
@@ -17,9 +9,9 @@ class CamaleonCms::TermTaxonomy < ActiveRecord::Base
17
9
  include CamaleonCms::Metas
18
10
  include CamaleonCms::CustomFieldsRead
19
11
  self.table_name = "#{PluginRoutes.static_system_info["db_prefix"]}term_taxonomy"
20
- attr_accessible :taxonomy, :description, :parent_id, :count, :name, :slug, :term_group, :status, :term_order, :user_id
21
- attr_accessible :data_options
22
- attr_accessible :data_metas
12
+ # attr_accessible :taxonomy, :description, :parent_id, :count, :name, :slug, :term_group, :status, :term_order, :user_id
13
+ # attr_accessible :data_options
14
+ # attr_accessible :data_metas
23
15
 
24
16
  # callbacks
25
17
  before_validation :before_validating
@@ -1,11 +1,3 @@
1
- =begin
2
- Camaleon CMS is a content management system
3
- Copyright (C) 2015 by Owen Peredo Diaz
4
- Email: owenperedo@gmail.com
5
- This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
6
- This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
7
- See the GNU Affero General Public License (GPLv3) for more details.
8
- =end
9
1
  class CamaleonCms::Theme < CamaleonCms::TermTaxonomy
10
2
  # attrs:
11
3
  # slug => plugin key
@@ -1,11 +1,3 @@
1
- =begin
2
- Camaleon CMS is a content management system
3
- Copyright (C) 2015 by Owen Peredo Diaz
4
- Email: owenperedo@gmail.com
5
- This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
6
- This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
7
- See the GNU Affero General Public License (GPLv3) for more details.
8
- =end
9
1
  class CamaleonCms::UniqValidatorUser < ActiveModel::Validator
10
2
  def validate(record)
11
3
  record.errors[:base] << "#{I18n.t('camaleon_cms.admin.users.message.requires_different_username')}" if CamaleonCms::User.where(username: record.username).where.not(id: record.id).where("#{CamaleonCms::User.table_name}.site_id" => record.site_id).size > 0
@@ -17,9 +9,9 @@ end
17
9
  class CamaleonCms::User < ActiveRecord::Base
18
10
  include CamaleonCms::Metas
19
11
  include CamaleonCms::CustomFieldsRead
20
- self.table_name = "#{PluginRoutes.static_system_info["db_prefix"]}users"
21
- attr_accessible :username, :role, :email, :parent_id, :last_login_at, :site_id, :password, :password_confirmation, :first_name, :last_name #, :profile_attributes
22
- attr_accessible :is_valid_email
12
+ self.table_name = PluginRoutes.static_system_info["cama_users_db_table"] || "#{PluginRoutes.static_system_info["db_prefix"]}users"
13
+ # attr_accessible :username, :role, :email, :parent_id, :last_login_at, :site_id, :password, :password_confirmation, :first_name, :last_name #, :profile_attributes
14
+ # attr_accessible :is_valid_email
23
15
 
24
16
  default_scope {order("#{CamaleonCms::User.table_name}.role ASC")}
25
17
 
@@ -118,8 +110,6 @@ class CamaleonCms::User < ActiveRecord::Base
118
110
  end
119
111
 
120
112
  def before_saved
121
- self.slug = self.username if self.slug.blank?
122
- self.slug = self.slug.to_s.parameterize
123
113
  self.role = PluginRoutes.system_info["default_user_role"] if self.role.blank?
124
114
  end
125
115
 
@@ -1,14 +1,6 @@
1
- =begin
2
- Camaleon CMS is a content management system
3
- Copyright (C) 2015 by Owen Peredo Diaz
4
- Email: owenperedo@gmail.com
5
- This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
6
- This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
7
- See the GNU Affero General Public License (GPLv3) for more details.
8
- =end
9
1
  class CamaleonCms::UserRelationship < ActiveRecord::Base
10
2
  self.table_name = "#{PluginRoutes.static_system_info["db_prefix"]}user_relationships"
11
- attr_accessible :user_id, :term_taxonomy_id, :term_order, :active
3
+ # attr_accessible :user_id, :term_taxonomy_id, :term_order, :active
12
4
 
13
5
  belongs_to :term_taxonomies, :class_name => "CamaleonCms::TermTaxonomy", foreign_key: :term_taxonomy_id, inverse_of: :user_relationships
14
6
  belongs_to :user, :class_name => "CamaleonCms::User", foreign_key: :user_id, inverse_of: :user_relationships
@@ -1,11 +1,3 @@
1
- =begin
2
- Camaleon CMS is a content management system
3
- Copyright (C) 2015 by Owen Peredo Diaz
4
- Email: owenperedo@gmail.com
5
- This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
6
- This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
7
- See the GNU Affero General Public License (GPLv3) for more details.
8
- =end
9
1
  class CamaleonCms::UserRole < CamaleonCms::TermTaxonomy
10
2
  default_scope { where(taxonomy: :user_roles) }
11
3
  has_many :metas, ->{ where(object_class: 'UserRole')}, :class_name => "CamaleonCms::Meta", foreign_key: :objectid, dependent: :destroy
@@ -1,13 +1,5 @@
1
- =begin
2
- Camaleon CMS is a content management system
3
- Copyright (C) 2015 by Owen Peredo Diaz
4
- Email: owenperedo@gmail.com
5
- This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
6
- This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
7
- See the GNU Affero General Public License (GPLv3) for more details.
8
- =end
9
1
  module CamaleonCms::Widget
10
2
  def self.table_name_prefix
11
3
  'widget_'
12
4
  end
13
- end
5
+ end
@@ -1,11 +1,3 @@
1
- =begin
2
- Camaleon CMS is a content management system
3
- Copyright (C) 2015 by Owen Peredo Diaz
4
- Email: owenperedo@gmail.com
5
- This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
6
- This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
7
- See the GNU Affero General Public License (GPLv3) for more details.
8
- =end
9
1
  class CamaleonCms::Widget::Assigned < CamaleonCms::PostDefault
10
2
  default_scope ->{ where(post_class: self.name).order(:taxonomy_id) }
11
3
  # post_parent: sidebar_id
@@ -16,7 +8,7 @@ class CamaleonCms::Widget::Assigned < CamaleonCms::PostDefault
16
8
  alias_attribute :sidebar_id, :post_parent
17
9
  alias_attribute :item_order, :taxonomy_id
18
10
 
19
- attr_accessible :widget_id, :sidebar_id, :item_order
11
+ # attr_accessible :widget_id, :sidebar_id, :item_order
20
12
 
21
13
  has_many :metas, ->{ where(object_class: 'Widget::Assigned')}, :class_name => "CamaleonCms::Meta", foreign_key: :objectid, dependent: :destroy
22
14
  belongs_to :sidebar, class_name: "CamaleonCms::Widget::Sidebar", foreign_key: :post_parent
@@ -1,14 +1,6 @@
1
- =begin
2
- Camaleon CMS is a content management system
3
- Copyright (C) 2015 by Owen Peredo Diaz
4
- Email: owenperedo@gmail.com
5
- This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
6
- This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
7
- See the GNU Affero General Public License (GPLv3) for more details.
8
- =end
9
1
  class CamaleonCms::Widget::Main < CamaleonCms::TermTaxonomy
10
2
  default_scope { where(taxonomy: :widget) }
11
- attr_accessible :excerpt, :renderer
3
+ # attr_accessible :excerpt, :renderer
12
4
  # name: "title"
13
5
  # description: "content for this"
14
6
  # slug: "key for this"
@@ -1,11 +1,3 @@
1
- =begin
2
- Camaleon CMS is a content management system
3
- Copyright (C) 2015 by Owen Peredo Diaz
4
- Email: owenperedo@gmail.com
5
- This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
6
- This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
7
- See the GNU Affero General Public License (GPLv3) for more details.
8
- =end
9
1
  class CamaleonCms::Widget::Sidebar < CamaleonCms::TermTaxonomy
10
2
  default_scope { where(taxonomy: :sidebar) }
11
3
  has_many :metas, ->{ where(object_class: 'Widget::Sidebar')}, :class_name => "CamaleonCms::Meta", foreign_key: :objectid, dependent: :destroy
@@ -1,16 +1,8 @@
1
- =begin
2
- Camaleon CMS is a content management system
3
- Copyright (C) 2015 by Owen Peredo Diaz
4
- Email: owenperedo@gmail.com
5
- This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
6
- This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
7
- See the GNU Affero General Public License (GPLv3) for more details.
8
- =end
9
1
  module CamaleonCms::CategoriesTagsForPosts extend ActiveSupport::Concern
10
2
  included do
11
3
  # data_tags: (String) tags name separated by commas, sample: "Tag1,Tag two,tag new"
12
4
  # data_categories: (Array) array of category ids assigned for this post, sample: [1,2,3]
13
- attr_accessible :data_tags, :data_categories
5
+ # attr_accessible :data_tags, :data_categories
14
6
  attr_accessor :data_tags, :data_categories
15
7
 
16
8
  after_save :save_extra_data
@@ -1,11 +1,3 @@
1
- =begin
2
- Camaleon CMS is a content management system
3
- Copyright (C) 2015 by Owen Peredo Diaz
4
- Email: owenperedo@gmail.com
5
- This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
6
- This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
7
- See the GNU Affero General Public License (GPLv3) for more details.
8
- =end
9
1
  module CamaleonCms::CustomFieldsRead extend ActiveSupport::Concern
10
2
  included do
11
3
  before_destroy :_destroy_custom_field_groups
@@ -200,7 +192,7 @@ module CamaleonCms::CustomFieldsRead extend ActiveSupport::Concern
200
192
  fields_data.each do |field_key, values|
201
193
  if values[:values].present?
202
194
  order_value = -1
203
- (values[:values].is_a?(Hash) ? values[:values].values : values[:values]).each do |value|
195
+ ((values[:values].is_a?(Hash) || values[:values].is_a?(ActionController::Parameters)) ? values[:values].values : values[:values]).each do |value|
204
196
  item = self.field_values.create!({custom_field_id: values[:id], custom_field_slug: field_key, value: fix_meta_value(value), term_order: order_value += 1, group_number: values[:group_number] || 0})
205
197
  end
206
198
  end
@@ -253,7 +245,7 @@ module CamaleonCms::CustomFieldsRead extend ActiveSupport::Concern
253
245
 
254
246
  private
255
247
  def fix_meta_value(value)
256
- if (value.is_a?(Array) || value.is_a?(Hash))
248
+ if (value.is_a?(Array) || value.is_a?(Hash) || value.is_a?(ActionController::Parameters))
257
249
  value = value.to_json
258
250
  end
259
251
  value