Passed
Push — 1.10.x ( 04397c...5e25f1 )
by Angel Fernando Quiroz
181:14 queued 130:00
created
main/cron/fix_online_time.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@
 block discarded – undo
1 1
 <?php
2 2
 /* For licensing terms, see /license.txt */
3 3
 /**
4
- * Automatic fix online time procedure. If a COURSEMANAGER has been idle for $timeLimit
5
- * or more then the procedure adds $extraTime to his logout_course_date.
6
- * @package chamilo.cron
7
- * @author Imanol Losada <[email protected]>
8
- */
4
+     * Automatic fix online time procedure. If a COURSEMANAGER has been idle for $timeLimit
5
+     * or more then the procedure adds $extraTime to his logout_course_date.
6
+     * @package chamilo.cron
7
+     * @author Imanol Losada <[email protected]>
8
+     */
9 9
 require_once __DIR__ . '/../inc/global.inc.php';
10 10
 
11 11
 /**
Please login to merge, or discard this patch.
main/cron/run.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,20 +1,20 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * This script should be called by a properly set cron process on your server.
4
- * For more information, check the installation guide in the documentation 
5
- * folder. 
6
- * Add your own executable scripts below the inclusion of notification.php
7
- * @package chamilo.cron
8
- */
3
+     * This script should be called by a properly set cron process on your server.
4
+     * For more information, check the installation guide in the documentation 
5
+     * folder. 
6
+     * Add your own executable scripts below the inclusion of notification.php
7
+     * @package chamilo.cron
8
+     */
9 9
 /**
10
- * Settings that will influence the execution of the cron tasks
11
- */
10
+     * Settings that will influence the execution of the cron tasks
11
+     */
12 12
 //ini_set('max_execution_time',300); //authorize execution for up to 5 minutes
13 13
 //ini_set('memory_limit','100M'); //authorize script to use up to 100M RAM 
14 14
 /**
15
- * Included cron-ed tasks. You might want to turn error-logging off by 
16
- * commenting the first and last line of this section.
17
- */
15
+     * Included cron-ed tasks. You might want to turn error-logging off by 
16
+     * commenting the first and last line of this section.
17
+     */
18 18
 error_log('[chamilo][cronjob] Starting cron jobs as process '.getmypid());
19 19
 require_once 'notification.php';
20 20
 error_log('[chamilo][cronjob] Ending cron jobs of process '.getmypid());
Please login to merge, or discard this patch.
main/dashboard/index.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 /* For licensing terms, see /license.txt */
3 3
 /**
4 4
 * Template (front controller in MVC pattern) used for distpaching to
5
- * the controllers depend on the current action
5
+     * the controllers depend on the current action
6 6
 * @author Christian Fasanando <[email protected]>
7 7
 * @package chamilo.dashboard
8 8
 */
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 $actions = array('listing', 'store_user_block', 'disable_block');
27 27
 $action = 'listing';
28 28
 if (isset($_GET['action']) && in_array($_GET['action'],$actions)) {
29
-	$action = $_GET['action'];
29
+    $action = $_GET['action'];
30 30
 }
31 31
 
32 32
 // load styles from dashboard plugins
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 $dashboard_controller = new DashboardController();
38 38
 
39 39
 if (isset($_GET['path'])) {
40
-	$path = $_GET['path'];
40
+    $path = $_GET['path'];
41 41
 }
42 42
 
43 43
 // distpacher actions to controller
Please login to merge, or discard this patch.
main/dashboard/dashboard.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -14,23 +14,23 @@  discard block
 block discarded – undo
14 14
 $views = array('blocks', 'list');
15 15
 
16 16
 if(isset($_GET['view']) && in_array($_GET['view'], $views)){
17
-	$dashboard_view = $_GET['view'];
17
+    $dashboard_view = $_GET['view'];
18 18
 }
19 19
 
20 20
 $link_blocks_view = $link_list_view = null;
21 21
 
22 22
 if (isset($dashboard_view) && $dashboard_view == 'list') {
23
-	$link_blocks_view = '<a href="'.api_get_self().'?view=blocks">'.
24
-		Display::return_icon('blocks.png',get_lang('DashboardBlocks'),'',ICON_SIZE_MEDIUM).'</a>';
23
+    $link_blocks_view = '<a href="'.api_get_self().'?view=blocks">'.
24
+        Display::return_icon('blocks.png',get_lang('DashboardBlocks'),'',ICON_SIZE_MEDIUM).'</a>';
25 25
 } else {
26
-	$link_list_view = '<a href="'.api_get_self().'?view=list">'.
27
-		Display::return_icon('edit.png',get_lang('EditBlocks'),'',ICON_SIZE_MEDIUM).'</a>';
26
+    $link_list_view = '<a href="'.api_get_self().'?view=list">'.
27
+        Display::return_icon('edit.png',get_lang('EditBlocks'),'',ICON_SIZE_MEDIUM).'</a>';
28 28
 }
29 29
 
30 30
 $configuration_link = null;
31 31
 if (api_is_platform_admin()) {
32
-	$configuration_link = '<a href="'.api_get_path(WEB_CODE_PATH).'admin/settings.php?category=Plugins">'
33
-	.Display::return_icon('settings.png',get_lang('ConfigureDashboardPlugin'),'',ICON_SIZE_MEDIUM).'</a>';
32
+    $configuration_link = '<a href="'.api_get_path(WEB_CODE_PATH).'admin/settings.php?category=Plugins">'
33
+    .Display::return_icon('settings.png',get_lang('ConfigureDashboardPlugin'),'',ICON_SIZE_MEDIUM).'</a>';
34 34
 }
35 35
 
36 36
 echo '<div class="actions">';
@@ -87,10 +87,10 @@  discard block
 block discarded – undo
87 87
     }
88 88
 
