From d259706a19d78e251dc12fac6e612646469f4305 Mon Sep 17 00:00:00 2001
From: huang
Date: Fri, 9 Jun 2017 22:08:10 +0800
Subject: [PATCH 1/6] =?UTF-8?q?=E6=88=91=E5=8F=82=E5=85=A5=E7=9A=84?=
=?UTF-8?q?=E5=AE=9E=E8=AE=AD=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/users_controller.rb | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index 33487ddde..5bb03ce39 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -665,14 +665,13 @@ class UsersController < ApplicationController
@shixuns = paginateHelper @shixuns, @limit
# 我参入的
- id = []
ids = Shixun.find_by_sql("select id from shixun_members where role=2 and user_id=#{@user.id}")
ids2 = Shixun.find_by_sql("select id from shixuns where id in (select shixun_id from myshixuns where user_id = #{@user.id})")
ids = ids.map{|shixun| shixun.id} unless ids.blank?
ids2 = ids2.map{|shixun| shixun.id} unless ids2.blank?
id = ids + ids2
id = id.uniq
- @join_shixuns = Shixun.where(:shixun_id => id)
+ @join_shixuns = Shixun.where(:id => id)
# @join_shixuns_count = @join_shixuns.count
# @join_shixuns_pages = Paginator.new @join_shixuns_count, @limit, params['page'] || 1
# @join_shixuns_offset ||= @join_shixuns_pages.offset
From 6e9b478f74c61365cf29b11987097a6332061f96 Mon Sep 17 00:00:00 2001
From: huang
Date: Fri, 9 Jun 2017 22:23:47 +0800
Subject: [PATCH 2/6] =?UTF-8?q?=E5=90=88=E4=BD=9C=E8=80=85=E8=83=BD?=
=?UTF-8?q?=E5=8F=91=E5=B8=83=E5=AE=9E=E8=AE=AD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/shixuns/_shixun_top.html.erb | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/views/shixuns/_shixun_top.html.erb b/app/views/shixuns/_shixun_top.html.erb
index f0cbde564..01f23f459 100644
--- a/app/views/shixuns/_shixun_top.html.erb
+++ b/app/views/shixuns/_shixun_top.html.erb
@@ -6,8 +6,8 @@
/
<% if allow_shixun_exec(@shixun) %>
- <% if @shixun %>
- <% if User.current.manager_of_shixun?(@shixun) %>
+ <% if User.current.manager_of_shixun?(@shixun) %>
+ <% if @shixun.status == 1 %>
<%= link_to "重新发布", publish_shixun_path(@shixun, :type => "retry"), :class => "fr shixun-task-btn task-btn-orange mr15", :id => "challenge_begin", :remote => true %>
<% else %>
<%= link_to "发布实训", publish_shixun_path(@shixun), :class => "fr shixun-task-btn task-btn-orange mr15", :id => "challenge_begin", :remote => true %>
From 67d4430bed7ab7854c59c7ab3f8d9da60a655efe Mon Sep 17 00:00:00 2001
From: huang
Date: Sat, 10 Jun 2017 10:01:32 +0800
Subject: [PATCH 3/6] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=89=8D=E7=AB=AF?=
=?UTF-8?q?=E6=97=A0=E5=8F=8D=E5=BA=94?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.idea/dataSources.xml | 12 ++++++------
app/controllers/application_controller.rb | 2 +-
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/.idea/dataSources.xml b/.idea/dataSources.xml
index e9ec192f0..934f79cf7 100644
--- a/.idea/dataSources.xml
+++ b/.idea/dataSources.xml
@@ -28,25 +28,25 @@
mysql
com.mysql.jdbc.Driver
- jdbc:mysql://127.0.0.1/trustie2
+ jdbc:mysql://127.0.0.1/0604new
root
- df9bdf98df99df9edf9fdf9c
+ df9bdf98df99df9e
mysql
com.mysql.jdbc.Driver
- jdbc:mysql://127.0.0.1/trustie2
+ jdbc:mysql://127.0.0.1/20161227data
root
- df9bdf98df99df9edf9fdf9c
+ df9bdf98df99df9e
mysql
com.mysql.jdbc.Driver
- jdbc:mysql://127.0.0.1/trustie2
+ jdbc:mysql://127.0.0.1/0623newblank
root
- df9bdf98df99df9edf9fdf9c
+ df9bdf98df99df9e
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 468f3f8f4..ab9eac745 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -63,7 +63,7 @@ class ApplicationController < ActionController::Base
# 判断用户是否认证
def check_authentication
# return true
- if params[:action] == "on_search" || params[:action] == "apply_trail" # 之所以这样处理是为了避开account页面ajax加载
+ if params[:action] == "on_search" || params[:action] == "apply_trail" || params[:action] == "training_task_status" # 之所以这样处理是为了避开account页面ajax加载
return true
end
authentication = ApplyAction.where(:user_id => User.current.id, :status => 1).first
From 8f40d7022abea944543a8bc512aa847dc4cebc0a Mon Sep 17 00:00:00 2001
From: huang
Date: Sun, 11 Jun 2017 15:45:54 +0800
Subject: [PATCH 4/6] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=99=BB=E5=BD=95?=
=?UTF-8?q?=E7=AD=89=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/application_controller.rb | 28 +++++++++++------------
app/controllers/courses_controller.rb | 1 +
app/controllers/forums_controller.rb | 3 ++-
app/controllers/myshixuns_controller.rb | 1 +
app/controllers/shixuns_controller.rb | 1 +
app/controllers/syllabuses_controller.rb | 1 +
app/helpers/application_helper.rb | 15 ++++++++++++
7 files changed, 35 insertions(+), 15 deletions(-)
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index ab9eac745..e0cbc2524 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -45,8 +45,8 @@ class ApplicationController < ActionController::Base
before_filter :find_first_page
before_filter :find_web_footer
- before_filter :session_expiration, :user_setup, :check_if_login_required, :set_localization, :check_authentication
- before_filter :user_agent
+ before_filter :session_expiration, :user_setup, :check_if_login_required, :set_localization
+ before_filter :user_agent
rescue_from ActionController::InvalidAuthenticityToken, :with => :invalid_authenticity_token
rescue_from ::Unauthorized, :with => :deny_access
@@ -61,18 +61,18 @@ class ApplicationController < ActionController::Base
end
# 判断用户是否认证
- def check_authentication
- # return true
- if params[:action] == "on_search" || params[:action] == "apply_trail" || params[:action] == "training_task_status" # 之所以这样处理是为了避开account页面ajax加载
- return true
- end
- authentication = ApplyAction.where(:user_id => User.current.id, :status => 1).first
- user_identity = User.current.try(:user_extensions).try(:identity)
- if user_identity.blank? || authentication.blank?
- redirect_to my_account_path
- return
- end
- end
+ # def check_authentication
+ # # return true
+ # if params[:action] == "on_search" || params[:action] == "apply_trail" # 之所以这样处理是为了避开account页面ajax加载
+ # return true
+ # end
+ # authentication = ApplyAction.where(:user_id => User.current.id, :status => 1).first
+ # user_identity = User.current.try(:user_extensions).try(:identity)
+ # if user_identity.blank? || authentication.blank?
+ # redirect_to my_account_path
+ # return
+ # end
+ # end
def session_expiration
if session[:user_id]
diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb
index d01774024..222138049 100644
--- a/app/controllers/courses_controller.rb
+++ b/app/controllers/courses_controller.rb
@@ -14,6 +14,7 @@ class CoursesController < ApplicationController
before_filter :auth_login1, :only => [:show, :course_activity, :feedback]
skip_before_filter :verify_authenticity_token, :only => [:update_position]
+ before_filter :check_authentication, :except => [:update_position]
menu_item :overview
menu_item :feedback, :only => :feedback
menu_item :homework, :only => :homework
diff --git a/app/controllers/forums_controller.rb b/app/controllers/forums_controller.rb
index 24223c25d..bc26d5bb6 100644
--- a/app/controllers/forums_controller.rb
+++ b/app/controllers/forums_controller.rb
@@ -8,7 +8,8 @@ class ForumsController < ApplicationController
before_filter :authenticate_user_edit, :only => [:edit, :update]
before_filter :authenticate_user_destroy, :only => [:destroy]
before_filter :require_login, :only => [:new, :create,:destroy,:update,:edit]
-
+ before_filter :check_authentication
+
helper :sort
include SortHelper
diff --git a/app/controllers/myshixuns_controller.rb b/app/controllers/myshixuns_controller.rb
index d76494716..42d0416c1 100644
--- a/app/controllers/myshixuns_controller.rb
+++ b/app/controllers/myshixuns_controller.rb
@@ -3,6 +3,7 @@ class MyshixunsController < ApplicationController
layout 'base_myshixun'
skip_before_filter :verify_authenticity_token, :only => [:training_task_status]
before_filter :require_login, :except => [:training_task_status]
+ before_filter :check_authentication, :except => [:training_task_status]
before_filter :find_myshixun, :only => [:show, :myshixun_reset]
include ApplicationHelper
diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb
index 505e73699..8fc561502 100644
--- a/app/controllers/shixuns_controller.rb
+++ b/app/controllers/shixuns_controller.rb
@@ -3,6 +3,7 @@
class ShixunsController < ApplicationController
layout 'base_shixun'
before_filter :require_login
+ before_filter :check_authentication
before_filter :find_shixun, :except => [ :index, :new, :create, :index, :search ]
before_filter :shixun_view_allow, :only => [:show]
before_filter :require_manager, :only => [ :settings, :add_script, :publish, :collaborators_delete, :shixun_members_added, :add_collaborators]
diff --git a/app/controllers/syllabuses_controller.rb b/app/controllers/syllabuses_controller.rb
index 7451a893c..23ad61f92 100644
--- a/app/controllers/syllabuses_controller.rb
+++ b/app/controllers/syllabuses_controller.rb
@@ -7,6 +7,7 @@ class SyllabusesController < ApplicationController
include SyllabusesHelper
include UsersHelper
before_filter :is_logged, :only => [:index, :show, :edit, :new, :update, :destroy, :delete_syllabus, :syllabus_resources, :syllabus_homeworks]
+ before_filter :check_authentication
before_filter :find_syllabus, :only => [:show, :edit, :update, :destroy, :syllabus_courselist, :edit_syllabus_eng_name, :edit_syllabus_title, :update_base_info, :delete_syllabus,
:delete_des, :members, :update_des, :edit_ref, :update_ref, :add_sy_member_alert, :search_not_sy_member, :syllabus_resources, :syllabus_homeworks,
:send_homeworks_to_course, :choose_user_course, :send_resources_to_course, :send_r_and_h_to_course]
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 02ed45619..e270da1a3 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -33,6 +33,21 @@ module ApplicationHelper
extend Forwardable
def_delegators :wiki_helper, :wikitoolbar_for, :heads_for_wiki_formatter
+ # 判断用户是否认证
+ def check_authentication
+ # return true
+ if params[:action] == "on_search" || params[:action] == "apply_trail" # 之所以这样处理是为了避开account页面ajax加载
+ return true
+ end
+ authentication = ApplyAction.where(:user_id => User.current.id, :status => 1).first
+ user_identity = User.current.try(:user_extensions).try(:identity)
+ if user_identity.blank? || authentication.blank?
+ redirect_to my_account_path
+ return
+ end
+ end
+
+
# 积分表中建立记录行为,有过奖励则不重复奖励
def reward_grade(user, container_id, container_type, score)
grade = Grade.where(:user_id => user.id, :container_id => container_id, :container_type => container_type).first
From f0823e7eb709024c3603a3972aa20d930f68e87e Mon Sep 17 00:00:00 2001
From: huang
Date: Sun, 11 Jun 2017 15:53:04 +0800
Subject: [PATCH 5/6] =?UTF-8?q?=E5=AE=9E=E5=90=8D=E8=AE=A4=E8=AF=81?=
=?UTF-8?q?=E6=96=B9=E5=BC=8F=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/forums_controller.rb | 2 +-
app/controllers/users_controller.rb | 2 ++
app/helpers/application_helper.rb | 6 +++---
3 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/app/controllers/forums_controller.rb b/app/controllers/forums_controller.rb
index bc26d5bb6..ed646354c 100644
--- a/app/controllers/forums_controller.rb
+++ b/app/controllers/forums_controller.rb
@@ -9,7 +9,7 @@ class ForumsController < ApplicationController
before_filter :authenticate_user_destroy, :only => [:destroy]
before_filter :require_login, :only => [:new, :create,:destroy,:update,:edit]
before_filter :check_authentication
-
+
helper :sort
include SortHelper
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index 5bb03ce39..a62b5f620 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -35,6 +35,8 @@ class UsersController < ApplicationController
#
before_filter :can_show_course, :only => [:user_courses,:user_homeworks]
+ before_filter :check_authentication
+
before_filter :find_user, :only => [:user_fanslist, :user_watchlist, :show, :edit, :update, :destroy, :edit_membership, :user_courses, :unsolved_issues_list, :unfinished_homework_list, :user_manage_homeworks,
:unfinished_poll_list, :user_homeworks,:student_homeworks, :destroy_membership, :user_activities, :user_projects, :user_newfeedback, :user_comments, :update_message_viewed,
:anonymous_evaluation_list,:unfinished_test_list, :watch_contests, :info, :watch_projects, :show_score, :topic_score_index, :project_score_index, :user_receive_homeworks,
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index e270da1a3..4b1f10bb9 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -36,9 +36,9 @@ module ApplicationHelper
# 判断用户是否认证
def check_authentication
# return true
- if params[:action] == "on_search" || params[:action] == "apply_trail" # 之所以这样处理是为了避开account页面ajax加载
- return true
- end
+ # if params[:action] == "on_search" || params[:action] == "apply_trail" # 之所以这样处理是为了避开account页面ajax加载
+ # return true
+ # end
authentication = ApplyAction.where(:user_id => User.current.id, :status => 1).first
user_identity = User.current.try(:user_extensions).try(:identity)
if user_identity.blank? || authentication.blank?
From e63508a3374d4cc1ae27e00a218495b2b062b215 Mon Sep 17 00:00:00 2001
From: huang
Date: Sun, 11 Jun 2017 16:00:12 +0800
Subject: [PATCH 6/6] =?UTF-8?q?=E5=BC=B9=E6=A1=86=E6=A0=B7=E5=BC=8F?=
=?UTF-8?q?=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/users_controller.rb | 2 +-
app/views/welcome/_one_btn_mask_pop.html.erb | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index a62b5f620..d7e4af7ab 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -36,7 +36,7 @@ class UsersController < ApplicationController
#
before_filter :can_show_course, :only => [:user_courses,:user_homeworks]
before_filter :check_authentication
-
+
before_filter :find_user, :only => [:user_fanslist, :user_watchlist, :show, :edit, :update, :destroy, :edit_membership, :user_courses, :unsolved_issues_list, :unfinished_homework_list, :user_manage_homeworks,
:unfinished_poll_list, :user_homeworks,:student_homeworks, :destroy_membership, :user_activities, :user_projects, :user_newfeedback, :user_comments, :update_message_viewed,
:anonymous_evaluation_list,:unfinished_test_list, :watch_contests, :info, :watch_projects, :show_score, :topic_score_index, :project_score_index, :user_receive_homeworks,
diff --git a/app/views/welcome/_one_btn_mask_pop.html.erb b/app/views/welcome/_one_btn_mask_pop.html.erb
index 7532e416f..af9ccf6a6 100644
--- a/app/views/welcome/_one_btn_mask_pop.html.erb
+++ b/app/views/welcome/_one_btn_mask_pop.html.erb
@@ -21,7 +21,7 @@
<%#= tip2 %>
-->