diff --git a/Gather/app/assets/javascripts/topic.coffee b/Gather/app/assets/javascripts/topic.coffee
index e6ab6c9..3604597 100644
--- a/Gather/app/assets/javascripts/topic.coffee
+++ b/Gather/app/assets/javascripts/topic.coffee
@@ -55,7 +55,7 @@ self.topic = {
submit_content = (node)->
b64 = new Base64()
dataa = {
- title: $("#new-topic-title")[0].value,
+ title: emoji.replace_colons(emoji.replace_unified($("#new-topic-title")[0].value)),
content: ali.replace_colons(emoji.replace_colons(emoji.replace_unified($("#new-topic-content")[0].value))),
node: node
}
diff --git a/Gather/app/assets/stylesheets/application.css b/Gather/app/assets/stylesheets/application.css
index 0b53d17..ddf4e96 100755
--- a/Gather/app/assets/stylesheets/application.css
+++ b/Gather/app/assets/stylesheets/application.css
@@ -389,3 +389,9 @@ html {
background: 0;
color: white;
}
+.topic-list-title img, #page-title img {
+ height: 1em;
+}
+.inner-box img {
+ max-width: 90%;
+}
diff --git a/Gather/app/helpers/topic_helper.rb b/Gather/app/helpers/topic_helper.rb
index 552d702..f865de2 100755
--- a/Gather/app/helpers/topic_helper.rb
+++ b/Gather/app/helpers/topic_helper.rb
@@ -41,7 +41,37 @@ def parse_content c
end
@rca << '
' + (@sa.join ' ') + '
'
end
- @rca.join
+
+ Sanitize.fragment(@rca.join, Sanitize::Config.merge(Sanitize::Config::BASIC,
+ :elements => ['img', 'p', 'a'],
+ :remove_contents => false,
+ :attributes => {
+ 'img' => ['alt', 'src', 'title'],
+ 'p' => [],
+ 'a' => ["href"]
+ }
+ ))
+ end
+ def parse_title c
+ @sa = []
+ c.split(" ").each do |x|
+ #Urls and Images
+ @x = x.html_safe
+ @t = x.html_safe
+ if !@t.gsub! /^(http:\/\/|https:\/\/|\/){1}([a-zA-z0-9]|\.|\-|\/|\%|\?|\$)+(\.jpg|\.png|\.svg|\.gif|\.jpeg|\.bmp)$/ , '
'
+ if !@t.gsub! /^(http|https):\/\/([a-zA-z0-9]|\.|\-|\/|\%|\?|\$)+$/, '\0'
+ @t = @x
+ end
+ end
+ @sa << @t
+ end
+ Sanitize.fragment((@sa.join ' '), Sanitize::Config.merge(Sanitize::Config::BASIC,
+ :elements => ['img'],
+ :remove_contents => false,
+ :attributes => {
+ 'img' => ['alt', 'src', 'title']
+ }
+ ))
end
# def simple_helper_method
# ...
diff --git a/Gather/app/views/topic/list.slim b/Gather/app/views/topic/list.slim
index b12ef06..369ff2f 100755
--- a/Gather/app/views/topic/list.slim
+++ b/Gather/app/views/topic/list.slim
@@ -7,7 +7,7 @@ p#page-title Topics
a href=("/user/" + p.user.name)
==avatar p.user.email, 80
.topic-list-info
- p.topic-list-title=link_to p.title, '/topic/view/' + p.id
+ p.topic-list-title==link_to (parse_title p.title).html_safe, '/topic/view/' + p.id
p.topic-list-description
== icon('user') + " " + link_to(p.user.name, "/user/" + p.user.name) + " " + icon('clock-o') + " " + timeago(p.created_at)+ " " + icon('comments-o') + " " + timeago(p.last_replied_at)
p.page-ctrl
diff --git a/Gather/app/views/topic/list_node.slim b/Gather/app/views/topic/list_node.slim
index 55fe2ce..aff70f8 100644
--- a/Gather/app/views/topic/list_node.slim
+++ b/Gather/app/views/topic/list_node.slim
@@ -10,7 +10,7 @@ p#page-title=@n.name
a href=("/user/" + p.user.name)
==avatar p.user.email, 80
.topic-list-info
- p.topic-list-title=link_to p.title, '/topic/view/' + p.id
+ p.topic-list-title==link_to (parse_title p.title).html_safe, '/topic/view/' + p.id
p.topic-list-description
== icon('user') + " " + link_to(p.user.name, "/user/" + p.user.name) + " " + icon('clock-o') + " " + timeago(p.created_at)+ " " + icon('comments-o') + " " + timeago(p.last_replied_at)
p.page-ctrl
diff --git a/Gather/app/views/topic/view.slim b/Gather/app/views/topic/view.slim
index c09f276..46ce06e 100755
--- a/Gather/app/views/topic/view.slim
+++ b/Gather/app/views/topic/view.slim
@@ -1,5 +1,5 @@
-t = @t
-p#page-title=t.title
+p#page-title==parse_title t.title
.container
.inner-box.topic-content data-id=(t.id.to_s)
.topic-avatar.f-right
diff --git a/Gather/app/views/user/view.slim b/Gather/app/views/user/view.slim
index a4cef00..6e38e5e 100755
--- a/Gather/app/views/user/view.slim
+++ b/Gather/app/views/user/view.slim
@@ -10,13 +10,13 @@ p#page-title=@u.name
.view-list
h1=@u.name + "'s Topics"
hr.no-view
- - @u.topics.page(1).each do |t|
+ - @u.topics.desc(:last_replied_at).page(1).each do |t|
.topic-list-item
- .topic-list-count=link_to get_reply_count(t.id),'/topic/view/' + t.id
+ .topic-list-count==link_to get_reply_count(t.id),'/topic/view/' + t.id
.topic-list-avatar
a href=("/user/" + t.user.name)
==avatar t.user.email, 80
.topic-list-info
- p.topic-list-title=link_to t.title, '/topic/view/' + t.id
+ p.topic-list-title=link_to (parse_title t.title).html_safe, '/topic/view/' + t.id
p.topic-list-description
== icon('user') + " " + link_to(t.user.name, "/user/" + t.user.name) + " " + icon('clock-o') + " " + timeago(t.created_at)+ " " + icon('comments-o') + " " + timeago(t.last_replied_at)
diff --git a/Gather/models/user.rb b/Gather/models/user.rb
index 6e48e22..d83d13d 100755
--- a/Gather/models/user.rb
+++ b/Gather/models/user.rb
@@ -17,7 +17,9 @@ class User
validates_presence_of :name, :email, :salt, :hashed_password
validates_uniqueness_of :name, :email
-
+ validates_format_of :name, :with => /([a-zA-z0-9]|\.|-|_)+/
+ validates_format_of :email, :with => /([a-zA-z0-9]|\.|-|_)+\@([a-zA-z0-9]|\.|-|_)+\.([a-zA-z0-9]|\.|-|_)+/
+
def self.get(hash)
user = self.where(hash)
if user.exists?