89 89
 } else {
90
-	// block dashboard list
91
-	if (isset($success)) {
92
-		Display::display_confirmation_message(get_lang('BlocksHaveBeenUpdatedSuccessfully'));
93
-	}
94
-	$user_id = api_get_user_id();
95
-	DashboardManager::display_user_dashboard_list($user_id);
90
+    // block dashboard list
91
+    if (isset($success)) {
92
+        Display::display_confirmation_message(get_lang('BlocksHaveBeenUpdatedSuccessfully'));
93
+    }
94
+    $user_id = api_get_user_id();
95
+    DashboardManager::display_user_dashboard_list($user_id);
96 96
 }
Please login to merge, or discard this patch.
main/dashboard/dashboard_controller.php 1 patch
Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -85,40 +85,40 @@
 block discarded – undo
85 85
         $this->view->render();
86 86
     }
87 87
 
88
-	/**
89
-	 * This method allow store user blocks from dashboard manager
90
-	 * render to dashboard.php view
91
-	 */
92
-	public function store_user_block()
88
+    /**
89
+     * This method allow store user blocks from dashboard manager
90
+     * render to dashboard.php view
91
+     */
92
+    public function store_user_block()
93 93
     {
94
-		$data = array();
95
-		$user_id = $this->user_id;
96
-		if (strtoupper($_SERVER['REQUEST_METHOD']) == "POST") {
97
-			$enabled_blocks = $_POST['enabled_blocks'];
98
-			$columns = $_POST['columns'];
99
-			$affected_rows = DashboardManager::store_user_blocks($user_id, $enabled_blocks, $columns);
100
-			if ($affected_rows) {
101
-				$data['success'] = true;
102
-			}
103
-		}
104
-
105
-		$data['dashboard_view'] = 'list';
106
-
107
-		// render to the view
108
-		$this->view->set_data($data);
109
-		$this->view->set_layout('layout');
110
-		$this->view->set_template('dashboard');
111
-		$this->view->render();
112
-	}
113
-
114
-	/**
115
-	 * This method is used when you close a block from dashboard block interface
116
-	 * render to dashboard.php view
117
-	 */
118
-	public function close_user_block($path)
94
+        $data = array();
95
+        $user_id = $this->user_id;
96
+        if (strtoupper($_SERVER['REQUEST_METHOD']) == "POST") {
97
+            $enabled_blocks = $_POST['enabled_blocks'];
98
+            $columns = $_POST['columns'];
99
+            $affected_rows = DashboardManager::store_user_blocks($user_id, $enabled_blocks, $columns);
100
+            if ($affected_rows) {
101
+                $data['success'] = true;
102
+            }
103
+        }
104
+
105
+        $data['dashboard_view'] = 'list';
106
+
107
+        // render to the view
108
+        $this->view->set_data($data);
109
+        $this->view->set_layout('layout');
110
+        $this->view->set_template('dashboard');
111
+        $this->view->render();
112
+    }
113
+
114
+    /**
115
+     * This method is used when you close a block from dashboard block interface
116
+     * render to dashboard.php view
117
+     */
118
+    public function close_user_block($path)
119 119
     {
120
-		$user_id = $this->user_id;
121
-		$result = DashboardManager::close_user_block($user_id, $path);
122
-		$this->display($result);
123
-	}
120
+        $user_id = $this->user_id;
121
+        $result = DashboardManager::close_user_block($user_id, $path);
122
+        $this->display($result);
123
+    }
124 124
 }
Please login to merge, or discard this patch.
main/blog/download.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -33,18 +33,18 @@
 block discarded – undo
33 33
 $doc_url = str_replace('/..', '', $doc_url); //echo $doc_url;
34 34
 
35 35
 if (! isset($_course)) {
36
-	api_not_allowed(true);
36
+    api_not_allowed(true);
37 37
 }
38 38
 $full_file_name = api_get_path(SYS_COURSE_PATH).api_get_course_path().'/upload/blog/'.$doc_url;
39 39
 
40 40
 //if the rewrite rule asks for a directory, we redirect to the course view
41 41
 if (is_dir($full_file_name)) {
42
-	//remove last slash if present
43
-	while ($doc_url{$dul = strlen($doc_url)-1}=='/') $doc_url = substr($doc_url,0,$dul);
44
-	//create the path
45
-	$document_explorer = api_get_path(WEB_COURSE_PATH).api_get_course_path(); // home course path
46
-	//redirect
47
-	header('Location: '.$document_explorer);
42
+    //remove last slash if present
43
+    while ($doc_url{$dul = strlen($doc_url)-1}=='/') $doc_url = substr($doc_url,0,$dul);
44
+    //create the path
45
+    $document_explorer = api_get_path(WEB_COURSE_PATH).api_get_course_path(); // home course path
46
+    //redirect
47
+    header('Location: '.$document_explorer);
48 48
     exit;
49 49
 }
50 50
 
Please login to merge, or discard this patch.
main/blog/blog.php 1 patch
Indentation   +292 added lines, -292 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /* For licensing terms, see /license.txt */
3 3
 /**
4
- * BLOG HOMEPAGE
5
- * This file takes care of all blog navigation and displaying.
6
- * @package chamilo.blogs
7
- */
4
+     * BLOG HOMEPAGE
5
+     * This file takes care of all blog navigation and displaying.
6
+     * @package chamilo.blogs
7
+     */
8 8
 require_once '../inc/global.inc.php';
9 9
 
10 10
 $blog_id = intval($_GET['blog_id']);
@@ -41,181 +41,181 @@  discard block
 block discarded – undo
41 41
 $safe_task_description  = isset($_POST['task_description']) ? Security::remove_XSS($_POST['task_description']) : null;
42 42
 
43 43
 if (!empty($_POST['new_post_submit'])) {
44
-	Blog:: create_post(
45
-		$_POST['title'],
46
-		$_POST['full_text'],
47
-		$_POST['post_file_comment'],
48
-		$blog_id
49
-	);
50
-	$return_message = array('type' => 'confirmation', 'message' => get_lang('BlogAdded'));
44
+    Blog:: create_post(
45
+        $_POST['title'],
46
+        $_POST['full_text'],
47
+        $_POST['post_file_comment'],
48
+        $blog_id
49
+    );
50
+    $return_message = array('type' => 'confirmation', 'message' => get_lang('BlogAdded'));
51 51
 }
