@@ -26,7 +26,7 @@ |
||
26 | 26 | parent::__construct('1.1', 'Valery Fremaux'); |
27 | 27 | } |
28 | 28 | |
29 | - function pix_url($pixname, $size = 16) { |
|
29 | + function pix_url($pixname, $size = 16) { |
|
30 | 30 | global $_configuration; |
31 | 31 | |
32 | 32 | if (file_exists($_configuration['root_sys'].'/plugin/customplugin/pix/'.$pixname.'.png')){ |
@@ -50,26 +50,26 @@ discard block |
||
50 | 50 | // Please, do not modify this dirname formatting |
51 | 51 | |
52 | 52 | if (strstr($dir, '..')) { |
53 | - $dir = '/'; |
|
53 | + $dir = '/'; |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | if ($dir[0] == '.') { |
57 | - $dir = substr($dir, 1); |
|
57 | + $dir = substr($dir, 1); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | if ($dir[0] != '/') { |
61 | - $dir = '/'.$dir; |
|
61 | + $dir = '/'.$dir; |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | if ($dir[strlen($dir) - 1] != '/') { |
65 | - $dir .= '/'; |
|
65 | + $dir .= '/'; |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'.$dir; |
69 | 69 | |
70 | 70 | if (!is_dir($filepath)) { |
71 | - $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/'; |
|
72 | - $dir = '/'; |
|
71 | + $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/'; |
|
72 | + $dir = '/'; |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | $groupId = api_get_group_id(); |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | } |
98 | 98 | |
99 | 99 | if (!($is_allowed_to_edit || $_SESSION['group_member_with_upload_rights'] || |
100 | - DocumentManager::is_my_shared_folder($_user['user_id'], Security::remove_XSS($dir), api_get_session_id())) |
|
100 | + DocumentManager::is_my_shared_folder($_user['user_id'], Security::remove_XSS($dir), api_get_session_id())) |
|
101 | 101 | ) { |
102 | 102 | api_not_allowed(true); |
103 | 103 | } |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | |
115 | 115 | // Interbreadcrumb for the current directory root path |
116 | 116 | if (empty($document_data['parents'])) { |
117 | - $interbreadcrumb[] = array('url' => '#', 'name' => $document_data['title']); |
|
117 | + $interbreadcrumb[] = array('url' => '#', 'name' => $document_data['title']); |
|
118 | 118 | } else { |
119 | 119 | foreach ($document_data['parents'] as $document_sub_data) { |
120 | 120 | $interbreadcrumb[] = array('url' => $document_sub_data['document_url'], 'name' => $document_sub_data['title']); |
@@ -147,17 +147,17 @@ discard block |
||
147 | 147 | $locktitle="false"; |
148 | 148 | |
149 | 149 | if ($_SERVER['HTTP_HOST']=="localhost") { |
150 | - $path_and_file= api_get_path(SYS_PATH).'/crossdomain.xml'; |
|
151 | - if (!file_exists($path_and_file)) { |
|
152 | - $crossdomain='<?xml version="1.0"?> |
|
150 | + $path_and_file= api_get_path(SYS_PATH).'/crossdomain.xml'; |
|
151 | + if (!file_exists($path_and_file)) { |
|
152 | + $crossdomain='<?xml version="1.0"?> |
|
153 | 153 | <!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd"> |
154 | 154 | <cross-domain-policy> |
155 | 155 | <allow-access-from domain="cdn.pixlr.com" /> |
156 | 156 | <site-control permitted-cross-domain-policies="master-only"/> |
157 | 157 | <allow-http-request-headers-from domain="cnd.pixlr.com" headers="*" secure="true"/> |
158 | 158 | </cross-domain-policy>';//more open domain="*" |
159 | - @file_put_contents($path_and_file, $crossdomain); |
|
160 | - } |
|
159 | + @file_put_contents($path_and_file, $crossdomain); |
|
160 | + } |
|
161 | 161 | $credentials = "true"; |
162 | 162 | } else { |
163 | 163 | $credentials = "false"; |
@@ -10,166 +10,166 @@ |
||
10 | 10 | */ |
11 | 11 | class ResultTable extends SortableTable |
12 | 12 | { |
13 | - private $datagen; |
|
14 | - private $evaluation; |
|
15 | - private $allresults; |
|
16 | - private $iscourse; |
|
17 | - |
|
18 | - /** |
|
19 | - * Constructor |
|
20 | - */ |
|
13 | + private $datagen; |
|
14 | + private $evaluation; |
|
15 | + private $allresults; |
|
16 | + private $iscourse; |
|
17 | + |
|
18 | + /** |
|
19 | + * Constructor |
|
20 | + */ |
|
21 | 21 | public function __construct($evaluation, $results = array(), $iscourse, $addparams = null,$forprint = false) |
22 | - { |
|
23 | - parent :: __construct('resultlist', null, null, (api_is_western_name_order() xor api_sort_by_first_name()) ? 2 : 1); |
|
24 | - |
|
25 | - $this->datagen = new ResultsDataGenerator($evaluation, $results, true); |
|
26 | - |
|
27 | - $this->evaluation = $evaluation; |
|
28 | - $this->iscourse = $iscourse; |
|
29 | - $this->forprint = $forprint; |
|
30 | - |
|
31 | - if (isset ($addparams)) { |
|
32 | - $this->set_additional_parameters($addparams); |
|
33 | - } |
|
34 | - $scoredisplay = ScoreDisplay :: instance(); |
|
35 | - $column= 0; |
|
36 | - if ($this->iscourse == '1') { |
|
37 | - $this->set_header($column++, '', false); |
|
38 | - $this->set_form_actions(array ( |
|
39 | - 'delete' => get_lang('Delete') |
|
40 | - )); |
|
41 | - } |
|
42 | - if (api_is_western_name_order()) { |
|
43 | - $this->set_header($column++, get_lang('FirstName')); |
|
44 | - $this->set_header($column++, get_lang('LastName')); |
|
45 | - } else { |
|
46 | - $this->set_header($column++, get_lang('LastName')); |
|
47 | - $this->set_header($column++, get_lang('FirstName')); |
|
48 | - } |
|
49 | - $this->set_header($column++, get_lang('Score')); |
|
50 | - if ($scoredisplay->is_custom()) { |
|
51 | - $this->set_header($column++, get_lang('Display')); |
|
52 | - } |
|
53 | - if (!$this->forprint) { |
|
54 | - $this->set_header($column++, get_lang('Modify'),false); |
|
55 | - } |
|
22 | + { |
|
23 | + parent :: __construct('resultlist', null, null, (api_is_western_name_order() xor api_sort_by_first_name()) ? 2 : 1); |
|
24 | + |
|
25 | + $this->datagen = new ResultsDataGenerator($evaluation, $results, true); |
|
26 | + |
|
27 | + $this->evaluation = $evaluation; |
|
28 | + $this->iscourse = $iscourse; |
|
29 | + $this->forprint = $forprint; |
|
30 | + |
|
31 | + if (isset ($addparams)) { |
|
32 | + $this->set_additional_parameters($addparams); |
|
33 | + } |
|
34 | + $scoredisplay = ScoreDisplay :: instance(); |
|
35 | + $column= 0; |
|
36 | + if ($this->iscourse == '1') { |
|
37 | + $this->set_header($column++, '', false); |
|
38 | + $this->set_form_actions(array ( |
|
39 | + 'delete' => get_lang('Delete') |
|
40 | + )); |
|
41 | + } |
|
42 | + if (api_is_western_name_order()) { |
|
43 | + $this->set_header($column++, get_lang('FirstName')); |
|
44 | + $this->set_header($column++, get_lang('LastName')); |
|
45 | + } else { |
|
46 | + $this->set_header($column++, get_lang('LastName')); |
|
47 | + $this->set_header($column++, get_lang('FirstName')); |
|
48 | + } |
|
49 | + $this->set_header($column++, get_lang('Score')); |
|
50 | + if ($scoredisplay->is_custom()) { |
|
51 | + $this->set_header($column++, get_lang('Display')); |
|
52 | + } |
|
53 | + if (!$this->forprint) { |
|
54 | + $this->set_header($column++, get_lang('Modify'),false); |
|
55 | + } |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | |
59 | - /** |
|
60 | - * Function used by SortableTable to get total number of items in the table |
|
61 | - */ |
|
62 | - public function get_total_number_of_items () |
|
59 | + /** |
|
60 | + * Function used by SortableTable to get total number of items in the table |
|
61 | + */ |
|
62 | + public function get_total_number_of_items () |
|
63 | 63 | { |
64 | - return $this->datagen->get_total_results_count(); |
|
65 | - } |
|
66 | - |
|
67 | - /** |
|
68 | - * Function used by SortableTable to generate the data to display |
|
69 | - */ |
|
70 | - public function get_table_data($from = 1, $per_page = null, $column = null, $direction = null, $sort = null) { |
|
71 | - |
|
72 | - $is_western_name_order = api_is_western_name_order(); |
|
73 | - $scoredisplay = ScoreDisplay :: instance(); |
|
74 | - |
|
75 | - // determine sorting type |
|
76 | - $col_adjust = $this->iscourse == '1' ? 1 : 0; |
|
77 | - |
|
78 | - switch ($this->column) { |
|
79 | - // first name or last name |
|
80 | - case (0 + $col_adjust): |
|
81 | - if ($is_western_name_order) { |
|
82 | - $sorting = ResultsDataGenerator :: RDG_SORT_FIRSTNAME; |
|
83 | - } else { |
|
84 | - $sorting = ResultsDataGenerator :: RDG_SORT_LASTNAME; |
|
85 | - } |
|
86 | - break; |
|
64 | + return $this->datagen->get_total_results_count(); |
|
65 | + } |
|
66 | + |
|
67 | + /** |
|
68 | + * Function used by SortableTable to generate the data to display |
|
69 | + */ |
|
70 | + public function get_table_data($from = 1, $per_page = null, $column = null, $direction = null, $sort = null) { |
|
71 | + |
|
72 | + $is_western_name_order = api_is_western_name_order(); |
|
73 | + $scoredisplay = ScoreDisplay :: instance(); |
|
74 | + |
|
75 | + // determine sorting type |
|
76 | + $col_adjust = $this->iscourse == '1' ? 1 : 0; |
|
77 | + |
|
78 | + switch ($this->column) { |
|
87 | 79 | // first name or last name |
88 | - case (1 + $col_adjust): |
|
89 | - if ($is_western_name_order) { |
|
90 | - $sorting = ResultsDataGenerator :: RDG_SORT_LASTNAME; |
|
91 | - } else { |
|
92 | - $sorting = ResultsDataGenerator :: RDG_SORT_FIRSTNAME; |
|
93 | - } |
|
94 | - break; |
|
80 | + case (0 + $col_adjust): |
|
81 | + if ($is_western_name_order) { |
|
82 | + $sorting = ResultsDataGenerator :: RDG_SORT_FIRSTNAME; |
|
83 | + } else { |
|
84 | + $sorting = ResultsDataGenerator :: RDG_SORT_LASTNAME; |
|
85 | + } |
|
86 | + break; |
|
87 | + // first name or last name |
|
88 | + case (1 + $col_adjust): |
|
89 | + if ($is_western_name_order) { |
|
90 | + $sorting = ResultsDataGenerator :: RDG_SORT_LASTNAME; |
|
91 | + } else { |
|
92 | + $sorting = ResultsDataGenerator :: RDG_SORT_FIRSTNAME; |
|
93 | + } |
|
94 | + break; |
|
95 | 95 | //Score |
96 | - case (2 + $col_adjust): |
|
97 | - $sorting = ResultsDataGenerator :: RDG_SORT_SCORE; |
|
98 | - break; |
|
99 | - case (3 + $col_adjust): |
|
100 | - $sorting = ResultsDataGenerator :: RDG_SORT_MASK; |
|
101 | - break; |
|
102 | - } |
|
103 | - |
|
104 | - if ($this->direction == 'DESC') { |
|
105 | - $sorting |= ResultsDataGenerator :: RDG_SORT_DESC; |
|
106 | - } else { |
|
107 | - $sorting |= ResultsDataGenerator :: RDG_SORT_ASC; |
|
108 | - } |
|
109 | - |
|
110 | - $data_array = $this->datagen->get_data($sorting, $from, $this->per_page); |
|
111 | - |
|
112 | - // generate the data to display |
|
113 | - $sortable_data = array(); |
|
114 | - foreach ($data_array as $item) { |
|
115 | - $row = array (); |
|
116 | - if ($this->iscourse == '1') { |
|
117 | - $row[] = $item['result_id']; |
|
118 | - } |
|
119 | - if ($is_western_name_order) { |
|
120 | - $row[] = $item['firstname']; |
|
121 | - $row[] = $item['lastname']; |
|
122 | - } else { |
|
123 | - $row[] = $item['lastname']; |
|
124 | - $row[] = $item['firstname']; |
|
125 | - } |
|
126 | - |
|
127 | - $row[] = Display::bar_progress($item['percentage_score'], false, $item['score']); |
|
96 | + case (2 + $col_adjust): |
|
97 | + $sorting = ResultsDataGenerator :: RDG_SORT_SCORE; |
|
98 | + break; |
|
99 | + case (3 + $col_adjust): |
|
100 | + $sorting = ResultsDataGenerator :: RDG_SORT_MASK; |
|
101 | + break; |
|
102 | + } |
|
103 | + |
|
104 | + if ($this->direction == 'DESC') { |
|
105 | + $sorting |= ResultsDataGenerator :: RDG_SORT_DESC; |
|
106 | + } else { |
|
107 | + $sorting |= ResultsDataGenerator :: RDG_SORT_ASC; |
|
108 | + } |
|
109 | + |
|
110 | + $data_array = $this->datagen->get_data($sorting, $from, $this->per_page); |
|
111 | + |
|
112 | + // generate the data to display |
|
113 | + $sortable_data = array(); |
|
114 | + foreach ($data_array as $item) { |
|
115 | + $row = array (); |
|
116 | + if ($this->iscourse == '1') { |
|
117 | + $row[] = $item['result_id']; |
|
118 | + } |
|
119 | + if ($is_western_name_order) { |
|
120 | + $row[] = $item['firstname']; |
|
121 | + $row[] = $item['lastname']; |
|
122 | + } else { |
|
123 | + $row[] = $item['lastname']; |
|
124 | + $row[] = $item['firstname']; |
|
125 | + } |
|
126 | + |
|
127 | + $row[] = Display::bar_progress($item['percentage_score'], false, $item['score']); |
|
128 | 128 | //$row[] = Display::bar_progress($item['percentage_score'], true); |
129 | - if ($scoredisplay->is_custom()) { |
|
130 | - $row[] = $item['display']; |
|
131 | - } |
|
132 | - if (!$this->forprint) { |
|
133 | - $row[] = $this->build_edit_column ($item); |
|
134 | - } |
|
135 | - $sortable_data[] = $row; |
|
136 | - } |
|
137 | - |
|
138 | - return $sortable_data; |
|
139 | - } |
|
140 | - |
|
141 | - private function build_edit_column ($item) |
|
142 | - { |
|
143 | - $status = CourseManager::get_user_in_course_status(api_get_user_id(), api_get_course_id()); |
|
144 | - $locked_status = $this->evaluation->get_locked(); |
|
145 | - if (api_is_allowed_to_edit(null, true) && $locked_status == 0) { |
|
146 | - //api_is_course_admin() |
|
147 | - $edit_column = '<a href="' . api_get_self() . '?editres=' . $item['result_id'] . '&selecteval=' . $this->evaluation->get_id().'&'.api_get_cidreq().'">'. |
|
148 | - Display::return_icon('edit.png', get_lang('Modify'),'','22').'</a>'; |
|
149 | - $edit_column .= ' <a href="' . api_get_self() . '?delete_mark=' . $item['result_id'] . '&selecteval=' . $this->evaluation->get_id().'&'.api_get_cidreq().'">'. |
|
150 | - Display::return_icon('delete.png', get_lang('Delete'),'','22').'</a>'; |
|
151 | - } |
|
152 | - |
|
153 | - if ($this->evaluation->get_course_code() == null) { |
|
154 | - $edit_column .= ' <a href="' . api_get_self() . '?resultdelete=' . $item['result_id'] . '&selecteval=' . $this->evaluation->get_id() . '" onclick="return confirmationuser();">'; |
|
155 | - $edit_column .= Display::return_icon('delete.png', get_lang('Delete')); |
|
156 | - $edit_column .= '</a>'; |
|
157 | - $edit_column .= ' <a href="user_stats.php?userid=' . $item['id'] . '&selecteval=' . $this->evaluation->get_id() . '&'.api_get_cidreq().'">'; |
|
158 | - $edit_column .= Display::return_icon('statistics.gif', get_lang('Statistics')); |
|
159 | - $edit_column .= '</a>'; |
|
160 | - } |
|
161 | - |
|
162 | - // Evaluation's origin is a link |
|
163 | - if ($this->evaluation->get_category_id() < 0) { |
|
164 | - $link = LinkFactory::get_evaluation_link($this->evaluation->get_id()); |
|
165 | - $doc_url = $link->get_view_url($item['id']); |
|
166 | - |
|
167 | - if ($doc_url != null) { |
|
168 | - $edit_column .= ' <a href="'. $doc_url . '" target="_blank">'; |
|
169 | - $edit_column .= Display::return_icon('link.gif', get_lang('OpenDocument')).'</a>'; |
|
170 | - } |
|
171 | - } |
|
172 | - |
|
173 | - return $edit_column; |
|
174 | - } |
|
129 | + if ($scoredisplay->is_custom()) { |
|
130 | + $row[] = $item['display']; |
|
131 | + } |
|
132 | + if (!$this->forprint) { |
|
133 | + $row[] = $this->build_edit_column ($item); |
|
134 | + } |
|
135 | + $sortable_data[] = $row; |
|
136 | + } |
|
137 | + |
|
138 | + return $sortable_data; |
|
139 | + } |
|
140 | + |
|
141 | + private function build_edit_column ($item) |
|
142 | + { |
|
143 | + $status = CourseManager::get_user_in_course_status(api_get_user_id(), api_get_course_id()); |
|
144 | + $locked_status = $this->evaluation->get_locked(); |
|
145 | + if (api_is_allowed_to_edit(null, true) && $locked_status == 0) { |
|
146 | + //api_is_course_admin() |
|
147 | + $edit_column = '<a href="' . api_get_self() . '?editres=' . $item['result_id'] . '&selecteval=' . $this->evaluation->get_id().'&'.api_get_cidreq().'">'. |
|
148 | + Display::return_icon('edit.png', get_lang('Modify'),'','22').'</a>'; |
|
149 | + $edit_column .= ' <a href="' . api_get_self() . '?delete_mark=' . $item['result_id'] . '&selecteval=' . $this->evaluation->get_id().'&'.api_get_cidreq().'">'. |
|
150 | + Display::return_icon('delete.png', get_lang('Delete'),'','22').'</a>'; |
|
151 | + } |
|
152 | + |
|
153 | + if ($this->evaluation->get_course_code() == null) { |
|
154 | + $edit_column .= ' <a href="' . api_get_self() . '?resultdelete=' . $item['result_id'] . '&selecteval=' . $this->evaluation->get_id() . '" onclick="return confirmationuser();">'; |
|
155 | + $edit_column .= Display::return_icon('delete.png', get_lang('Delete')); |
|
156 | + $edit_column .= '</a>'; |
|
157 | + $edit_column .= ' <a href="user_stats.php?userid=' . $item['id'] . '&selecteval=' . $this->evaluation->get_id() . '&'.api_get_cidreq().'">'; |
|
158 | + $edit_column .= Display::return_icon('statistics.gif', get_lang('Statistics')); |
|
159 | + $edit_column .= '</a>'; |
|
160 | + } |
|
161 | + |
|
162 | + // Evaluation's origin is a link |
|
163 | + if ($this->evaluation->get_category_id() < 0) { |
|
164 | + $link = LinkFactory::get_evaluation_link($this->evaluation->get_id()); |
|
165 | + $doc_url = $link->get_view_url($item['id']); |
|
166 | + |
|
167 | + if ($doc_url != null) { |
|
168 | + $edit_column .= ' <a href="'. $doc_url . '" target="_blank">'; |
|
169 | + $edit_column .= Display::return_icon('link.gif', get_lang('OpenDocument')).'</a>'; |
|
170 | + } |
|
171 | + } |
|
172 | + |
|
173 | + return $edit_column; |
|
174 | + } |
|
175 | 175 | } |
@@ -61,44 +61,44 @@ discard block |
||
61 | 61 | /* Please, do not modify this dirname formatting */ |
62 | 62 | |
63 | 63 | if (strstr($dir, '..')) { |
64 | - $dir = '/'; |
|
64 | + $dir = '/'; |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | if ($dir[0] == '.') { |
68 | - $dir = substr($dir, 1); |
|
68 | + $dir = substr($dir, 1); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | if ($dir[0] != '/') { |
72 | - $dir = '/'.$dir; |
|
72 | + $dir = '/'.$dir; |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | if ($dir[strlen($dir) - 1] != '/') { |
76 | - $dir .= '/'; |
|
76 | + $dir .= '/'; |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'.$dir; |
80 | 80 | |
81 | 81 | if (!is_dir($filepath)) { |
82 | - $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/'; |
|
83 | - $dir = '/'; |
|
82 | + $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/'; |
|
83 | + $dir = '/'; |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | //groups //TODO:clean |
87 | 87 | if (!empty($groupId)) { |
88 | - $interbreadcrumb[] = array( |
|
89 | - 'url' => api_get_path(WEB_CODE_PATH).'group/group_space.php?'.api_get_cidreq(), |
|
90 | - 'name' => get_lang('GroupSpace'), |
|
91 | - ); |
|
92 | - $group_document = true; |
|
93 | - $noPHP_SELF = true; |
|
88 | + $interbreadcrumb[] = array( |
|
89 | + 'url' => api_get_path(WEB_CODE_PATH).'group/group_space.php?'.api_get_cidreq(), |
|
90 | + 'name' => get_lang('GroupSpace'), |
|
91 | + ); |
|
92 | + $group_document = true; |
|
93 | + $noPHP_SELF = true; |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | $is_certificate_mode = DocumentManager::is_certificate_mode($dir); |
97 | 97 | |
98 | 98 | if (!$is_certificate_mode) |
99 | - $interbreadcrumb[]= array("url" => "./document.php?curdirpath=".urlencode($my_cur_dir_path).'&'.api_get_cidreq(), "name"=> get_lang('Documents')); |
|
99 | + $interbreadcrumb[]= array("url" => "./document.php?curdirpath=".urlencode($my_cur_dir_path).'&'.api_get_cidreq(), "name"=> get_lang('Documents')); |
|
100 | 100 | else |
101 | - $interbreadcrumb[]= array ('url' => '../gradebook/'.$_SESSION['gradebook_dest'], 'name' => get_lang('Gradebook')); |
|
101 | + $interbreadcrumb[]= array ('url' => '../gradebook/'.$_SESSION['gradebook_dest'], 'name' => get_lang('Gradebook')); |
|
102 | 102 | |
103 | 103 | // Interbreadcrumb for the current directory root path |
104 | 104 | if (empty($document_data['parents'])) { |
@@ -113,10 +113,10 @@ discard block |
||
113 | 113 | } |
114 | 114 | |
115 | 115 | $is_allowedToEdit = api_is_allowed_to_edit(null, true) || $_SESSION['group_member_with_upload_rights'] || |
116 | - DocumentManager::is_my_shared_folder(api_get_user_id(), $dir, $current_session_id); |
|
116 | + DocumentManager::is_my_shared_folder(api_get_user_id(), $dir, $current_session_id); |
|
117 | 117 | |
118 | 118 | if (!$is_allowedToEdit) { |
119 | - api_not_allowed(true); |
|
119 | + api_not_allowed(true); |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | Event::event_access_tool(TOOL_DOCUMENT); |
@@ -148,21 +148,21 @@ discard block |
||
148 | 148 | $locktitle="false"; |
149 | 149 | |
150 | 150 | if ($_SERVER['HTTP_HOST']=="localhost") { |
151 | - $path_and_file= api_get_path(SYS_PATH).'/crossdomain.xml'; |
|
152 | - if (!file_exists($path_and_file)) { |
|
153 | - $crossdomain='<?xml version="1.0"?> |
|
151 | + $path_and_file= api_get_path(SYS_PATH).'/crossdomain.xml'; |
|
152 | + if (!file_exists($path_and_file)) { |
|
153 | + $crossdomain='<?xml version="1.0"?> |
|
154 | 154 | <!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd"> |
155 | 155 | <cross-domain-policy> |
156 | 156 | <allow-access-from domain="cdn.pixlr.com" /> |
157 | 157 | <site-control permitted-cross-domain-policies="master-only"/> |
158 | 158 | <allow-http-request-headers-from domain="cnd.pixlr.com" headers="*" secure="true"/> |
159 | 159 | </cross-domain-policy>';//more open domain="*" |
160 | - @file_put_contents($path_and_file, $crossdomain); |
|
161 | - } |
|
162 | - $credentials="true"; |
|
160 | + @file_put_contents($path_and_file, $crossdomain); |
|
161 | + } |
|
162 | + $credentials="true"; |
|
163 | 163 | } |
164 | 164 | else { |
165 | - $credentials="false"; |
|
165 | + $credentials="false"; |
|
166 | 166 | } |
167 | 167 | |
168 | 168 | //make temp images |
@@ -175,23 +175,23 @@ discard block |
||
175 | 175 | $htaccess=api_get_path(SYS_ARCHIVE_PATH).'temp/images/.htaccess'; |
176 | 176 | if (!file_exists($htaccess)) { |
177 | 177 | |
178 | - $htaccess_content="order deny,allow\r\nallow from all\r\nOptions -Indexes"; |
|
178 | + $htaccess_content="order deny,allow\r\nallow from all\r\nOptions -Indexes"; |
|
179 | 179 | |
180 | - $fp = @ fopen(api_get_path(SYS_ARCHIVE_PATH).'temp/images/.htaccess', 'w'); |
|
181 | - if ($fp) { |
|
182 | - fwrite($fp, $htaccess_content); |
|
183 | - fclose($fp); |
|
184 | - } |
|
180 | + $fp = @ fopen(api_get_path(SYS_ARCHIVE_PATH).'temp/images/.htaccess', 'w'); |
|
181 | + if ($fp) { |
|
182 | + fwrite($fp, $htaccess_content); |
|
183 | + fclose($fp); |
|
184 | + } |
|
185 | 185 | } |
186 | 186 | |
187 | 187 | $html_index=api_get_path(SYS_ARCHIVE_PATH).'temp/images/index.html'; |
188 | 188 | if (!file_exists($html_index)) { |
189 | - $html_index_content="<html><head></head><body></body></html>"; |
|
190 | - $fp = @ fopen(api_get_path(SYS_ARCHIVE_PATH).'temp/images/index.html', 'w'); |
|
191 | - if ($fp) { |
|
192 | - fwrite($fp, $html_index_content); |
|
193 | - fclose($fp); |
|
194 | - } |
|
189 | + $html_index_content="<html><head></head><body></body></html>"; |
|
190 | + $fp = @ fopen(api_get_path(SYS_ARCHIVE_PATH).'temp/images/index.html', 'w'); |
|
191 | + if ($fp) { |
|
192 | + fwrite($fp, $html_index_content); |
|
193 | + fclose($fp); |
|
194 | + } |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | //encript temp name file |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | * Security checks |
15 | 15 | */ |
16 | 16 | if (! isset($_SESSION['conditional_login']['uid'])) |
17 | - die("Not Authorised"); |
|
17 | + die("Not Authorised"); |
|
18 | 18 | |
19 | 19 | if (isset($_POST['password'])) { |
20 | 20 | $u = api_get_user_info($_SESSION['conditional_login']['uid']); |
@@ -27,26 +27,26 @@ discard block |
||
27 | 27 | exit(); |
28 | 28 | } |
29 | 29 | $password = $_POST['password']; |
30 | - $updated = UserManager::update_user( |
|
31 | - $u['user_id'], |
|
32 | - $u['firstname'], |
|
33 | - $u['lastname'], |
|
34 | - $u['username'], |
|
35 | - $password, |
|
36 | - $u['auth_source'], |
|
37 | - $u['email'], |
|
38 | - $u['status'], |
|
39 | - $u['official_code'], |
|
40 | - $u['phone'], |
|
41 | - $u['picture_uri'], |
|
42 | - $u['expiration_date'], |
|
43 | - $u['active'], |
|
44 | - $u['creator_id'], |
|
45 | - $u['hr_dept_id'], |
|
46 | - null, |
|
47 | - $u['language'], |
|
48 | - '' |
|
49 | - ); |
|
30 | + $updated = UserManager::update_user( |
|
31 | + $u['user_id'], |
|
32 | + $u['firstname'], |
|
33 | + $u['lastname'], |
|
34 | + $u['username'], |
|
35 | + $password, |
|
36 | + $u['auth_source'], |
|
37 | + $u['email'], |
|
38 | + $u['status'], |
|
39 | + $u['official_code'], |
|
40 | + $u['phone'], |
|
41 | + $u['picture_uri'], |
|
42 | + $u['expiration_date'], |
|
43 | + $u['active'], |
|
44 | + $u['creator_id'], |
|
45 | + $u['hr_dept_id'], |
|
46 | + null, |
|
47 | + $u['language'], |
|
48 | + '' |
|
49 | + ); |
|
50 | 50 | |
51 | 51 | if ($updated !== false) { |
52 | 52 | UserManager::update_extra_field_value($u['user_id'], 'already_logged_in', 'true'); |
@@ -104,8 +104,8 @@ discard block |
||
104 | 104 | <div id="changepassword-form-box" class="form-box"> |
105 | 105 | <div class="info"> <?php echo custompages_get_lang('FirstLoginChangePassword');?> </div> |
106 | 106 | <?php if (isset($error_message)) { |
107 | - echo '<div id="changepassword-form-error" class="form-error">'.$error_message.'</div>'; |
|
108 | - }?> |
|
107 | + echo '<div id="changepassword-form-error" class="form-error">'.$error_message.'</div>'; |
|
108 | + }?> |
|
109 | 109 | <form id="changepassword-form" class="form" method="post"> |
110 | 110 | <div> |
111 | 111 | <label for="password">*<?php echo custompages_get_lang('Password');?></label> |
@@ -46,10 +46,9 @@ discard block |
||
46 | 46 | - Universite Jean Monet (J Dubois / Michel Courbon) |
47 | 47 | - Michel Panckoucke for reporting and fixing a bug |
48 | 48 | - Patrick Cool: fixing security hole |
49 | - |
|
50 | - * @author Roan Embrechts |
|
51 | - * @version 3.0 |
|
52 | - * @package chamilo.auth.ldap |
|
49 | + * @author Roan Embrechts |
|
50 | + * @version 3.0 |
|
51 | + * @package chamilo.auth.ldap |
|
53 | 52 | * Note: |
54 | 53 | * If you are using a firewall, you might need to check port 389 is open in |
55 | 54 | * order for Chamilo to communicate with the LDAP server. |
@@ -211,8 +210,8 @@ discard block |
||
211 | 210 | $language = api_get_setting('platformLanguage'); |
212 | 211 | if (empty($language)) { $language = 'english'; } |
213 | 212 | $_userId = UserManager::create_user($prenom, $nom, $status, |
214 | - $email, $uname, $password, $official_code, |
|
215 | - $language,'', '', 'ldap'); |
|
213 | + $email, $uname, $password, $official_code, |
|
214 | + $language,'', '', 'ldap'); |
|
216 | 215 | |
217 | 216 | //echo "new user added to Chamilo, id = $_userId"; |
218 | 217 | |
@@ -271,7 +270,7 @@ discard block |
||
271 | 270 | // Open anonymous LDAP connection |
272 | 271 | $result=false; |
273 | 272 | $ldap_bind_res = ldap_handle_bind($ds,$result); |
274 | - // Executing the search with the $filter parametr |
|
273 | + // Executing the search with the $filter parametr |
|
275 | 274 | //error_log('Searching for '.$filter.' on LDAP server',0); |
276 | 275 | $sr=ldap_search($ds,$ldap_basedn,$filter); |
277 | 276 | $info = ldap_get_entries($ds, $sr); |
@@ -564,35 +563,35 @@ discard block |
||
564 | 563 | foreach ($UserList as $enreg_user) { |
565 | 564 | $enreg_user = (int) $enreg_user; |
566 | 565 | Database::query("INSERT IGNORE ". |
567 | - " INTO $tbl_session_rel_course_rel_user ". |
|
568 | - "(session_id,c_id,user_id) VALUES ". |
|
569 | - "('$id_session','$enreg_course','$enreg_user')"); |
|
566 | + " INTO $tbl_session_rel_course_rel_user ". |
|
567 | + "(session_id,c_id,user_id) VALUES ". |
|
568 | + "('$id_session','$enreg_course','$enreg_user')"); |
|
570 | 569 | } |
571 | 570 | $sql = "SELECT COUNT(user_id) as nbUsers ". |
572 | - " FROM $tbl_session_rel_course_rel_user " . |
|
573 | - " WHERE session_id='$id_session' ". |
|
574 | - " AND c_id='$enreg_course'"; |
|
571 | + " FROM $tbl_session_rel_course_rel_user " . |
|
572 | + " WHERE session_id='$id_session' ". |
|
573 | + " AND c_id='$enreg_course'"; |
|
575 | 574 | $rs = Database::query($sql); |
576 | 575 | list($nbr_users) = Database::fetch_array($rs); |
577 | 576 | Database::query("UPDATE $tbl_session_rel_course ". |
578 | - " SET nbr_users=$nbr_users " . |
|
579 | - " WHERE session_id='$id_session' ". |
|
580 | - " AND c_id='$enreg_course'"); |
|
577 | + " SET nbr_users=$nbr_users " . |
|
578 | + " WHERE session_id='$id_session' ". |
|
579 | + " AND c_id='$enreg_course'"); |
|
581 | 580 | } |
582 | 581 | foreach ($UserList as $enreg_user) { |
583 | 582 | $enreg_user = (int) $enreg_user; |
584 | 583 | Database::query("INSERT IGNORE INTO $tbl_session_rel_user ". |
585 | - " (session_id, user_id, registered_at) " . |
|
586 | - " VALUES('$id_session','$enreg_user', '" . api_get_utc_datetime() . "')"); |
|
584 | + " (session_id, user_id, registered_at) " . |
|
585 | + " VALUES('$id_session','$enreg_user', '" . api_get_utc_datetime() . "')"); |
|
587 | 586 | } |
588 | 587 | // We update the number of users in the session |
589 | 588 | $sql = "SELECT COUNT(user_id) as nbUsers FROM $tbl_session_rel_user ". |
590 | - " WHERE session_id='$id_session' ". |
|
591 | - " AND relation_type<>".SESSION_RELATION_TYPE_RRHH." "; |
|
589 | + " WHERE session_id='$id_session' ". |
|
590 | + " AND relation_type<>".SESSION_RELATION_TYPE_RRHH." "; |
|
592 | 591 | $rs = Database::query($sql); |
593 | 592 | list($nbr_users) = Database::fetch_array($rs); |
594 | 593 | Database::query("UPDATE $tbl_session SET nbr_users=$nbr_users ". |
595 | - " WHERE id='$id_session'"); |
|
594 | + " WHERE id='$id_session'"); |
|
596 | 595 | } |
597 | 596 | |
598 | 597 | function syncro_users() { |
@@ -28,15 +28,15 @@ |
||
28 | 28 | switch ($_GET["cmd"]) { |
29 | 29 | case "clear_stapi": |
30 | 30 | echo "Are you sure you are willing to erease all storage api data (no backup)? <a href='cli.php?cmd=clear_stapi_confirm' >Yes</a>"; |
31 | - break; |
|
31 | + break; |
|
32 | 32 | case "clear_stapi_confirm": |
33 | 33 | Database::query("delete from ".Database::get_main_table(TABLE_TRACK_STORED_VALUES)); |
34 | - Database::query("delete from ".Database::get_main_table(TABLE_TRACK_STORED_VALUES_STACK)); |
|
35 | - echo "Done"; |
|
36 | - break; |
|
34 | + Database::query("delete from ".Database::get_main_table(TABLE_TRACK_STORED_VALUES_STACK)); |
|
35 | + echo "Done"; |
|
36 | + break; |
|
37 | 37 | default: |
38 | 38 | echo "UNKNOWN COMMAND"; |
39 | - break; |
|
39 | + break; |
|
40 | 40 | } |
41 | 41 | /** |
42 | 42 | * Footer |
@@ -60,8 +60,8 @@ |
||
60 | 60 | $user['error'] = get_lang('UserNameNotAvailable'); |
61 | 61 | $errors[] = $user; |
62 | 62 | } |
63 | - } |
|
64 | - } |
|
63 | + } |
|
64 | + } |
|
65 | 65 | |
66 | 66 | // 3. Check status. |
67 | 67 | if (isset($user['Status']) && !api_status_exists($user['Status'])) { |
@@ -22,59 +22,59 @@ |
||
22 | 22 | $output = false; |
23 | 23 | $ls = new langstats(); |
24 | 24 | if ($ls === false) { |
25 | - exit($ls->error); |
|
25 | + exit($ls->error); |
|
26 | 26 | } |
27 | 27 | $list = $ls->get_popular_terms($x_most_popular); |
28 | 28 | if ($_GET['output'] == 1) { |
29 | - $output = true; |
|
30 | - $variables_origin = $ls->get_variables_origin(); |
|
29 | + $output = true; |
|
30 | + $variables_origin = $ls->get_variables_origin(); |
|
31 | 31 | } |
32 | 32 | /** |
33 | 33 | * Display |
34 | 34 | */ |
35 | 35 | if (count($list)==0) { echo 'No terms loaded so far'; } |
36 | 36 | if (count($list)>0) { |
37 | - $i = 1; |
|
38 | - $j = 1; |
|
39 | - $k = 0; |
|
40 | - $files = array(); |
|
41 | - $trans = array(); |
|
42 | - echo 'Number of records: '.count($list).'<br />'; |
|
43 | - echo '<table><tr><th>Index</th><th>Registration order</th><th>Term</th>'.($output==1?'<th>Origin</th>':'').'<th>Count</th></tr>'; |
|
44 | - foreach($list as $elem) { |
|
37 | + $i = 1; |
|
38 | + $j = 1; |
|
39 | + $k = 0; |
|
40 | + $files = array(); |
|
41 | + $trans = array(); |
|
42 | + echo 'Number of records: '.count($list).'<br />'; |
|
43 | + echo '<table><tr><th>Index</th><th>Registration order</th><th>Term</th>'.($output==1?'<th>Origin</th>':'').'<th>Count</th></tr>'; |
|
44 | + foreach($list as $elem) { |
|
45 | 45 | if ($k > $terms_limit) { break; } |
46 | 46 | $fixed_elem = $elem; |
47 | 47 | if ($output) { |
48 | - if (empty($variables_origin[$elem['term_name']]) && !empty($variables_origin['lang'.$elem['term_name']])) { |
|
48 | + if (empty($variables_origin[$elem['term_name']]) && !empty($variables_origin['lang'.$elem['term_name']])) { |
|
49 | 49 | $fixed_elem = array('id' => $elem['id'], 'term_name' => 'lang'.$elem['term_name'], 'term_count' => $elem['term_count']); |
50 | - } |
|
51 | - if (empty($variables_origin[$fixed_elem['term_name']])) { |
|
50 | + } |
|
51 | + if (empty($variables_origin[$fixed_elem['term_name']])) { |
|
52 | 52 | continue; |
53 | - } |
|
54 | - $files[$variables_origin[$fixed_elem['term_name']]][] = $fixed_elem['term_name']; |
|
55 | - $translation = get_lang($fixed_elem['term_name']); |
|
56 | - $k += str_word_count($translation); |
|
57 | - $trans[$fixed_elem['term_name']] = $translation; |
|
58 | - $j++; |
|
53 | + } |
|
54 | + $files[$variables_origin[$fixed_elem['term_name']]][] = $fixed_elem['term_name']; |
|
55 | + $translation = get_lang($fixed_elem['term_name']); |
|
56 | + $k += str_word_count($translation); |
|
57 | + $trans[$fixed_elem['term_name']] = $translation; |
|
58 | + $j++; |
|
59 | 59 | } |
60 | 60 | echo '<tr><td>',$i, |
61 | - '</td><td>',$fixed_elem['id'], |
|
62 | - '</td><td>',$fixed_elem['term_name']; |
|
61 | + '</td><td>',$fixed_elem['id'], |
|
62 | + '</td><td>',$fixed_elem['term_name']; |
|
63 | 63 | if ($output) { |
64 | - echo '</td><td>'.$variables_origin[$fixed_elem['term_name']]; |
|
64 | + echo '</td><td>'.$variables_origin[$fixed_elem['term_name']]; |
|
65 | 65 | } |
66 | 66 | echo '</td><td>',$fixed_elem['term_count'],'</td></tr>'; |
67 | 67 | $i++; |
68 | - } |
|
69 | - echo '</table>'; |
|
70 | - if ($output) { |
|
68 | + } |
|
69 | + echo '</table>'; |
|
70 | + if ($output) { |
|
71 | 71 | @mkdir('/tmp/lang'); |
72 | 72 | foreach ($files as $file => $terms) { |
73 | - @touch('/tmp/lang/'.$file); |
|
74 | - file_put_contents('/tmp/lang/'.$file,"<?php".PHP_EOL); |
|
75 | - foreach ($terms as $term) { |
|
73 | + @touch('/tmp/lang/'.$file); |
|
74 | + file_put_contents('/tmp/lang/'.$file,"<?php".PHP_EOL); |
|
75 | + foreach ($terms as $term) { |
|
76 | 76 | file_put_contents('/tmp/lang/'.$file,'$'.$term.' = "'.str_replace('"','\"',$trans[$term]).'";'.PHP_EOL, FILE_APPEND); |
77 | - } |
|
77 | + } |
|
78 | 78 | } |
79 | - } |
|
79 | + } |
|
80 | 80 | } |