Skip to content

Commit c30c50f

Browse files
committed
模板必须使用双引号
1 parent de7a56e commit c30c50f

20 files changed

+110
-117
lines changed

models/user.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
var mongoose = require('mongoose');
22
var Schema = mongoose.Schema;
33
var config = require('../config');
4-
var sanitize = require('validator').sanitize;
54

65
var UserSchema = new Schema({
76
name: { type: String, index: true },
@@ -42,7 +41,6 @@ UserSchema.virtual('avatar_url').get(function () {
4241
if (!avatar_url) {
4342
avatar_url = config.site_static_host + '/images/user_icon&48.png';
4443
}
45-
avatar_url = sanitize(avatar_url).xss();
4644
return avatar_url;
4745
});
4846

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"private": true,
66
"dependencies": {
77
"express": "2.5.1",
8-
"ejs": "0.5.0",
8+
"ejs": ">=0.8.0",
99
"eventproxy": ">=0.1.0",
1010
"mongoose": "2.4.1",
1111
"node-markdown": "0.1.0",

views/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<div class='panel'>
55
<div class='moon'>
66
<% if (locals.current_user && current_user.is_admin) { %>
7-
<span class='fr'><a href='/tags/edit'><img src='<%- config.site_static_host %>/images/wrench_icon&16.png' title='编辑标签' /></a></span>
7+
<span class='fr'><a href='/tags/edit'><img src="<%- config.site_static_host %>/images/wrench_icon&16.png" title='编辑标签' /></a></span>
88
<% } %>
99
</div>
1010
<div class='moon_tags'>
@@ -15,7 +15,7 @@
1515
<% } %>
1616
</div>
1717
<div class='header'>
18-
<img src='<%- config.site_static_host %>/images/spechbubble_2_icon&16.png' title='话题'/>
18+
<img src="<%- config.site_static_host %>/images/spechbubble_2_icon&16.png" title='话题'/>
1919

2020
<% if (locals.current_user) { %>
2121
<a href='/topic/create' class='fr'><button class='btn btn-success fr' id='create_topic_btn'>发布话题</button></a>

views/message/message.html

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,44 +5,44 @@
55
<% } %>
66
<% if(message.type == 'reply'){ %>
77
<span>
8-
<a href='/user/<%= message.author.name %>' target='_blank'><%= message.author.name %></a>
8+
<a href="/user/<%= message.author.name %>" target='_blank'><%= message.author.name %></a>
99
回复了你的话题
1010
<div class='title_wrap'>
11-
<a href='/topic/<%= message.topic._id %>' target='_blank'><%= message.topic.title %></a>
11+
<a href="/topic/<%= message.topic._id %>" target='_blank'><%= message.topic.title %></a>
1212
</div>
1313
</span>
1414
<% } %>
1515
<% if(message.type == 'reply2'){ %>
1616
<span>
17-
<a href='/user/<%= message.author.name %>' target='_blank'><%= message.author.name %></a>
17+
<a href="/user/<%= message.author.name %>" target='_blank'><%= message.author.name %></a>
1818
在话题
1919
<div class='title_wrap'>
20-
<a href='/topic/<%= message.topic._id %>' target='_blank'><%= message.topic.title %></a>
20+
<a href="/topic/<%= message.topic._id %>" target='_blank'><%= message.topic.title %></a>
2121
</div>
2222
中回复了你的回复
2323
</span>
2424
<% } %>
2525
<% if(message.type == 'follow'){ %>
2626
<span>
27-
<a href='/user/<%= message.author.name %>' target='_blank'><%= message.author.name %></a>
27+
<a href="/user/<%= message.author.name %>" target='_blank'><%= message.author.name %></a>
2828
关注了你
2929
</span>
3030
<% } %>
31-
<% if(message.type == 'at'){ %>
31+
<% if (message.type == 'at'){ %>
3232
<span>
33-
<a href='/user/<%= message.author.name %>' target='_blank'><%= message.author.name %></a>
33+
<a href="/user/<%= message.author.name %>" target='_blank'><%= message.author.name %></a>
3434
在话题
3535
<div class='title_wrap'>
36-
<a href='/topic/<%= message.topic._id %>' target='_blank'><%= message.topic.title %></a>
36+
<a href="/topic/<%= message.topic._id %>" target='_blank'><%= message.topic.title %></a>
3737
</div>
3838
中@了你
3939
</span>
4040
<% } %>
4141

4242

43-
<% if(message.has_read){ %>
43+
<% if (message.has_read) { %>
4444
<span class='fr'><img src='<%- config.site_static_host %>/images/checkmark_icon&16.png' title='消息已读'/></span>
45-
<% }else{ %>
45+
<% } else { %>
4646
<span class='fr marked_icon' style='display:none'><img src='<%- config.site_static_host %>/images/checkmark_icon&16.png' title='消息已读'/></span>
4747
<a class='fr mark_read_btn' href='javascript:void(0)' style='display:none;'><img src='<%- config.site_static_host %>/images/checkmark_icon&16.png' title='标记为已读'/></a>
4848
<% } %>

views/reply/reply.html

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
<div class='cell reply_area reply_item' id='reply<%= indexInCollection+1 %>' reply_id='<%= reply._id %>'>
1+
<div class='cell reply_area reply_item' id="reply<%= indexInCollection+1 %>" reply_id="<%= reply._id %>">
22
<div class='user_avatar'>
3-
<a href='/user/<%= reply.author.name %>'><img src='<%= reply.author.avatar_url %>' title='<%= reply.author.name %>' /></a>
3+
<a href="/user/<%= reply.author.name %>"><img src="<%= reply.author.avatar_url %>" title="<%= reply.author.name %>" /></a>
44
</div>
55
<span class='col_fade fr'>#<%= indexInCollection + 1 %></span>
66

@@ -12,12 +12,12 @@
1212
<span class='col_fade'>{<%= reply.replies.length %>}</span>
1313
<% } %>
1414
</span>
15-
<span class='reply_author'><a class='dark' href='/user/<%= reply.author.name %>'><%= reply.author.name %></a></span>
15+
<span class='reply_author'><a class='dark' href="/user/<%= reply.author.name %>"><%= reply.author.name %></a></span>
1616
<span class='col_fade'>
1717
<%= reply.friendly_create_at %>回复
18-
<% if(locals.current_user && current_user._id.toString() == reply.author._id.toString()){ %>
18+
<% if(locals.current_user && current_user._id.toString() == reply.author._id.toString()) { %>
1919
<span class='sp10'></span>
20-
<a href='javascript:void(0);' class='delete_reply_btn'><img class='user_icon' src='<%- config.site_static_host %>/images/trash_icon&16.png' title='删除' /></a>
20+
<a href='javascript:void(0);' class='delete_reply_btn'><img class='user_icon' src="<%- config.site_static_host %>/images/trash_icon&16.png" title='删除' /></a>
2121
<% } %>
2222
</span>
2323
<!-- <div class='sep5'></div> -->
@@ -27,11 +27,11 @@
2727
<div class='cl'>
2828
<!-- <div class='sep5'></div> -->
2929
<div class='reply2_area'>
30-
<% if(reply.replies.length >0 ){ %>
30+
<% if (reply.replies.length >0) { %>
3131
<div class='sep10'></div>
32-
<%- partial('reply/reply2',{collection:reply.replies,as:'reply'}) %>
32+
<%- partial('reply/reply2',{collection: reply.replies, as: 'reply'}) %>
3333
<% } %>
34-
<% if(locals.current_user){ %>
34+
<% if (locals.current_user) { %>
3535
<div class='reply2_editor tabbable' id='reply2_editor-<%= indexInCollection+1 %>'>
3636
<div class='sep10'></div>
3737
<ul class='nav nav-pills'>

views/reply/reply2.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
<div class='cell reply2_item' reply_id='<%= reply._id %>'>
22
<div class='user_avatar'>
3-
<a href='/user/<%= reply.author.name %>'><img src='<%= reply.author.avatar_url %>' title='<%= reply.author.name %>' /></a>
3+
<a href="/user/<%= reply.author.name %>"><img src="<%= reply.author.avatar_url %>" title="<%= reply.author.name %>" /></a>
44
</div>
5-
<span class='reply_author'><a class='dark' href='/user/<%= reply.author.name %>'><%= reply.author.name %></a></span>
5+
<span class='reply_author'><a class='dark' href="/user/<%= reply.author.name %>"><%= reply.author.name %></a></span>
66
<span class='fr'>
7-
<% if(locals.current_user){ %>
7+
<% if (locals.current_user) { %>
88
<a href='javascript:void(0);' class='dark reply2_at_btn'>@回复</a>
99
<% } %>
1010
</span>
1111
<span class='col_fade'>
1212
<%= reply.friendly_create_at %>回复
13-
<% if(locals.current_user && current_user._id.toString() == reply.author._id.toString()){ %>
13+
<% if (locals.current_user && current_user._id.toString() == reply.author._id.toString()) { %>
1414
<span class='sp10'></span>
15-
<a href='javascript:void(0)' class='delete_reply2_btn'><img class='user_icon' src='<%- config.site_static_host %>/images/trash_icon&16.png' title='删除' /></a>
15+
<a href='javascript:void(0)' class='delete_reply2_btn'><img class='user_icon' src="<%- config.site_static_host %>/images/trash_icon&16.png" title='删除' /></a>
1616
<% } %>
1717
</span>
1818
<!-- <div class='sep5'></div> -->

views/sidebar.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,8 @@
147147
</div>
148148
<% config.side_ads.forEach(function (ad) { %>
149149
<div class='inner'>
150-
<a href='<%- ad.url %>' title='<%= ad.text %>' target='_blank'>
151-
<img src='<%- ad.image %>' />
150+
<a href="<%- ad.url %>" title="<%= ad.text %>" target='_blank'>
151+
<img src="<%- ad.image %>" />
152152
</a>
153153
</div>
154154
<% }); %>

views/topic/abstract.html

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
<div class='cell'>
22
<div class='user_avatar'>
3-
<a href='/user/<%= topic.author.name %>'>
4-
<img src='<%= topic.author.avatar_url %>' title='<%= topic.author.name %>' />
3+
<a href="/user/<%= topic.author.name %>">
4+
<img src="<%= topic.author.avatar_url %>" title="<%= topic.author.name %>" />
55
</a>
66
</div>
77

88
<div class='topic_wrap'>
99
<div class='title_wrap'>
10-
<a class='topic_title' href='/topic/<%= topic._id %>'><% if(topic.top){%>[置顶]<% } %><%= topic.title %></a>
10+
<a class='topic_title' href="/topic/<%= topic._id %>"><% if (topic.top) {%>[置顶]<% } %><%= topic.title %></a>
1111
</div>
12-
<% if(topic.reply_count >0){ %>
13-
<a class='count fr' href='/topic/<%= topic._id %>#reply<%= topic.reply_count %>'><%= topic.reply_count %></a>
12+
<% if (topic.reply_count > 0) { %>
13+
<a class='count fr' href="/topic/<%= topic._id %>#reply<%= topic.reply_count %>"><%= topic.reply_count %></a>
1414
<% } %>
1515
<div class='sep10'></div>
1616
<div class='sep5'></div>
@@ -23,12 +23,12 @@
2323
</div>
2424
<% if(topic.reply){ %>
2525
<div class='reply_part'>
26-
<a class='dark' href='/user/<%= topic.reply.author.name %>'><%= topic.reply.author.name %> </a>
26+
<a class='dark' href="/user/<%= topic.reply.author.name %>"><%= topic.reply.author.name %> </a>
2727
回复于
2828
<%= topic.reply.friendly_create_at %>
2929
</div>
3030
<% }else{ %>
31-
<a class='dark' href='/user/<%= topic.author.name %>'><%= topic.author.name %> </a>
31+
<a class='dark' href="/user/<%= topic.author.name %>"><%= topic.author.name %> </a>
3232
<div class='reply_part'>
3333
创建于 <%= topic.friendly_create_at %>
3434
</div>

views/topic/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,12 @@ <h3><% if(topic.top){%>[置顶]<% } %><%= topic.title %></h3>
6262
<% } %>
6363
<div class='sep5'></div>
6464
<span class='col_fade'>
65-
<a class='dark' href='/user/<%= topic.author.name %>'><%= topic.author.name %></a><%= topic.friendly_create_at %>发布
65+
<a class='dark' href="/user/<%= topic.author.name %>"><%= topic.author.name %></a><%= topic.friendly_create_at %>发布
6666
</span>
6767
<% if (topic.friendly_create_at != topic.friendly_update_at) { %>
6868
<div class='sep5'></div>
6969
<span class='col_fade'>
70-
<a class='dark' href='/user/<%= topic.author.name %>'><%= topic.author.name %></a><%= topic.friendly_update_at %>重新编辑
70+
<a class='dark' href="/user/<%= topic.author.name %>"><%= topic.author.name %></a><%= topic.friendly_update_at %>重新编辑
7171
</span>
7272
<% } %>
7373
<span class='sp10'></span>

views/topic/list.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<% if (current_page == 1) { %>
66
<li class='disabled'><a>«</a></li>
77
<% } else { %>
8-
<li><a href='<%= base_url %>1'>«</a></li>
8+
<li><a href="<%= base_url %>1">«</a></li>
99
<% } %>
1010

1111
<%
@@ -36,8 +36,8 @@
3636
<% } %>
3737
</ul>
3838
</div>
39-
<script type='text/javascript'>
40-
$(document).ready(function(){
39+
<script>
40+
$(document).ready(function () {
4141
var $nav = $('.pagination');
4242
var current_page = $nav.attr('current_page');
4343
if (current_page) {

0 commit comments

Comments
 (0)