52 52
 if (!empty($_POST['edit_post_submit'])) {
53
-	Blog:: edit_post(
54
-		$_POST['post_id'],
55
-		$_POST['title'],
56
-		$_POST['full_text'],
57
-		$blog_id
58
-	);
59
-	$return_message = array('type' => 'confirmation', 'message' => get_lang('BlogEdited'));
53
+    Blog:: edit_post(
54
+        $_POST['post_id'],
55
+        $_POST['title'],
56
+        $_POST['full_text'],
57
+        $blog_id
58
+    );
59
+    $return_message = array('type' => 'confirmation', 'message' => get_lang('BlogEdited'));
60 60
 }
61 61
 
62 62
 if (!empty($_POST['new_comment_submit'])) {
63
-	Blog:: create_comment(
64
-		$_POST['title'],
65
-		$_POST['comment'],
66
-		$_POST['post_file_comment'],
67
-		$blog_id,
68
-		$_GET['post_id'],
69
-		$_POST['comment_parent_id']
70
-	);
71
-	$return_message = array('type' => 'confirmation', 'message' => get_lang('CommentAdded'));
63
+    Blog:: create_comment(
64
+        $_POST['title'],
65
+        $_POST['comment'],
66
+        $_POST['post_file_comment'],
67
+        $blog_id,
68
+        $_GET['post_id'],
69
+        $_POST['comment_parent_id']
70
+    );
71
+    $return_message = array('type' => 'confirmation', 'message' => get_lang('CommentAdded'));
72 72
 }
73 73
 
74 74
 if (!empty($_POST['new_task_submit'])) {
75 75
 
76
-	Blog:: create_task(
77
-		$blog_id,
78
-		$safe_task_name,
79
-		$safe_task_description,
80
-		(isset($_POST['chkArticleDelete']) ? $_POST['chkArticleDelete'] : null),
81
-		(isset($_POST['chkArticleEdit']) ? $_POST['chkArticleEdit'] : null),
82
-		(isset($_POST['chkCommentsDelete']) ? $_POST['chkCommentsDelete'] : null),
83
-		(isset($_POST['task_color']) ? $_POST['task_color'] : null)
84
-	);
85
-	$return_message = array('type' => 'confirmation', 'message' => get_lang('TaskCreated'));
76
+    Blog:: create_task(
77
+        $blog_id,
78
+        $safe_task_name,
79
+        $safe_task_description,
80
+        (isset($_POST['chkArticleDelete']) ? $_POST['chkArticleDelete'] : null),
81
+        (isset($_POST['chkArticleEdit']) ? $_POST['chkArticleEdit'] : null),
82
+        (isset($_POST['chkCommentsDelete']) ? $_POST['chkCommentsDelete'] : null),
83
+        (isset($_POST['task_color']) ? $_POST['task_color'] : null)
84
+    );
85
+    $return_message = array('type' => 'confirmation', 'message' => get_lang('TaskCreated'));
86 86
 }
87 87
 
88 88
 if (isset($_POST['edit_task_submit'])) {
89
-	Blog:: edit_task(
90
-		$_POST['blog_id'],
91
-		$_POST['task_id'],
92
-		$safe_task_name,
93
-		$safe_task_description,
94
-		$_POST['chkArticleDelete'],
95
-		$_POST['chkArticleEdit'],
96
-		$_POST['chkCommentsDelete'],
97
-		$_POST['task_color']
98
-	);
99
-	$return_message = array(
100
-		'type' => 'confirmation',
101
-		'message' => get_lang('TaskEdited')
102
-	);
89
+    Blog:: edit_task(
90
+        $_POST['blog_id'],
91
+        $_POST['task_id'],
92
+        $safe_task_name,
93
+        $safe_task_description,
94
+        $_POST['chkArticleDelete'],
95
+        $_POST['chkArticleEdit'],
96
+        $_POST['chkCommentsDelete'],
97
+        $_POST['task_color']
98
+    );
99
+    $return_message = array(
100
+        'type' => 'confirmation',
101
+        'message' => get_lang('TaskEdited')
102
+    );
103 103
 }
104 104
 
105 105
 if (!empty($_POST['assign_task_submit'])) {
106
-	Blog:: assign_task(
107
-		$blog_id,
108
-		$_POST['task_user_id'],
109
-		$_POST['task_task_id'],
110
-		$_POST['task_day']
111
-	);
112
-	$return_message = array(
113
-		'type' => 'confirmation',
114
-		'message' => get_lang('TaskAssigned')
115
-	);
106
+    Blog:: assign_task(
107
+        $blog_id,
108
+        $_POST['task_user_id'],
109
+        $_POST['task_task_id'],
110
+        $_POST['task_day']
111
+    );
112
+    $return_message = array(
113
+        'type' => 'confirmation',
114
+        'message' => get_lang('TaskAssigned')
115
+    );
116 116
 }
117 117
 
118 118
 if (isset($_POST['assign_task_edit_submit'])) {
119
-	Blog:: edit_assigned_task(
120
-		$blog_id,
121
-		$_POST['task_user_id'],
122
-		$_POST['task_task_id'],
123
-		$_POST['task_day'],
124
-		$_POST['old_user_id'],
125
-		$_POST['old_task_id'],
126
-		$_POST['old_target_date']
127
-	);
128
-	$return_message = array(
129
-		'type' => 'confirmation',
130
-		'message' => get_lang('AssignedTaskEdited')
131
-	);
119
+    Blog:: edit_assigned_task(
120
+        $blog_id,
121
+        $_POST['task_user_id'],
122
+        $_POST['task_task_id'],
123
+        $_POST['task_day'],
124
+        $_POST['old_user_id'],
125
+        $_POST['old_task_id'],
126
+        $_POST['old_target_date']
127
+    );
128
+    $return_message = array(
129
+        'type' => 'confirmation',
130
+        'message' => get_lang('AssignedTaskEdited')
131
+    );
132 132
 }
