Skip to content

Commit 74dddf9

Browse files
committed
Merge branch '1.10.x' of github.com:chamilo/chamilo-lms into 1.10.x
2 parents 4d51294 + 864f125 commit 74dddf9

File tree

12 files changed

+499
-109
lines changed

12 files changed

+499
-109
lines changed

main/auth/set_temp_password.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838

3939
if ($form->validate()) {
4040
$form_values = $form->exportValues();
41-
if ($form_values['course_password'] === $course_info['registration_code']) {
41+
if (sha1($form_values['course_password']) === $course_info['registration_code']) {
4242
Session::write('course_password_'.$course_info['real_id'], true);
4343
header('Location: '.api_get_course_url($course_info['code'], $session_id));
4444
exit;

main/course_info/infocours.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ function is_settings_editable()
195195
. '<img id="previewImage" >'
196196
. '</div>'
197197
. '<div>'
198-
. '<button class="btn btn-primary hidden" name="cropButton" id="cropButton"><em class="fa fa-crop"></em> '.get_lang('CropYourPicture').'</button>'
198+
. '<button class="btn btn-primary hidden" type="button" name="cropButton" id="cropButton"><em class="fa fa-crop"></em> '.get_lang('CropYourPicture').'</button>'
199199
. '</div>'
200200
. '</div>'
201201
. '</div>'

main/forum/editpost.php

Lines changed: 4 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,14 @@
3232

3333
$nameTools = get_lang('ToolForum');
3434

35+
// Unset the formElements in session before the includes function works
36+
unset($_SESSION['formelements']);
37+
3538
/* Including necessary files */
3639
require_once 'forumconfig.inc.php';
3740
require_once 'forumfunction.inc.php';
3841

42+
// Are we in a lp ?
3943
$origin = '';
4044
if (isset($_GET['origin'])) {
4145
$origin = Security::remove_XSS($_GET['origin']);
@@ -111,12 +115,6 @@
111115
</script>
112116
JS;
113117

114-
// Are we in a lp ?
115-
$origin = '';
116-
if (isset($_GET['origin'])) {
117-
$origin = Security::remove_XSS($_GET['origin']);
118-
}
119-
120118
if ($origin == 'learnpath') {
121119
Display::display_reduced_header();
122120
} else {
@@ -215,41 +213,6 @@
215213

216214
if (!empty($values) and isset($_POST['SubmitPost'])) {
217215
store_edit_post($values);
218-
219-
$option_chek = isset($values['thread_qualify_gradebook']) ? $values['thread_qualify_gradebook'] : null; // values 1 or 0
220-
if (1 == $option_chek) {
221-
$id = $values['thread_id'];
222-
$title_gradebook = Security::remove_XSS(stripslashes($values['calification_notebook_title']));
223-
$value_calification = $values['numeric_calification'];
224-
$weight_calification = $values['weight_calification'];
225-
$description = '';
226-
$session_id = api_get_session_id();
227-
228-
$link_info = GradebookUtils::is_resource_in_course_gradebook(
229-
api_get_course_id(),
230-
5,
231-
$id,
232-
$session_id
233-
);
234-
$link_id = $link_info['id'];
235-
236-
if (!$link_info) {
237-
GradebookUtils::add_resource_to_course_gradebook(
238-
$values['category_id'],
239-
api_get_course_id(),
240-
5,
241-
$id,
242-
$title_gradebook,
243-
$weight_calification,
244-
$value_calification,
245-
$description,
246-
1,
247-
api_get_session_id()
248-
);
249-
} else {
250-
Database::query('UPDATE '.$table_link.' SET weight='.$weight_calification.' WHERE id='.$link_id.'');
251-
}
252-
}
253216
}
254217

255218
// Footer

main/forum/editthread.php

Lines changed: 185 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,185 @@
1+
<?php
2+
/* For licensing terms, see /license.txt */
3+
4+
/**
5+
* Edit a Forum Thread
6+
* @Author José Loguercio <[email protected]>
7+
*
8+
* @package chamilo.forum
9+
*/
10+
11+
use ChamiloSession as Session;
12+
13+
// Including the global initialization file.
14+
require_once '../inc/global.inc.php';
15+
16+
// The section (tabs).
17+
$this_section = SECTION_COURSES;
18+
// Notification for unauthorized people.
19+
api_protect_course_script(true);
20+
21+
$cidreq = api_get_cidreq();
22+
23+
$nameTools = get_lang('ToolForum');
24+
25+
/* Including necessary files */
26+
27+
require_once 'forumconfig.inc.php';
28+
require_once 'forumfunction.inc.php';
29+
30+
// Are we in a lp ?
31+
$origin = '';
32+
if (isset($_GET['origin'])) {
33+
$origin = Security::remove_XSS($_GET['origin']);
34+
}
35+
36+
/* MAIN DISPLAY SECTION */
37+
$currentForum = get_forum_information($_GET['forum']);
38+
$currentForumCategory = get_forumcategory_information($currentForum['forum_category']);
39+
40+
// the variable $forum_settings is declared in forumconfig.inc.php
41+
$forumSettings = $forum_setting;
42+
43+
/* Breadcrumbs */
44+
45+
if (isset($_SESSION['gradebook'])) {
46+
$gradebook = Security::remove_XSS($_SESSION['gradebook']);
47+
}
48+
49+
if (!empty($gradebook) && $gradebook == 'view') {
50+
$interbreadcrumb[] = array (
51+
'url' => '../gradebook/'.Security::remove_XSS($_SESSION['gradebook_dest']),
52+
'name' => get_lang('ToolGradebook')
53+
);
54+
}
55+
56+
if (!empty($_GET['gidReq'])) {
57+
$toolgroup = intval($_GET['gidReq']);
58+
Session::write('toolgroup',$toolgroup);
59+
}
60+
61+
$threadId = isset($_GET['thread']) ? intval($_GET['thread']) : 0;
62+
$courseInfo = isset($_GET['cidReq']) ? api_get_course_info($_GET['cidReq']) : 0;
63+
$cId = isset($courseInfo['real_id']) ? intval($courseInfo['real_id']) : 0;
64+
65+
/* Is the user allowed here? */
66+
67+
// The user is not allowed here if:
68+
69+
// 1. the forumcategory or forum is invisible (visibility==0) and the user is not a course manager
70+
if (!api_is_allowed_to_edit(false, true) &&
71+
(($currentForumCategory['visibility'] && $currentForumCategory['visibility'] == 0) || $currentForum['visibility'] == 0)
72+
) {
73+
api_not_allowed();
74+
}
75+
76+
// 2. the forumcategory or forum is locked (locked <>0) and the user is not a course manager
77+
if (!api_is_allowed_to_edit(false, true) &&
78+
(($currentForumCategory['visibility'] && $currentForumCategory['locked'] <> 0) OR $currentForum['locked'] <> 0)
79+
) {
80+
api_not_allowed();
81+
}
82+
83+
// 3. new threads are not allowed and the user is not a course manager
84+
if (!api_is_allowed_to_edit(false, true) &&
85+
$currentForum['allow_new_threads'] <> 1
86+
) {
87+
api_not_allowed();
88+
}
89+
// 4. anonymous posts are not allowed and the user is not logged in
90+
if (!$_user['user_id'] AND $currentForum['allow_anonymous'] <> 1) {
91+
api_not_allowed();
92+
}
93+
94+
// 5. Check user access
95+
if ($currentForum['forum_of_group'] != 0) {
96+
$show_forum = GroupManager::user_has_access(
97+
api_get_user_id(),
98+
$currentForum['forum_of_group'],
99+
GroupManager::GROUP_TOOL_FORUM
100+
);
101+
if (!$show_forum) {
102+
api_not_allowed();
103+
}
104+
}
105+
106+
// 6. Invited users can't create new threads
107+
if (api_is_invitee()) {
108+
api_not_allowed(true);
109+
}
110+
111+
$groupId = api_get_group_id();
112+
if (!empty($groupId)) {
113+
$groupProperties = GroupManager :: get_group_properties($groupId);
114+
$interbreadcrumb[] = array('url' => '../group/group.php?'.$cidreq, 'name' => get_lang('Groups'));
115+
$interbreadcrumb[] = array('url' => '../group/group_space.php?'.$cidreq, 'name' => get_lang('GroupSpace').' '.$groupProperties['name']);
116+
$interbreadcrumb[] = array('url' => 'viewforum.php?'.$cidreq.'&forum='.Security::remove_XSS($_GET['forum']), 'name' => $currentForum['forum_title']);
117+
$interbreadcrumb[] = array('url' => 'newthread.php?'.$cidreq.'&forum='.Security::remove_XSS($_GET['forum']),'name' => get_lang('EditThread'));
118+
} else {
119+
$interbreadcrumb[] = array('url' => 'index.php?'.$cidreq, 'name' => $nameTools);
120+
$interbreadcrumb[] = array('url' => 'viewforumcategory.php?'.$cidreq.'&forumcategory='.$currentForumCategory['cat_id'], 'name' => $currentForumCategory['cat_title']);
121+
$interbreadcrumb[] = array('url' => 'viewforum.php?'.$cidreq.'&forum='.Security::remove_XSS($_GET['forum']), 'name' => $currentForum['forum_title']);
122+
$interbreadcrumb[] = array('url' => '#', 'name' => get_lang('EditThread'));
123+
}
124+
125+
$tableLink = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
126+
127+
/* Header */
128+
129+
$htmlHeadXtra[] = <<<JS
130+
<script>
131+
$(document).on('ready', function() {
132+
133+
if ($('#thread_qualify_gradebook').is(':checked') == true) {
134+
document.getElementById('options_field').style.display = 'block';
135+
} else {
136+
document.getElementById('options_field').style.display = 'none';
137+
}
138+
139+
$('#thread_qualify_gradebook').click(function() {
140+
if ($('#thread_qualify_gradebook').is(':checked') == true) {
141+
document.getElementById('options_field').style.display = 'block';
142+
} else {
143+
document.getElementById('options_field').style.display = 'none';
144+
$("[name='numeric_calification']").val(0);
145+
$("[name='calification_notebook_title']").val('');
146+
$("[name='weight_calification']").val(0);
147+
$("[name='thread_peer_qualify'][value='0']").prop('checked', true);
148+
}
149+
});
150+
});
151+
</script>
152+
JS;
153+
154+
if ($origin == 'learnpath') {
155+
Display::display_reduced_header();
156+
} else {
157+
Display :: display_header(null);
158+
}
159+
160+
handle_forum_and_forumcategories();
161+
162+
// Action links
163+
echo '<div class="actions">';
164+
echo '<span style="float:right;">'.search_link().'</span>';
165+
echo '<a href="viewforum.php?forum='.intval($_GET['forum']).'&'.$cidreq.'">'.
166+
Display::return_icon('back.png',get_lang('BackToForum'),'',ICON_SIZE_MEDIUM).'</a>';
167+
echo '</div>';
168+
169+
$threadData = getThreadInfo($threadId, $cId);
170+
171+
$values = showUpdateThreadForm(
172+
$currentForum,
173+
$forumSettings,
174+
$threadData
175+
);
176+
177+
if (!empty($values) && isset($values['SubmitPost'])) {
178+
179+
// update thread in table forum_thread.
180+
updateThread($values);
181+
}
182+
183+
if (isset($origin) && $origin != 'learnpath') {
184+
Display :: display_footer();
185+
}

0 commit comments

Comments
 (0)