133 133
 if (!empty($_POST['new_task_execution_submit'])) {
134
-	Blog:: create_comment(
135
-		$safe_comment_title,
136
-		$safe_comment_text,
137
-		$blog_id,
138
-		(int)$_GET['post_id'],
139
-		$_POST['comment_parent_id'],
140
-		$_POST['task_id']
141
-	);
142
-	$return_message = array(
143
-		'type' => 'confirmation',
144
-		'message' => get_lang('CommentCreated')
145
-	);
134
+    Blog:: create_comment(
135
+        $safe_comment_title,
136
+        $safe_comment_text,
137
+        $blog_id,
138
+        (int)$_GET['post_id'],
139
+        $_POST['comment_parent_id'],
140
+        $_POST['task_id']
141
+    );
142
+    $return_message = array(
143
+        'type' => 'confirmation',
144
+        'message' => get_lang('CommentCreated')
145
+    );
146 146
 }
147 147
 if (!empty($_POST['register'])) {
148
-	if (is_array($_POST['user'])) {
149
-		foreach ($_POST['user'] as $index => $user_id) {
150
-			Blog :: set_user_subscribed((int)$_GET['blog_id'], $user_id);
151
-		}
152
-	}
148
+    if (is_array($_POST['user'])) {
149
+        foreach ($_POST['user'] as $index => $user_id) {
150
+            Blog :: set_user_subscribed((int)$_GET['blog_id'], $user_id);
151
+        }
152
+    }
153 153
 }
154 154
 if (!empty($_POST['unregister'])) {
155
-	if (is_array($_POST['user'])) {
156
-		foreach ($_POST['user'] as $index => $user_id) {
157
-			Blog :: set_user_unsubscribed((int)$_GET['blog_id'], $user_id);
158
-		}
159
-	}
155
+    if (is_array($_POST['user'])) {
156
+        foreach ($_POST['user'] as $index => $user_id) {
157
+            Blog :: set_user_unsubscribed((int)$_GET['blog_id'], $user_id);
158
+        }
159
+    }
160 160
 }
161 161
 if (!empty($_GET['register'])) {
162
-	Blog :: set_user_subscribed((int)$_GET['blog_id'], (int)$_GET['user_id']);
163
-	$return_message = array('type' => 'confirmation', 'message' => get_lang('UserRegistered'));
164
-	$flag = 1;
162
+    Blog :: set_user_subscribed((int)$_GET['blog_id'], (int)$_GET['user_id']);
163
+    $return_message = array('type' => 'confirmation', 'message' => get_lang('UserRegistered'));
164
+    $flag = 1;
165 165
 }
166 166
 if (!empty($_GET['unregister'])) {
167
-	Blog :: set_user_unsubscribed((int)$_GET['blog_id'], (int)$_GET['user_id']);
167
+    Blog :: set_user_unsubscribed((int)$_GET['blog_id'], (int)$_GET['user_id']);
168 168
 }
169 169
 
170 170
 if (isset($_GET['action']) && $_GET['action'] == 'manage_tasks') {
171
-	if (isset($_GET['do']) && $_GET['do'] == 'delete') {
172
-		Blog :: delete_task($blog_id, (int)$_GET['task_id']);
173
-		$return_message = array('type' => 'confirmation', 'message' => get_lang('TaskDeleted'));
174
-	}
175
-
176
-	if (isset($_GET['do']) && $_GET['do'] == 'delete_assignment') {
177
-		Blog :: delete_assigned_task($blog_id, intval($_GET['task_id']), intval($_GET['user_id']));
178
-		$return_message = array('type' => 'confirmation', 'message' => get_lang('TaskAssignmentDeleted'));
179
-	}
171
+    if (isset($_GET['do']) && $_GET['do'] == 'delete') {
172
+        Blog :: delete_task($blog_id, (int)$_GET['task_id']);
173
+        $return_message = array('type' => 'confirmation', 'message' => get_lang('TaskDeleted'));
174
+    }
175
+
176
+    if (isset($_GET['do']) && $_GET['do'] == 'delete_assignment') {
177
+        Blog :: delete_assigned_task($blog_id, intval($_GET['task_id']), intval($_GET['user_id']));
178
+        $return_message = array('type' => 'confirmation', 'message' => get_lang('TaskAssignmentDeleted'));
179
+    }
180 180
 }
181 181
 
182 182
 if (isset($_GET['action']) && $_GET['action'] == 'view_post') {
183
-	$task_id = (isset ($_GET['task_id']) && is_numeric($_GET['task_id'])) ? $_GET['task_id'] : 0;
184
-
185
-	if (isset($_GET['do']) && $_GET['do'] == 'delete_comment')	{
186
-		if (api_is_allowed('BLOG_'.$blog_id, 'article_comments_delete', $task_id)) {
187
-			Blog :: delete_comment($blog_id, (int)$_GET['post_id'],(int)$_GET['comment_id']);
188
-			$return_message = array('type' => 'confirmation', 'message' => get_lang('CommentDeleted'));
189
-		} else {
190
-			$error = true;
191
-			$message = get_lang('ActionNotAllowed');
192
-		}
193
-	}
194
-
195
-	if (isset($_GET['do']) && $_GET['do'] == 'delete_article')	{
196
-		if (api_is_allowed('BLOG_'.$blog_id, 'article_delete', $task_id)) {
197
-			Blog :: delete_post($blog_id, (int)$_GET['article_id']);
198
-			$action = ''; // Article is gone, go to blog home
199
-			$return_message = array('type' => 'confirmation', 'message' => get_lang('BlogDeleted'));
200
-		} else {
201
-			$error = true;
202
-			$message = get_lang('ActionNotAllowed');
203
-		}
204
-	}
205
-	if (isset($_GET['do']) && $_GET['do'] == 'rate') {
206
-		if (isset($_GET['type']) && $_GET['type'] == 'post') {
207
-			if (api_is_allowed('BLOG_'.$blog_id, 'article_rate')) {
208
-				Blog :: add_rating('post', $blog_id, (int)$_GET['post_id'], (int)$_GET['rating']);
209
-				$return_message = array('type' => 'confirmation', 'message' => get_lang('RatingAdded'));
210
-			}
211
-		}
212
-		if (isset($_GET['type']) && $_GET['type'] == 'comment') {
213
-			if (api_is_allowed('BLOG_'.$blog_id, 'article_comments_add')) {
214
-				Blog :: add_rating('comment', $blog_id, (int)$_GET['comment_id'], (int)$_GET['rating']);
215
-				$return_message = array('type' => 'confirmation', 'message' => get_lang('RatingAdded'));
216
-			}
217
-		}
218
-	}
183
+    $task_id = (isset ($_GET['task_id']) && is_numeric($_GET['task_id'])) ? $_GET['task_id'] : 0;
184
+
185
+    if (isset($_GET['do']) && $_GET['do'] == 'delete_comment')	{
186
+        if (api_is_allowed('BLOG_'.$blog_id, 'article_comments_delete', $task_id)) {
187
+            Blog :: delete_comment($blog_id, (int)$_GET['post_id'],(int)$_GET['comment_id']);
188
+            $return_message = array('type' => 'confirmation', 'message' => get_lang('CommentDeleted'));
189
+        } else {
190
+            $error = true;
191
+            $message = get_lang('ActionNotAllowed');
192
+        }
193
+    }
194
+
195
+    if (isset($_GET['do']) && $_GET['do'] == 'delete_article')	{
196
+        if (api_is_allowed('BLOG_'.$blog_id, 'article_delete', $task_id)) {
197
+            Blog :: delete_post($blog_id, (int)$_GET['article_id']);
198
+            $action = ''; // Article is gone, go to blog home
199
+            $return_message = array('type' => 'confirmation', 'message' => get_lang('BlogDeleted'));
200
+        } else {
201
+            $error = true;
202
+            $message = get_lang('ActionNotAllowed');
203
+        }
204
+    }
205
+    if (isset($_GET['do']) && $_GET['do'] == 'rate') {
206
+        if (isset($_GET['type']) && $_GET['type'] == 'post') {
207
+            if (api_is_allowed('BLOG_'.$blog_id, 'article_rate')) {
208
+                Blog :: add_rating('post', $blog_id, (int)$_GET['post_id'], (int)$_GET['rating']);
209
+                $return_message = array('type' => 'confirmation', 'message' => get_lang('RatingAdded'));
210
+            }
211
+        }
212
+        if (isset($_GET['type']) && $_GET['type'] == 'comment') {
213
+            if (api_is_allowed('BLOG_'.$blog_id, 'article_comments_add')) {
214
+                Blog :: add_rating('comment', $blog_id, (int)$_GET['comment_id'], (int)$_GET['rating']);
215
+                $return_message = array('type' => 'confirmation', 'message' => get_lang('RatingAdded'));
216
+            }
217
+        }
218
+    }
219 219
 }
220 220
 /*
221 221
 	DISPLAY
@@ -223,67 +223,67 @@  discard block
 block discarded – undo
223 223
 
224 224
 // Set breadcrumb
225 225
 switch ($action) {
226
-	case 'new_post' :
227
-		$nameTools = get_lang('NewPost');
226
+    case 'new_post' :
227
+        $nameTools = get_lang('NewPost');
228 228
         $interbreadcrumb[] = array(
229 229
             'url' => "blog.php?blog_id=$blog_id&".api_get_cidreq(),
230 230
             "name" => Blog:: get_blog_title($blog_id),
231 231
         );
232
-		Display :: display_header($nameTools, 'Blogs');
233
-		break;
234
-	case 'manage_tasks' :
235
-		$nameTools = get_lang('TaskManager');
232
+        Display :: display_header($nameTools, 'Blogs');
233
+        break;
234
+    case 'manage_tasks' :
235
+        $nameTools = get_lang('TaskManager');
236 236
         $interbreadcrumb[] = array(
237 237
             'url' => "blog.php?blog_id=$blog_id&".api_get_cidreq(),
238 238
             "name" => Blog:: get_blog_title($blog_id),
239 239
         );
240
-		Display :: display_header($nameTools, 'Blogs');
241
-		break;
242
-	case 'manage_members' :
243
-		$nameTools = get_lang('MemberManager');
240
+        Display :: display_header($nameTools, 'Blogs');
241
+        break;
242
+    case 'manage_members' :
243
+        $nameTools = get_lang('MemberManager');
244 244
         $interbreadcrumb[] = array(
245 245
             'url' => "blog.php?blog_id=$blog_id&".api_get_cidreq(),
246 246
             "name" => Blog:: get_blog_title($blog_id),
247 247
         );
248
-		Display :: display_header($nameTools, 'Blogs');
249
-		break;
250
-	case 'manage_rights' :
251
-		$nameTools = get_lang('RightsManager');
248
+        Display :: display_header($nameTools, 'Blogs');
249
+        break;
250
+    case 'manage_rights' :
251
+        $nameTools = get_lang('RightsManager');
252 252
         $interbreadcrumb[] = array(
253 253
             'url' => "blog.php?blog_id=$blog_id&".api_get_cidreq(),
254 254
             'name' => Blog:: get_blog_title($blog_id),
255 255
         );
256
-		Display :: display_header($nameTools, 'Blogs');
257
-		break;
258
-	case 'view_search_result' :
259
-		$nameTools = get_lang('SearchResults');
256
+        Display :: display_header($nameTools, 'Blogs');
257
+        break;
258
+    case 'view_search_result' :
259
+        $nameTools = get_lang('SearchResults');
260 260
         $interbreadcrumb[] = array(
261 261
             'url' => "blog.php?blog_id=$blog_id&".api_get_cidreq(),
262 262
             'name' => Blog:: get_blog_title($blog_id),
263 263
         );
264
-		Display :: display_header($nameTools, 'Blogs');
265
-		break;
266
-	case 'execute_task' :
267
-		$nameTools = get_lang('ExecuteThisTask');
264
+        Display :: display_header($nameTools, 'Blogs');
265
+        break;
266
+    case 'execute_task' :
267
+        $nameTools = get_lang('ExecuteThisTask');
268 268
         $interbreadcrumb[] = array(
269 269
             'url' => "blog.php?blog_id=$blog_id&".api_get_cidreq(),
270 270
             'name' => Blog:: get_blog_title($blog_id),
271 271
         );
272
-		Display :: display_header($nameTools, 'Blogs');
273
-		break;
274
-	default :
275
-		$nameTools = Blog :: get_blog_title($blog_id);
276
-		Display :: display_header($nameTools, 'Blogs');
272
+        Display :: display_header($nameTools, 'Blogs');
273
+        break;
274
+    default :
275
+        $nameTools = Blog :: get_blog_title($blog_id);
276
+        Display :: display_header($nameTools, 'Blogs');
277 277
 }
278 278
 
279 279
 // feedback messages
280 280
 if (!empty($return_message)) {
281
-	if ($return_message['type'] == 'confirmation') {
282
-		Display::display_confirmation_message($return_message['message']);
283
-	}
284
-	if ($return_message['type'] == 'error') {
285
-		Display::display_error_message($return_message['message']);
286
-	}
281
+    if ($return_message['type'] == 'confirmation') {
282
+        Display::display_confirmation_message($return_message['message']);
283
+    }
284
+    if ($return_message['type'] == 'error') {
285
+        Display::display_error_message($return_message['message']);
286
+    }
287 287
 }
288 288
 
289 289
 // actions
@@ -350,12 +350,12 @@  discard block
 block discarded – undo
350 350
 		<?php
351 351
 
352 352
 if (isset($error)) {
353
-	Display :: display_error_message($message);
353
+    Display :: display_error_message($message);
354 354
 }
355 355
 
356 356
 if (isset($flag) && $flag == '1') {
357
-	$action = "manage_tasks";
358
-	Blog :: display_assign_task_form($blog_id);
357
+    $action = "manage_tasks";
358
+    Blog :: display_assign_task_form($blog_id);
359 359
 }
360 360
 
361 361
 $user_task = false;
@@ -363,12 +363,12 @@  discard block
 block discarded – undo
363 363
 $course_id = api_get_course_int_id();
364 364
 
365 365
 if (isset ($_GET['task_id']) && is_numeric($_GET['task_id'])) {
366
-	$task_id = (int)$_GET['task_id'];
366
+    $task_id = (int)$_GET['task_id'];
367 367
 } else {
368
-	$task_id = 0;
369
-	$tbl_blogs_tasks_rel_user = Database :: get_course_table(TABLE_BLOGS_TASKS_REL_USER);
368
+    $task_id = 0;
369
+    $tbl_blogs_tasks_rel_user = Database :: get_course_table(TABLE_BLOGS_TASKS_REL_USER);
370 370
 
371
-	$sql = "SELECT COUNT(*) as number
371
+    $sql = "SELECT COUNT(*) as number
372 372
 			FROM ".$tbl_blogs_tasks_rel_user."
373 373
 			WHERE
374 374
 			    c_id = $course_id AND
@@ -376,120 +376,120 @@  discard block
 block discarded – undo
376 376
 				user_id = ".api_get_user_id()." AND
377 377
 				task_id = ".$task_id;
378 378
 
379
-	$result = Database::query($sql);
380
-	$row = Database::fetch_array($result);
379
+    $result = Database::query($sql);
380
+    $row = Database::fetch_array($result);
381 381
 
382
-	if ($row['number'] == 1)
383
-		$user_task = true;
382
+    if ($row['number'] == 1)
383
+        $user_task = true;
384 384
 }
385 385
 
386 386
 switch ($action) {
387
-	case 'new_post':
388
-		if (api_is_allowed('BLOG_'.$blog_id, 'article_add', $user_task ? $task_id : 0)) {
389
-			// we show the form if
390
-			// 1. no post data
391
-			// 2. there is post data and the required field is empty
392
-			if (!$_POST OR (!empty($_POST) AND empty($_POST['title']))) {
393
-				// if there is post data there is certainly an error in the form
394
-				if ($_POST) {
395
-					Display::display_error_message(get_lang('FormHasErrorsPleaseComplete'));
396
-				}
397
-			Blog :: display_form_new_post($blog_id);
398
-		} else {
399
-				if (isset($_GET['filter']) && !empty($_GET['filter'])) {
400
-					Blog :: display_day_results($blog_id, Database::escape_string($_GET['filter']));
401
-				} else {
402
-					Blog :: display_blog_posts($blog_id);
403
-				}
404
-			}
405
-		} else {
406
-			api_not_allowed();
407
-		}
408
-		break;
409
-	case 'view_post' :
410
-		Blog :: display_post($blog_id, intval($_GET['post_id']));
411
-		break;
412
-	case 'edit_post' :
413
-		$task_id = (isset ($_GET['task_id']) && is_numeric($_GET['task_id'])) ? $_GET['task_id'] : 0;
414
-
415
-		if (api_is_allowed('BLOG_'.$blog_id, 'article_edit', $task_id)) {
416
-			// we show the form if
417
-			// 1. no post data
418
-			// 2. there is post data and the required field is empty
419
-			if (!$_POST OR (!empty($_POST) AND empty($_POST['post_title']))) {
420
-				// if there is post data there is certainly an error in the form
421
-				if ($_POST) {
422
-					Display::display_error_message(get_lang('FormHasErrorsPleaseComplete'));
423
-				}
387
+    case 'new_post':
388
+        if (api_is_allowed('BLOG_'.$blog_id, 'article_add', $user_task ? $task_id : 0)) {
389
+            // we show the form if
390
+            // 1. no post data
391
+            // 2. there is post data and the required field is empty
392
+            if (!$_POST OR (!empty($_POST) AND empty($_POST['title']))) {
393
+                // if there is post data there is certainly an error in the form
394
+                if ($_POST) {
395
+                    Display::display_error_message(get_lang('FormHasErrorsPleaseComplete'));
396
+                }
397
+            Blog :: display_form_new_post($blog_id);
398
+        } else {
399
+                if (isset($_GET['filter']) && !empty($_GET['filter'])) {
400
+                    Blog :: display_day_results($blog_id, Database::escape_string($_GET['filter']));
401
+                } else {
402
+                    Blog :: display_blog_posts($blog_id);
403
+                }
404
+            }
405
+        } else {
406
+            api_not_allowed();
407
+        }
408
+        break;
409
+    case 'view_post' :
410
+        Blog :: display_post($blog_id, intval($_GET['post_id']));
411
+        break;
412
+    case 'edit_post' :
413
+        $task_id = (isset ($_GET['task_id']) && is_numeric($_GET['task_id'])) ? $_GET['task_id'] : 0;
414
+
415
+        if (api_is_allowed('BLOG_'.$blog_id, 'article_edit', $task_id)) {
416
+            // we show the form if
417
+            // 1. no post data
418
+            // 2. there is post data and the required field is empty
419
+            if (!$_POST OR (!empty($_POST) AND empty($_POST['post_title']))) {
420
+                // if there is post data there is certainly an error in the form
421
+                if ($_POST) {
422
+                    Display::display_error_message(get_lang('FormHasErrorsPleaseComplete'));
423
+                }
424 424
                 Blog :: display_form_edit_post($blog_id, intval($_GET['post_id']));
425
-			} else {
426
-				if (isset ($_GET['filter']) && !empty ($_GET['filter'])) {
427
-					Blog :: display_day_results($blog_id, Database::escape_string($_GET['filter']));
428
-				} else {
429
-					Blog :: display_blog_posts($blog_id);
430
-				}
431
-			}
432
-		} else {
433
-			api_not_allowed();
434
-		}
435
-
436
-		break;
437
-	case 'manage_members' :
438
-		if (api_is_allowed('BLOG_'.$blog_id, 'member_management')) {
439
-			Blog :: display_form_user_subscribe($blog_id);
440
-			echo '<br /><br />';
441
-			Blog :: display_form_user_unsubscribe($blog_id);
442
-		} else {
443
-			api_not_allowed();
425
+            } else {
426
+                if (isset ($_GET['filter']) && !empty ($_GET['filter'])) {
427
+                    Blog :: display_day_results($blog_id, Database::escape_string($_GET['filter']));
428
+                } else {
429
+                    Blog :: display_blog_posts($blog_id);
430
+                }
431
+            }
432
+        } else {
433
+            api_not_allowed();
434
+        }
435
+
436
+        break;
437
+    case 'manage_members' :
438
+        if (api_is_allowed('BLOG_'.$blog_id, 'member_management')) {
439
+            Blog :: display_form_user_subscribe($blog_id);
440
+            echo '<br /><br />';
441
+            Blog :: display_form_user_unsubscribe($blog_id);
442
+        } else {
443
+            api_not_allowed();
444 444
         }
445 445
 
446
-		break;
447
-	case 'manage_rights' :
448
-		Blog :: display_form_user_rights($blog_id);
449
-		break;
450
-	case 'manage_tasks' :
451
-		if (api_is_allowed('BLOG_'.$blog_id, 'task_management')) {
452
-			if (isset($_GET['do']) && $_GET['do'] == 'add') {
453
-				Blog:: display_new_task_form($blog_id);
454
-			}
455
-			if (isset($_GET['do']) && $_GET['do'] == 'assign') {
456
-				Blog:: display_assign_task_form($blog_id);
457
-			}
458
-			if (isset($_GET['do']) && $_GET['do'] == 'edit') {
459
-				Blog:: display_edit_task_form(
460
-					$blog_id,
461
-					intval($_GET['task_id'])
462
-				);
463
-			}
464
-			if (isset($_GET['do']) && $_GET['do'] == 'edit_assignment') {
465
-				Blog :: display_edit_assigned_task_form($blog_id, intval($_GET['task_id']), intval($_GET['user_id']));
466
-			}
467
-			Blog :: display_task_list($blog_id);
468
-			echo '<br /><br />';
469
-			Blog :: display_assigned_task_list($blog_id);
470
-			echo '<br /><br />';
471
-		}
472
-		else
473
-			api_not_allowed();
474
-
475
-		break;
476
-	case 'execute_task' :
477
-		if (isset ($_GET['post_id']))
478
-			Blog :: display_post($blog_id, intval($_GET['post_id']));
479
-		else
480
-			Blog :: display_select_task_post($blog_id, intval($_GET['task_id']));
481
-
482
-		break;
483
-	case 'view_search_result' :
484
-		Blog :: display_search_results($blog_id, Database::escape_string($_GET['q']));
485
-		break;
486
-	case '' :
487
-	default :
488
-		if (isset ($_GET['filter']) && !empty ($_GET['filter'])) {
489
-			Blog :: display_day_results($blog_id, Database::escape_string($_GET['filter']));
490
-		} else {
491
-			Blog :: display_blog_posts($blog_id);
492
-		}
446
+        break;
447
+    case 'manage_rights' :
448
+        Blog :: display_form_user_rights($blog_id);
449
+        break;
450
+    case 'manage_tasks' :
451
+        if (api_is_allowed('BLOG_'.$blog_id, 'task_management')) {
452
+            if (isset($_GET['do']) && $_GET['do'] == 'add') {
453
+                Blog:: display_new_task_form($blog_id);
454
+            }
455
+            if (isset($_GET['do']) && $_GET['do'] == 'assign') {
456
+                Blog:: display_assign_task_form($blog_id);
457
+            }
458
+            if (isset($_GET['do']) && $_GET['do'] == 'edit') {
459
+                Blog:: display_edit_task_form(
460
+                    $blog_id,
461
+                    intval($_GET['task_id'])
462
+                );
463
+            }
464
+            if (isset($_GET['do']) && $_GET['do'] == 'edit_assignment') {
465
+                Blog :: display_edit_assigned_task_form($blog_id, intval($_GET['task_id']), intval($_GET['user_id']));
466
+            }
467
+            Blog :: display_task_list($blog_id);
468
+            echo '<br /><br />';
469
+            Blog :: display_assigned_task_list($blog_id);
470
+            echo '<br /><br />';
471
+        }
472
+        else
473
+            api_not_allowed();
474
+
475
+        break;
476
+    case 'execute_task' :
477
+        if (isset ($_GET['post_id']))
478
+            Blog :: display_post($blog_id, intval($_GET['post_id']));
479
+        else
480
+            Blog :: display_select_task_post($blog_id, intval($_GET['task_id']));
481
+
482
+        break;
483
+    case 'view_search_result' :
484
+        Blog :: display_search_results($blog_id, Database::escape_string($_GET['q']));
485
+        break;
486
+    case '' :
487
+    default :
488
+        if (isset ($_GET['filter']) && !empty ($_GET['filter'])) {
489
+            Blog :: display_day_results($blog_id, Database::escape_string($_GET['filter']));
490
+        } else {
491
+            Blog :: display_blog_posts($blog_id);
492
+        }
493 493
 }
494 494
 ?>
495 495
 </div>
Please login to merge, or discard this patch.
main/exercice/exercise.class.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1966,7 +1966,7 @@  discard block
 block discarded – undo
1966 1966
                     $label = get_lang('NextQuestion');
1967 1967
                     $class = 'btn btn-primary';
1968 1968
                 }
1969
-				$class .= ' question-validate-btn'; // used to select it with jquery
1969
+                $class .= ' question-validate-btn'; // used to select it with jquery
1970 1970
                 if ($this->type == ONE_PER_PAGE) {
1971 1971
                     if ($questionNum != 1) {
1972 1972
                         $prev_question = $questionNum - 2;
@@ -1991,7 +1991,7 @@  discard block
 block discarded – undo
1991 1991
                         $all_label = get_lang('EndTest');
1992 1992
                         $class = 'btn btn-warning';
1993 1993
                     }
1994
-					$class .= ' question-validate-btn'; // used to select it with jquery
1994
+                    $class .= ' question-validate-btn'; // used to select it with jquery
1995 1995
                     $all_button = '&nbsp;<a href="javascript://" class="'.$class.'" onclick="validate_all(); ">'.$all_label.'</a>';
1996 1996
                     $all_button .= '&nbsp;' . Display::span(null, ['id' => 'save_all_reponse']);
1997 1997
                     $html .= $all_button;
@@ -3774,7 +3774,7 @@  discard block
 block discarded – undo
3774 3774
 
3775 3775
         //Fixes multiple answer question in order to be exact
3776 3776
         //if ($answerType == MULTIPLE_ANSWER || $answerType == GLOBAL_MULTIPLE_ANSWER) {
3777
-       /* if ($answerType == GLOBAL_MULTIPLE_ANSWER) {
3777
+        /* if ($answerType == GLOBAL_MULTIPLE_ANSWER) {
3778 3778
             $diff = @array_diff($answer_correct_array, $real_answers);
3779 3779
 
3780 3780
             // All good answers or nothing works like exact
@@ -5073,8 +5073,8 @@  discard block
 block discarded – undo
5073 5073
     }
5074 5074
 
5075 5075
     /**
5076
-    * @return string
5077
-    */
5076
+     * @return string
5077
+     */
5078 5078
     public function get_formated_title()
5079 5079
     {
5080 5080
         return api_html_entity_decode($this->selectTitle());
Please login to merge, or discard this patch.
main/exercice/hotpotatoes_exercise_report.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /* For licensing terms, see /license.txt */
3 3
 /**
4
- *	Exercise list: This script shows the list of exercises for administrators and students.
5
- *	@package chamilo.exercise
6
- *	@author hubert.borderiou
7
- *
8
- */
4
+     *	Exercise list: This script shows the list of exercises for administrators and students.
5
+     *	@package chamilo.exercise
6
+     *	@author hubert.borderiou
7
+     *
8
+     */
9 9
 
10 10
 use ChamiloSession as Session;
11 11
 
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 }
46 46
 
47 47
 if (!$is_allowedToEdit) {
48
-   // api_not_allowed();
48
+    // api_not_allowed();
49 49
 }
50 50
 
51 51
 if (!empty($_REQUEST['path'])) {
@@ -190,9 +190,9 @@  discard block
 block discarded – undo
190 190
         get_lang('Actions')
191 191
     );
192 192
 
193
-  // Column config
194
-  // @todo fix search firstname/lastname that doesn't work. rmove search for the moment
195
-	$column_model   = array(
193
+    // Column config
194
+    // @todo fix search firstname/lastname that doesn't work. rmove search for the moment
195
+    $column_model   = array(
196 196
         array('name'=>'firstname',      'index'=>'firstname',		'width'=>'50',   'align'=>'left', 'search' => 'false'),
197 197
         array('name'=>'lastname',		    'index'=>'lastname',		'width'=>'50',   'align'=>'left', 'formatter'=>'action_formatter', 'search' => 'false'),
198 198
         array('name'=>'login',          'hidden'=>'true',       'index'=>'username',        'width'=>'40',   'align'=>'left', 'search' => 'false'),
Please login to merge, or discard this patch.