Completed
Pull Request — 1.10.x (#1198)
by
unknown
46:55
created
main/inc/lib/statistics.lib.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -666,7 +666,7 @@
 block discarded – undo
666 666
         $res = Database::query($sql);
667 667
         $count1 = Database::fetch_object($res);
668 668
         $sql = "SELECT COUNT(*) AS n FROM $user_table as u $table ".
669
-               "WHERE LENGTH(picture_uri) > 0 $url_condition2";
669
+                "WHERE LENGTH(picture_uri) > 0 $url_condition2";
670 670
         $res = Database::query($sql);
671 671
         $count2 = Database::fetch_object($res);
672 672
         // #users without picture
Please login to merge, or discard this patch.
main/inc/lib/opengraph/OpenGraph.php 1 patch
Indentation   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -18,11 +18,11 @@  discard block
 block discarded – undo
18 18
 
19 19
 class OpenGraph implements Iterator
20 20
 {
21
-  /**
22
-   * There are base schema's based on type, this is just
23
-   * a map so that the schema can be obtained
24
-   *
25
-   */
21
+    /**
22
+     * There are base schema's based on type, this is just
23
+     * a map so that the schema can be obtained
24
+     *
25
+     */
26 26
     public static $TYPES = array(
27 27
         'activity' => array('activity', 'sport'),
28 28
         'business' => array('bar', 'company', 'cafe', 'hotel', 'restaurant'),
@@ -34,19 +34,19 @@  discard block
 block discarded – undo
34 34
         'website' => array('blog', 'website'),
35 35
     );
36 36
 
37
-  /**
38
-   * Holds all the Open Graph values we've parsed from a page
39
-   *
40
-   */
37
+    /**
38
+     * Holds all the Open Graph values we've parsed from a page
39
+     *
40
+     */
41 41
     private $_values = array();
42 42
 
43
-  /**
44
-   * Fetches a URI and parses it for Open Graph data, returns
45
-   * false on error.
46
-   *
47
-   * @param $URI    URI to page to parse for Open Graph data
48
-   * @return OpenGraph
49
-   */
43
+    /**
44
+     * Fetches a URI and parses it for Open Graph data, returns
45
+     * false on error.
46
+     *
47
+     * @param $URI    URI to page to parse for Open Graph data
48
+     * @return OpenGraph
49
+     */
50 50
     static public function fetch($URI) {
51 51
         $curl = curl_init($URI);
52 52
 
@@ -69,13 +69,13 @@  discard block
 block discarded – undo
69 69
         }
70 70
     }
71 71
 
72
-  /**
73
-   * Parses HTML and extracts Open Graph data, this assumes
74
-   * the document is at least well formed.
75
-   *
76
-   * @param $HTML    HTML to parse
77
-   * @return OpenGraph
78
-   */
72
+    /**
73
+     * Parses HTML and extracts Open Graph data, this assumes
74
+     * the document is at least well formed.
75
+     *
76
+     * @param $HTML    HTML to parse
77
+     * @return OpenGraph
78
+     */
79 79
     static private function _parse($HTML) {
80 80
         $old_libxml_error = libxml_use_internal_errors(true);
81 81
 
@@ -140,13 +140,13 @@  discard block
 block discarded – undo
140 140
         return $page;
141 141
     }
142 142
 
143
-  /**
144
-   * Helper method to access attributes directly
145
-   * Example:
146
-   * $graph->title
147
-   *
148
-   * @param $key    Key to fetch from the lookup
149
-   */
143
+    /**
144
+     * Helper method to access attributes directly
145
+     * Example:
146
+     * $graph->title
147
+     *
148
+     * @param $key    Key to fetch from the lookup
149
+     */
150 150
     public function __get($key) {
151 151
         if (array_key_exists($key, $this->_values)) {
152 152
             return $this->_values[$key];
@@ -161,29 +161,29 @@  discard block
 block discarded – undo
161 161
         }
162 162
     }
163 163
 
164
-  /**
165
-   * Return all the keys found on the page
166
-   *
167
-   * @return array
168
-   */
164
+    /**
165
+     * Return all the keys found on the page
166
+     *
167
+     * @return array
168
+     */
169 169
     public function keys() {
170 170
         return array_keys($this->_values);
171 171
     }
172 172
 
173
-  /**
174
-   * Helper method to check an attribute exists
175
-   *
176
-   * @param $key
177
-   */
173
+    /**
174
+     * Helper method to check an attribute exists
175
+     *
176
+     * @param $key
177
+     */
178 178
     public function __isset($key) {
179 179
         return array_key_exists($key, $this->_values);
180 180
     }
181 181
 
182
-  /**
183
-   * Will return true if the page has location data embedded
184
-   *
185
-   * @return boolean Check if the page has location data
186
-   */
182
+    /**
183
+     * Will return true if the page has location data embedded
184
+     *
185
+     * @return boolean Check if the page has location data
186
+     */
187 187
     public function hasLocation() {
188 188
         if (array_key_exists('latitude', $this->_values) && array_key_exists('longitude', $this->_values)) {
189 189
             return true;
@@ -197,9 +197,9 @@  discard block
 block discarded – undo
197 197
         return $valid_address;
198 198
     }
199 199
 
200
-  /**
201
-   * Iterator code
202
-   */
200
+    /**
201
+     * Iterator code
202
+     */
203 203
     private $_position = 0;
204 204
     public function rewind() { reset($this->_values); $this->_position = 0; }
205 205
     public function current() { return current($this->_values); }
Please login to merge, or discard this patch.
main/inc/lib/auth.lib.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -379,7 +379,7 @@
 block discarded – undo
379 379
         $sql_delete = "DELETE FROM $tucc
380 380
                       WHERE id='" . $category_id . "' and user_id='" . $current_user_id . "'";
381 381
         $resultQuery = Database::query($sql_delete);
382
-       if (Database::affected_rows($resultQuery)) {
382
+        if (Database::affected_rows($resultQuery)) {
383 383
             $result = true;
384 384
         }
385 385
         $sql = "UPDATE $TABLECOURSUSER
Please login to merge, or discard this patch.
main/inc/lib/internationalization.lib.php 1 patch
Indentation   +21 added lines, -22 removed lines patch added patch discarded remove patch
@@ -103,13 +103,13 @@  discard block
 block discarded – undo
103 103
     if (isset($_configuration['language_measure_frequency']) &&
104 104
         $_configuration['language_measure_frequency'] == 1
105 105
     ) {
106
-      require_once api_get_path(SYS_CODE_PATH).'/cron/lang/langstats.class.php';
107
-      global $langstats;
108
-      $langstats->add_use($variable,'');
106
+        require_once api_get_path(SYS_CODE_PATH).'/cron/lang/langstats.class.php';
107
+        global $langstats;
108
+        $langstats->add_use($variable,'');
109 109
     }
110 110
 
111 111
     if (!isset($used_lang_vars)) {
112
-    	$used_lang_vars = array();
112
+        $used_lang_vars = array();
113 113
     }
114 114
 
115 115
     // Caching results from some API functions, for speed.
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
     static $text_direction = array();
306 306
 
307 307
     if (empty($language)) {
308
-    	$language = api_get_interface_language();
308
+        $language = api_get_interface_language();
309 309
     }
310 310
     if (!isset($text_direction[$language])) {
311 311
         $text_direction[$language] = in_array(api_purify_language_id($language),
@@ -536,24 +536,24 @@  discard block
 block discarded – undo
536 536
             case DATE_FORMAT_ONLY_DAYNAME:
537 537
                 $date_format = get_lang('dateFormatOnlyDayName', '', $language);
538 538
                 if (INTL_INSTALLED) {
539
-        			$datetype = IntlDateFormatter::SHORT;
540
-        			$timetype = IntlDateFormatter::NONE;
541
-        		}
539
+                    $datetype = IntlDateFormatter::SHORT;
540
+                    $timetype = IntlDateFormatter::NONE;
541
+                }
542 542
                 break;
543 543
             case DATE_FORMAT_NUMBER_NO_YEAR:
544 544
                 $date_format = get_lang('dateFormatShortNumberNoYear', '', $language);
545
-        		if (INTL_INSTALLED) {
546
-        			$datetype = IntlDateFormatter::SHORT;
547
-        			$timetype = IntlDateFormatter::NONE;
548
-        		}
545
+                if (INTL_INSTALLED) {
546
+                    $datetype = IntlDateFormatter::SHORT;
547
+                    $timetype = IntlDateFormatter::NONE;
548
+                }
549
+                break;
550
+            case DATE_FORMAT_NUMBER:
551
+                $date_format = get_lang('dateFormatShortNumber', '', $language);
552
+                if (INTL_INSTALLED) {
553
+                    $datetype = IntlDateFormatter::SHORT;
554
+                    $timetype = IntlDateFormatter::NONE;
555
+                }
549 556
                 break;
550
-        	case DATE_FORMAT_NUMBER:
551
-        		$date_format = get_lang('dateFormatShortNumber', '', $language);
552
-        		if (INTL_INSTALLED) {
553
-        			$datetype = IntlDateFormatter::SHORT;
554
-        			$timetype = IntlDateFormatter::NONE;
555
-        		}
556
-        		break;
557 557
             case TIME_NO_SEC_FORMAT:
558 558
                 $date_format = get_lang('timeNoSecFormat', '', $language);
559 559
                 if (INTL_INSTALLED) {
@@ -589,14 +589,14 @@  discard block
 block discarded – undo
589 589
                     $timetype = IntlDateFormatter::SHORT;
590 590
                 }
591 591
                 break;
592
-			case DATE_TIME_FORMAT_SHORT:
592
+            case DATE_TIME_FORMAT_SHORT:
593 593
                 $date_format = get_lang('dateTimeFormatShort', '', $language);
594 594
                 if (INTL_INSTALLED) {
595 595
                     $datetype = IntlDateFormatter::FULL;
596 596
                     $timetype = IntlDateFormatter::SHORT;
597 597
                 }
598 598
                 break;
599
-			case DATE_TIME_FORMAT_SHORT_TIME_FIRST:
599
+            case DATE_TIME_FORMAT_SHORT_TIME_FIRST:
600 600
                 $date_format = get_lang('dateTimeFormatShortTimeFirst', '', $language);
601 601
                 if (INTL_INSTALLED) {
602 602
                     $datetype = IntlDateFormatter::FULL;
@@ -1817,7 +1817,6 @@  discard block
 block discarded – undo
1817 1817
 
1818 1818
 /**
1819 1819
  * Return true a date is valid
1820
-
1821 1820
  * @param string $date example: 2014-06-30 13:05:05
1822 1821
  * @param string $format example: "Y-m-d H:i:s"
1823 1822
  *
Please login to merge, or discard this patch.
main/inc/lib/nanogong.lib.php 1 patch
Indentation   +240 added lines, -240 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
         ) {
72 72
             mkdir($this->store_path.$this->session_id.'/'.$this->exercise_id.'/'.$this->question_id.'/'.$this->user_id, $directoryPermissions);
73 73
         }
74
-	}
74
+    }
75 75
 
76 76
     /**
77 77
      * Setting parameters: course id, session id, etc
@@ -119,24 +119,24 @@  discard block
 block discarded – undo
119 119
             $this->question_id = 0;
120 120
         }
121 121
 
122
-		$this->can_edit = false;
122
+        $this->can_edit = false;
123 123
 
124
-		if (api_is_allowed_to_edit()) {
125
-			$this->can_edit = true;
126
-		} else {
127
-			if ($this->user_id ==  api_get_user_id()) {
128
-				$this->can_edit = true;
129
-			}
130
-		}
124
+        if (api_is_allowed_to_edit()) {
125
+            $this->can_edit = true;
126
+        } else {
127
+            if ($this->user_id ==  api_get_user_id()) {
128
+                $this->can_edit = true;
129
+            }
130
+        }
131 131
 
132
-		// Settings the params array
133
-		$this->params = $params;
134
-		$this->store_path = api_get_path(SYS_COURSE_PATH).$this->course_info['path'].'/exercises/';
135
-		$this->create_user_folder();
136
-		$this->store_path = $this->store_path.implode('/', array($this->session_id, $this->exercise_id, $this->question_id, $this->user_id)).'/';
137
-		$this->filename = $this->generate_filename();
138
-		$this->store_filename = $this->store_path.$this->filename;
139
-	}
132
+        // Settings the params array
133
+        $this->params = $params;
134
+        $this->store_path = api_get_path(SYS_COURSE_PATH).$this->course_info['path'].'/exercises/';
135
+        $this->create_user_folder();
136
+        $this->store_path = $this->store_path.implode('/', array($this->session_id, $this->exercise_id, $this->question_id, $this->user_id)).'/';
137
+        $this->filename = $this->generate_filename();
138
+        $this->store_filename = $this->store_path.$this->filename;
139
+    }
140 140
 
141 141
     /**
142 142
      * Generates the filename with the next format:
@@ -187,30 +187,30 @@  discard block
 block discarded – undo
187 187
         return $delete_found;
188 188
     }
189 189
 
190
-	/**
191
-	 *
192
-	 * Tricky stuff to deal with the feedback = 0 in exercises (all question per page)
190
+    /**
191
+     *
192
+     * Tricky stuff to deal with the feedback = 0 in exercises (all question per page)
193 193
      * @param int $exe_id
194
-	 */
194
+     */
195 195
     public function replace_with_real_exe($exe_id)
196 196
     {
197
-		$filename = null;
198
-		//@ugly fix
199
-		foreach($this->available_extensions as $extension) {
200
-			$items = explode('-', $this->filename);
201
-			$items[5] = 'temp_exe';
202
-			$filename = implode('-', $items);
203
-			if (is_file($this->store_path.$filename.'.'.$extension)) {
204
-				$old_name = $this->store_path.$filename.'.'.$extension;
205
-				$items = explode('-', $this->filename);
206
-				$items[5] = $exe_id;
207
-				$filename = $filename = implode('-', $items);
208
-				$new_name = $this->store_path.$filename.'.'.$extension;
209
-				rename($old_name, $new_name);
210
-				break;
211
-			}
212
-		}
213
-	}
197
+        $filename = null;
198
+        //@ugly fix
199
+        foreach($this->available_extensions as $extension) {
200
+            $items = explode('-', $this->filename);
201
+            $items[5] = 'temp_exe';
202
+            $filename = implode('-', $items);
203
+            if (is_file($this->store_path.$filename.'.'.$extension)) {
204
+                $old_name = $this->store_path.$filename.'.'.$extension;
205
+                $items = explode('-', $this->filename);
206
+                $items[5] = $exe_id;
207
+                $filename = $filename = implode('-', $items);
208
+                $new_name = $this->store_path.$filename.'.'.$extension;
209
+                rename($old_name, $new_name);
210
+                break;
211
+            }
212
+        }
213
+    }
214 214
 
215 215
     /**
216 216
      * @param bool $load_from_database
@@ -218,24 +218,24 @@  discard block
 block discarded – undo
218 218
      */
219 219
     public function load_filename_if_exists($load_from_database = false)
220 220
     {
221
-		$filename = null;
222
-		//@ugly fix
223
-		foreach($this->available_extensions as $extension) {
224
-			if (is_file($this->store_path.$this->filename.'.'.$extension)) {
225
-				$filename = $this->filename.'.'.$extension;
226
-				break;
227
-			}
228
-		}
221
+        $filename = null;
222
+        //@ugly fix
223
+        foreach($this->available_extensions as $extension) {
224
+            if (is_file($this->store_path.$this->filename.'.'.$extension)) {
225
+                $filename = $this->filename.'.'.$extension;
226
+                break;
227
+            }
228
+        }
229 229
 
230
-		// temp_exe
231
-		if ($load_from_database) {
230
+        // temp_exe
231
+        if ($load_from_database) {
232 232
 
233
-			//Load the real filename just if exists
234
-			if (isset($this->params['exe_id']) && isset($this->params['user_id']) &&
233
+            //Load the real filename just if exists
234
+            if (isset($this->params['exe_id']) && isset($this->params['user_id']) &&
235 235
                 isset($this->params['question_id']) && isset($this->params['session_id']) && isset($this->params['course_id'])
236 236
             ) {
237
-				$attempt_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
238
-				$sql = "SELECT filename FROM $attempt_table
237
+                $attempt_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
238
+                $sql = "SELECT filename FROM $attempt_table
239 239
                         WHERE
240 240
                             exe_id = ".$this->params['exe_id']." AND
241 241
                             user_id = ".$this->params['user_id']." AND
@@ -243,107 +243,107 @@  discard block
 block discarded – undo
243 243
                             session_id 	= ".$this->params['session_id']." AND
244 244
                             course_code = '".$this->course_info['code']."'
245 245
                         LIMIT 1";
246
-				$result = Database::query($sql);
247
-				$result = Database::fetch_row($result,'ASSOC');
246
+                $result = Database::query($sql);
247
+                $result = Database::fetch_row($result,'ASSOC');
248 248
 
249
-				if (isset($result) && isset($result[0]) && !empty($result[0])) {
250
-					$filename = $result[0];
251
-				}
252
-			}
253
-		}
249
+                if (isset($result) && isset($result[0]) && !empty($result[0])) {
250
+                    $filename = $result[0];
251
+                }
252
+            }
253
+        }
254 254
 
255
-		if (is_file($this->store_path.$filename)) {
256
-			return $this->store_path.$filename;
257
-		}
255
+        if (is_file($this->store_path.$filename)) {
256
+            return $this->store_path.$filename;
257
+        }
258 258
 
259
-		return null;
260
-	}
259
+        return null;
260
+    }
261 261
 
262
-	/**
263
-	 *
264
-	 * Get the URL of the file
265
-	 * path courses/XXX/exercises/(session_id)/(exercise_id)/(question_id)/(user_id)/
262
+    /**
263
+     *
264
+     * Get the URL of the file
265
+     * path courses/XXX/exercises/(session_id)/(exercise_id)/(question_id)/(user_id)/
266 266
      * @param int $force_download
267
-	 *
268
-	 * @return string
269
-	 */
267
+     *
268
+     * @return string
269
+     */
270 270
     public function get_public_url($force_download = 0)
271 271
     {
272
-		$params = $this->get_params();
273
-		$filename = basename($this->load_filename_if_exists());
272
+        $params = $this->get_params();
273
+        $filename = basename($this->load_filename_if_exists());
274 274
         $url = api_get_path(WEB_COURSE_PATH).$this->course_info['path'].'/exercises/'.$params['session_id'].'/'.$params['exercise_id'].'/'.$params['question_id'].'/'.$params['user_id'].'/'.$filename;
275
-		return $url;
276
-	}
275
+        return $url;
276
+    }
277 277
 
278
-	/**
279
-	 * Uploads the nanogong wav file
278
+    /**
279
+     * Uploads the nanogong wav file
280 280
      * @param bool
281
-	 */
282
-	public function upload_file($is_nano = false)
283
-	{
284
-		if (!empty($_FILES)) {
285
-			$upload_ok = process_uploaded_file($_FILES['file'], false);
286
-
287
-			if (!is_uploaded_file($_FILES['file']['tmp_name'])) {
288
-				return 0;
289
-			}
281
+     */
282
+    public function upload_file($is_nano = false)
283
+    {
284
+        if (!empty($_FILES)) {
285
+            $upload_ok = process_uploaded_file($_FILES['file'], false);
290 286
 
291
-			if ($upload_ok) {
292
-				// Check if there is enough space to save the file
293
-				if (!DocumentManager::enough_space($_FILES['file']['size'], DocumentManager::get_course_quota())) {
294
-					return 0;
295
-				}
287
+            if (!is_uploaded_file($_FILES['file']['tmp_name'])) {
288
+                return 0;
289
+            }
296 290
 
297
-				//first we delete everything before uploading the file
298
-				$this->delete_files();
291
+            if ($upload_ok) {
292
+                // Check if there is enough space to save the file
293
+                if (!DocumentManager::enough_space($_FILES['file']['size'], DocumentManager::get_course_quota())) {
294
+                    return 0;
295
+                }
299 296
 
300
-				//Reload the filename variable
301
-				$file_name = add_ext_on_mime($_FILES['file']['name'], $_FILES['file']['type']);
302
-				$file_name = strtolower($file_name);
303
-				$file_info = pathinfo($file_name);
297
+                //first we delete everything before uploading the file
298
+                $this->delete_files();
304 299
 
305
-				if ($is_nano == true) {
306
-					$file_info['extension'] = 'wav';
307
-				}
300
+                //Reload the filename variable
301
+                $file_name = add_ext_on_mime($_FILES['file']['name'], $_FILES['file']['type']);
302
+                $file_name = strtolower($file_name);
303
+                $file_info = pathinfo($file_name);
308 304
 
309
-				$file_name = $this->filename.'.'.$file_info['extension'];
305
+                if ($is_nano == true) {
306
+                    $file_info['extension'] = 'wav';
307
+                }
310 308
 
311
-				if (in_array($file_info['extension'], $this->available_extensions)) {
312
-					if (move_uploaded_file($_FILES['file']['tmp_name'], $this->store_path.$file_name)) {
313
-						$this->store_filename = $this->store_path.$file_name;
314
-						return 1;
315
-					}
316
-				}
317
-			}
318
-		}
309
+                $file_name = $this->filename.'.'.$file_info['extension'];
310
+
311
+                if (in_array($file_info['extension'], $this->available_extensions)) {
312
+                    if (move_uploaded_file($_FILES['file']['tmp_name'], $this->store_path.$file_name)) {
313
+                        $this->store_filename = $this->store_path.$file_name;
314
+                        return 1;
315
+                    }
316
+                }
317
+            }
318
+        }
319 319
 
320
-		return 0;
321
-	}
320
+        return 0;
321
+    }
322 322
 
323
-	/**
324
-	 * Show the audio file + a button to download
323
+    /**
324
+     * Show the audio file + a button to download
325 325
      * @param bool
326
-	 */
327
-	public function show_audio_file($show_delete_button = false)
328
-	{
329
-		$html = '';
330
-		$file_path = $this->load_filename_if_exists();
331
-
332
-		if (!empty($file_path)) {
333
-			$url = $this->get_public_url(true);
334
-			$actions = Display::url(Display::return_icon('save.png', get_lang('Download'), array(), ICON_SIZE_SMALL), $url, array('target'=>'_blank'));
335
-			$download_button = Display::url(get_lang('Download'), $url, array('class' =>'btn btn-default'));
336
-
337
-			if ($show_delete_button) {
338
-				$actions .= ' '.Display::url(Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL), "#", array('onclick'=>'delete_file();'));
339
-			}
326
+     */
327
+    public function show_audio_file($show_delete_button = false)
328
+    {
329
+        $html = '';
330
+        $file_path = $this->load_filename_if_exists();
331
+
332
+        if (!empty($file_path)) {
333
+            $url = $this->get_public_url(true);
334
+            $actions = Display::url(Display::return_icon('save.png', get_lang('Download'), array(), ICON_SIZE_SMALL), $url, array('target'=>'_blank'));
335
+            $download_button = Display::url(get_lang('Download'), $url, array('class' =>'btn btn-default'));
340 336
 
341
-			$basename = basename($file_path);
342
-			$path_info = pathinfo($basename);
337
+            if ($show_delete_button) {
338
+                $actions .= ' '.Display::url(Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL), "#", array('onclick'=>'delete_file();'));
339
+            }
343 340
 
344
-			if ($path_info['extension'] == 'wav') {
341
+            $basename = basename($file_path);
342
+            $path_info = pathinfo($basename);
345 343
 
346
-				$html .= '<script>
344
+            if ($path_info['extension'] == 'wav') {
345
+
346
+                $html .= '<script>
347 347
 				$(document).ready( function() {
348 348
 					var java_enabled = navigator.javaEnabled();
349 349
 
@@ -357,56 +357,56 @@  discard block
 block discarded – undo
357 357
 				});
358 358
 				</script>';
359 359
 
360
-				$html .= '<div id="nanogong_player_id" class="nanogong_player_container">';
361
-					$html .= '<div class="action_player">'.$actions.'</div>';
362
-					$html .= '<div class="nanogong_player">';
363
-						$html .= '<applet id="nanogong_player" archive="'.api_get_path(WEB_LIBRARY_PATH).'nanogong/nanogong.jar" code="gong.NanoGong" width="250" height="95" ALIGN="middle">';
364
-						$html .= '<param name="ShowRecordButton" value="false" />'; // default true
365
-						$html .= '<param name="ShowSaveButton" value="false" />'; //you can save in local computer | (default true)
366
-						//echo '<param name="ShowAudioLevel" value="false" />'; //  it displays the audiometer | (default true)
367
-						$html .= '<param name="ShowTime" value="true" />'; // default false
368
-						$html .= '<param name="Color" value="#FFFFFF" />';
360
+                $html .= '<div id="nanogong_player_id" class="nanogong_player_container">';
361
+                    $html .= '<div class="action_player">'.$actions.'</div>';
362
+                    $html .= '<div class="nanogong_player">';
363
+                        $html .= '<applet id="nanogong_player" archive="'.api_get_path(WEB_LIBRARY_PATH).'nanogong/nanogong.jar" code="gong.NanoGong" width="250" height="95" ALIGN="middle">';
364
+                        $html .= '<param name="ShowRecordButton" value="false" />'; // default true
365
+                        $html .= '<param name="ShowSaveButton" value="false" />'; //you can save in local computer | (default true)
366
+                        //echo '<param name="ShowAudioLevel" value="false" />'; //  it displays the audiometer | (default true)
367
+                        $html .= '<param name="ShowTime" value="true" />'; // default false
368
+                        $html .= '<param name="Color" value="#FFFFFF" />';
369 369
                         $html .= '<param name="ShowSpeedButton" value="false" />';
370
-						//echo '<param name="StartTime" value="10.5" />';
371
-						//echo '<param name="EndTime" value="65" />';
372
-						$html .= '<param name="AudioFormat" value="ImaADPCM" />';// ImaADPCM (more speed), Speex (more compression)|(default Speex)
373
-						//$html .= '<param name="AudioFormat" value="Speex" />';// ImaADPCM (more speed), Speex (more compression)|(default Speex)
374
-						//Quality for ImaADPCM (low 8000, medium 11025, normal 22050, hight 44100) OR Quality for Speex (low 8000, medium 16000, normal 32000, hight 44100) | (default 44100)
375
-						//echo '<param name="SamplingRate" value="32000" />';
376
-						//echo '<param name="MaxDuration" value="60" />';
377
-						$html .=  '<param name="SoundFileURL" value="'.$url.'" />';//load a file |(default "")
378
-						$html .= '</applet>';
379
-					$html .= '</div>';
380
-				$html .= '</div>';
370
+                        //echo '<param name="StartTime" value="10.5" />';
371
+                        //echo '<param name="EndTime" value="65" />';
372
+                        $html .= '<param name="AudioFormat" value="ImaADPCM" />';// ImaADPCM (more speed), Speex (more compression)|(default Speex)
373
+                        //$html .= '<param name="AudioFormat" value="Speex" />';// ImaADPCM (more speed), Speex (more compression)|(default Speex)
374
+                        //Quality for ImaADPCM (low 8000, medium 11025, normal 22050, hight 44100) OR Quality for Speex (low 8000, medium 16000, normal 32000, hight 44100) | (default 44100)
375
+                        //echo '<param name="SamplingRate" value="32000" />';
376
+                        //echo '<param name="MaxDuration" value="60" />';
377
+                        $html .=  '<param name="SoundFileURL" value="'.$url.'" />';//load a file |(default "")
378
+                        $html .= '</applet>';
379
+                    $html .= '</div>';
380
+                $html .= '</div>';
381 381
                 $html .= '<div id="nanogong_warning">'.Display::return_message(get_lang('BrowserDoesNotSupportNanogongPlayer'), 'warning').$download_button.'</div>';
382 382
 
383
-			} elseif(in_array($path_info['extension'],array('mp3', 'ogg','wav'))) {
384
-				$js_path = api_get_path(WEB_LIBRARY_PATH).'javascript/';
385
-				$html .= '<link rel="stylesheet" href="'.$js_path.'jquery-jplayer/skin/blue.monday/css/jplayer.blue.monday.css" type="text/css">';
386
-				$html .= '<script type="text/javascript" src="'.$js_path.'jquery-jplayer/jplayer/jquery.jplayer.min.js"></script>';
383
+            } elseif(in_array($path_info['extension'],array('mp3', 'ogg','wav'))) {
384
+                $js_path = api_get_path(WEB_LIBRARY_PATH).'javascript/';
385
+                $html .= '<link rel="stylesheet" href="'.$js_path.'jquery-jplayer/skin/blue.monday/css/jplayer.blue.monday.css" type="text/css">';
386
+                $html .= '<script type="text/javascript" src="'.$js_path.'jquery-jplayer/jplayer/jquery.jplayer.min.js"></script>';
387 387
 
388
-				$html .= '<div class="nanogong_player"></div>';
389
-				$html .= '<br /><div class="action_player">'.$actions.'</div><br /><br /><br />';
388
+                $html .= '<div class="nanogong_player"></div>';
389
+                $html .= '<br /><div class="action_player">'.$actions.'</div><br /><br /><br />';
390 390
 
391 391
                 $params = array(
392 392
                     'url' => $url,
393 393
                     'extension' =>$path_info['extension'],
394 394
                     'count'=> 1
395
-                 );
395
+                    );
396 396
                 $jquery = DocumentManager::generate_jplayer_jquery($params);
397
-				$html .= '<script>
397
+                $html .= '<script>
398 398
 				$(document).ready( function() {
399 399
 				    //Experimental changes to preview mp3, ogg files
400 400
 				     '.$jquery.'
401 401
 				});
402 402
 				</script>';
403
-				$html .= DocumentManager::generate_media_preview(1, 'advanced');
404
-			}
405
-		}
403
+                $html .= DocumentManager::generate_media_preview(1, 'advanced');
404
+            }
405
+        }
406 406
         return $html;
407
-	}
407
+    }
408 408
 
409
-	/*
409
+    /*
410 410
 	var filename = document.getElementById("audio_title").value+".wav";
411 411
 	var filename = filename.replace(/\s/g, "_");//replace spaces by _
412 412
 	var filename = encodeURIComponent(filename);
@@ -416,19 +416,19 @@  discard block
 block discarded – undo
416 416
 	var urlnanogong="'.$url.'?filename="+filename+"&filepath="+filepath+"&dir="+dir+"&course_code="+course_code;
417 417
 	*/
418 418
 
419
-	/**
420
-	 * Returns the nanogong javascript code
421
-	 * @return string
422
-	 */
419
+    /**
420
+     * Returns the nanogong javascript code
421
+     * @return string
422
+     */
423 423
     public function return_js()
424 424
     {
425
-		$params = $this->get_params(true);
426
-		$url = api_get_path(WEB_AJAX_PATH).'nanogong.ajax.php?a=save_file&'.$params.'&is_nano=1';
427
-		$url_load_file = api_get_path(WEB_AJAX_PATH).'nanogong.ajax.php?a=show_audio&'.$params;
425
+        $params = $this->get_params(true);
426
+        $url = api_get_path(WEB_AJAX_PATH).'nanogong.ajax.php?a=save_file&'.$params.'&is_nano=1';
427
+        $url_load_file = api_get_path(WEB_AJAX_PATH).'nanogong.ajax.php?a=show_audio&'.$params;
428 428
 
429
-		$url_delete = api_get_path(WEB_AJAX_PATH).'nanogong.ajax.php?a=delete&'.$params;
429
+        $url_delete = api_get_path(WEB_AJAX_PATH).'nanogong.ajax.php?a=delete&'.$params;
430 430
 
431
-		$js =  '<script language="javascript">
431
+        $js =  '<script language="javascript">
432 432
 
433 433
 			//lang vars
434 434
 
@@ -544,77 +544,77 @@  discard block
 block discarded – undo
544 544
 				return false;
545 545
 			}
546 546
 			</script>';
547
-		return $js;
548
-	}
547
+        return $js;
548
+    }
549 549
 
550
-	/**
551
-	 * Returns the HTML form to upload a nano file or upload a file
550
+    /**
551
+     * Returns the HTML form to upload a nano file or upload a file
552 552
      * @param string
553
-	 */
554
-	public function return_form($message = null)
553
+     */
554
+    public function return_form($message = null)
555 555
     {
556 556
 
557
-		$params = $this->get_params(true);
558
-		$url = api_get_path(WEB_AJAX_PATH).'nanogong.ajax.php?a=save_file&'.$params;
557
+        $params = $this->get_params(true);
558
+        $url = api_get_path(WEB_AJAX_PATH).'nanogong.ajax.php?a=save_file&'.$params;
559 559
 
560
-		//check browser support and load form
561
-		$array_browser = api_browser_support('check_browser');
560
+        //check browser support and load form
561
+        $array_browser = api_browser_support('check_browser');
562 562
 
563
-		$preview_file = $this->show_audio_file(true, true);
563
+        $preview_file = $this->show_audio_file(true, true);
564 564
 
565 565
         $preview_file = Display::div(
566 566
             $preview_file,
567 567
             array('id' => 'preview', 'style' => 'text-align:center; padding-left: 25px;')
568 568
         );
569 569
 
570
-		$html = '<center>';
570
+        $html = '<center>';
571 571
 
572
-		//Use normal upload file
573
-		$html .= Display::return_icon('microphone.png', get_lang('PressRecordButton'),'', ICON_SIZE_BIG);
574
-		$html .='<br />';
572
+        //Use normal upload file
573
+        $html .= Display::return_icon('microphone.png', get_lang('PressRecordButton'),'', ICON_SIZE_BIG);
574
+        $html .='<br />';
575 575
 
576
-		$html .= '<div id="nanogong_div">';
576
+        $html .= '<div id="nanogong_div">';
577 577
 
578
-		$html .= '<applet id="nanogong" archive="'.api_get_path(WEB_LIBRARY_PATH).'nanogong/nanogong.jar" code="gong.NanoGong" width="250" height="95" align="middle">';
579
-		//echo '<param name="ShowRecordButton" value="false" />'; // default true
580
-		// echo '<param name="ShowSaveButton" value="false" />'; //you can save in local computer | (default true)
578
+        $html .= '<applet id="nanogong" archive="'.api_get_path(WEB_LIBRARY_PATH).'nanogong/nanogong.jar" code="gong.NanoGong" width="250" height="95" align="middle">';
579
+        //echo '<param name="ShowRecordButton" value="false" />'; // default true
580
+        // echo '<param name="ShowSaveButton" value="false" />'; //you can save in local computer | (default true)
581 581
         $html .= '<param name="ShowSpeedButton" value="false" />'; // default true
582
-		//echo '<param name="ShowAudioLevel" value="false" />'; //  it displays the audiometer | (default true)
583
-		$html .= '<param name="ShowTime" value="true" />'; // default false
584
-		$html .= '<param name="Color" value="#FFFFFF" />'; // default #FFFFFF
585
-		//echo '<param name="StartTime" value="10.5" />';
586
-		//echo '<param name="EndTime" value="65" />';
587
-		$html .= '<param name="AudioFormat" value="ImaADPCM" />';// ImaADPCM (more speed), Speex (more compression)|(default Speex)
588
-		//$html .= '<param name="AudioFormat" value="Speex" />';// ImaADPCM (more speed), Speex (more compression)|(default Speex)
582
+        //echo '<param name="ShowAudioLevel" value="false" />'; //  it displays the audiometer | (default true)
583
+        $html .= '<param name="ShowTime" value="true" />'; // default false
584
+        $html .= '<param name="Color" value="#FFFFFF" />'; // default #FFFFFF
585
+        //echo '<param name="StartTime" value="10.5" />';
586
+        //echo '<param name="EndTime" value="65" />';
587
+        $html .= '<param name="AudioFormat" value="ImaADPCM" />';// ImaADPCM (more speed), Speex (more compression)|(default Speex)
588
+        //$html .= '<param name="AudioFormat" value="Speex" />';// ImaADPCM (more speed), Speex (more compression)|(default Speex)
589 589
 
590
-		//echo '<param name="SamplingRate" value="32000" />';//Quality for ImaADPCM (low 8000, medium 11025, normal 22050, hight 44100) OR Quality for Speex (low 8000, medium 16000, normal 32000, hight 44100) | (default 44100)
591
-		//echo '<param name="MaxDuration" value="60" />';
592
-		//echo '<param name="SoundFileURL" value="http://somewhere.com/mysoundfile.wav" />';//load a file |(default "")
593
-		$html .= '</applet>';
590
+        //echo '<param name="SamplingRate" value="32000" />';//Quality for ImaADPCM (low 8000, medium 11025, normal 22050, hight 44100) OR Quality for Speex (low 8000, medium 16000, normal 32000, hight 44100) | (default 44100)
591
+        //echo '<param name="MaxDuration" value="60" />';
592
+        //echo '<param name="SoundFileURL" value="http://somewhere.com/mysoundfile.wav" />';//load a file |(default "")
593
+        $html .= '</applet>';
594 594
 
595
-		$html .= '<br /><br /><br />';
595
+        $html .= '<br /><br /><br />';
596 596
 
597 597
         $html .= '<form name="form_nanogong_advanced">';
598
-		$html .= '<input type="hidden" name="is_nano" value="1">';
599
-		$html .= '<a href="#" class="btn btn-default"  onclick="send_voice()" />'.get_lang('SendRecord').'</a>';
600
-		$html .= '</form></div>';
598
+        $html .= '<input type="hidden" name="is_nano" value="1">';
599
+        $html .= '<a href="#" class="btn btn-default"  onclick="send_voice()" />'.get_lang('SendRecord').'</a>';
600
+        $html .= '</form></div>';
601 601
 
602 602
         $html .= Display::url(get_lang('ProblemsRecordingUploadYourOwnAudioFile'), 'javascript:void(0)', array('onclick' => 'show_simple_upload_form();'));
603 603
 
604
-		$html .= '<br /><br /><div id="no_nanogong_div">';
605
-		//$html .= Display::return_message(get_lang('BrowserNotSupportNanogongSend'), 'warning');
606
-		$html .= '<form id="form_nanogong_simple" class="form-search" action="'.$url.'" name="form_nanogong" method="POST" enctype="multipart/form-data">';
607
-		$html .= '<input type="file" name="file">';
608
-		$html .= '<a href="#" class="btn btn-default"  onclick="upload_file()" /><em class="fa fa-upload"></em> '.get_lang('UploadFile').'</a>';
609
-		$html .= '</form>';
604
+        $html .= '<br /><br /><div id="no_nanogong_div">';
605
+        //$html .= Display::return_message(get_lang('BrowserNotSupportNanogongSend'), 'warning');
606
+        $html .= '<form id="form_nanogong_simple" class="form-search" action="'.$url.'" name="form_nanogong" method="POST" enctype="multipart/form-data">';
607
+        $html .= '<input type="file" name="file">';
608
+        $html .= '<a href="#" class="btn btn-default"  onclick="upload_file()" /><em class="fa fa-upload"></em> '.get_lang('UploadFile').'</a>';
609
+        $html .= '</form>';
610 610
         $html .= '</div>';
611
-		$html .= '</center>';
612
-		$html .= '<div style="display:none" id="status_ok" class="confirmation-message"></div><div style="display:none" id="status_warning" class="warning-message"></div>';
613
-		$html .= '<div id="messages">'.$message.'</div>';
614
-		$html .= $preview_file;
611
+        $html .= '</center>';
612
+        $html .= '<div style="display:none" id="status_ok" class="confirmation-message"></div><div style="display:none" id="status_warning" class="warning-message"></div>';
613
+        $html .= '<div id="messages">'.$message.'</div>';
614
+        $html .= $preview_file;
615 615
 
616
-		return $html;
617
-	}
616
+        return $html;
617
+    }
618 618
 
619 619
     /**
620 620
      * @param bool $return_as_query
@@ -622,15 +622,15 @@  discard block
 block discarded – undo
622 622
      */
623 623
     public function get_params($return_as_query = false)
624 624
     {
625
-		if (empty($this->params)) {
626
-			return false;
627
-		}
628
-		if ($return_as_query) {
629
-			return http_build_query($this->params);
630
-		}
625
+        if (empty($this->params)) {
626
+            return false;
627
+        }
628
+        if ($return_as_query) {
629
+            return http_build_query($this->params);
630
+        }
631 631
 
632
-		return $this->params;
633
-	}
632
+        return $this->params;
633
+    }
634 634
 
635 635
     /**
636 636
      * @param $attribute
@@ -638,18 +638,18 @@  discard block
 block discarded – undo
638 638
      */
639 639
     public function get_param_value($attribute)
640 640
     {
641
-		if (isset($this->params[$attribute])) {
642
-			return $this->params[$attribute];
643
-		}
644
-	}
645
-
646
-	/**
647
-	 * Show a button to load the form
648
-	 * @return string
649
-	 */
641
+        if (isset($this->params[$attribute])) {
642
+            return $this->params[$attribute];
643
+        }
644
+    }
645
+
646
+    /**
647
+     * Show a button to load the form
648
+     * @return string
649
+     */
650 650
     public function show_button()
651 651
     {
652
-		$params_string = $this->get_params(true);
652
+        $params_string = $this->get_params(true);
653 653
 
654 654
         $url = api_get_path(WEB_AJAX_PATH)
655 655
             . 'nanogong.ajax.php?a=show_form&'
@@ -664,7 +664,7 @@  discard block
 block discarded – undo
664 664
                 'data-title' => get_lang('RecordAnswer')
665 665
             ]
666 666
         );
667
-		$html .= '<br /><br />'.Display::return_message(get_lang('UseTheMessageBelowToAddSomeComments'));
668
-		return $html;
669
-	}
667
+        $html .= '<br /><br />'.Display::return_message(get_lang('UseTheMessageBelowToAddSomeComments'));
668
+        return $html;
669
+    }
670 670
 }
Please login to merge, or discard this patch.
main/inc/lib/statsUtils.lib.inc.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -107,14 +107,14 @@
 block discarded – undo
107 107
         return $resu;
108 108
     }
109 109
 
110
-	/**
111
-	 * @author Sebastien Piraux <[email protected]>
112
-	 * @param sql : a sql query (as a string)
113
-	 * @return hours_array
114
-	 * @desc        Return an assoc array.  Keys are the hours, values are
115
-	 * the number of time this hours was found.
116
-	 * key 'total' return the sum of all number of time hours
117
-	 * appear
110
+    /**
111
+     * @author Sebastien Piraux <[email protected]>
112
+     * @param sql : a sql query (as a string)
113
+     * @return hours_array
114
+     * @desc        Return an assoc array.  Keys are the hours, values are
115
+     * the number of time this hours was found.
116
+     * key 'total' return the sum of all number of time hours
117
+     * appear
118 118
      */
119 119
     public static function hoursTab($sql)
120 120
     {
Please login to merge, or discard this patch.
main/inc/lib/rights.lib.php 1 patch
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -5,42 +5,42 @@
 block discarded – undo
5 5
  * @deprecated Don't use this class
6 6
  */
7 7
 class Rights {
8
-	private static $rights_cache = array();
9
-	private static $rights = array (
10
-		'show_tabs:reports' =>
11
-			array (
12
-				'type' => 'const',
13
-				'const' => 'true' )
14
-		);
8
+    private static $rights_cache = array();
9
+    private static $rights = array (
10
+        'show_tabs:reports' =>
11
+            array (
12
+                'type' => 'const',
13
+                'const' => 'true' )
14
+        );
15 15
 
16
-	// warning the goal of this function is to enforce rights managment in Chamilo
17
-	// thus default return value is always true
18
-	public static function hasRight($handler) {
19
-		if (array_key_exists($handler, self::$rights_cache))
20
-			return self::$rights_cache[$handler];
16
+    // warning the goal of this function is to enforce rights managment in Chamilo
17
+    // thus default return value is always true
18
+    public static function hasRight($handler) {
19
+        if (array_key_exists($handler, self::$rights_cache))
20
+            return self::$rights_cache[$handler];
21 21
 
22
-		if (!array_key_exists($handler, self::$rights))
23
-			return true; // handler does not exists
22
+        if (!array_key_exists($handler, self::$rights))
23
+            return true; // handler does not exists
24 24
 
25
-		if (self::$rights[$handler]['type'] == 'sql') {
26
-			$result = Database::query(self::$rights[$handler]['sql']);
27
-			if (Database::num_rows($result) > 0)
28
-				$result = true;
29
-			else
30
-				$result = false;
31
-		} else if (self::$rights[$handler]['type'] == 'const')
32
-			$result = self::$rights[$handler]['const'];
33
-		else if (self::$rights[$handler]['type'] == 'func')
34
-			$result = self::$rights[$handler]['func']();
35
-		else // handler type not implemented
36
-			return true;
37
-		self::$rights_cache[$handler] = $result;
38
-		return $result;
39
-	}
25
+        if (self::$rights[$handler]['type'] == 'sql') {
26
+            $result = Database::query(self::$rights[$handler]['sql']);
27
+            if (Database::num_rows($result) > 0)
28
+                $result = true;
29
+            else
30
+                $result = false;
31
+        } else if (self::$rights[$handler]['type'] == 'const')
32
+            $result = self::$rights[$handler]['const'];
33
+        else if (self::$rights[$handler]['type'] == 'func')
34
+            $result = self::$rights[$handler]['func']();
35
+        else // handler type not implemented
36
+            return true;
37
+        self::$rights_cache[$handler] = $result;
38
+        return $result;
39
+    }
40 40
 
41
-	public static function hasRightClosePageWithError($handler) {
42
-		if (hasRight($handler) == false)
43
-			die("You are not allowed here"); //FIXME
44
-	}
41
+    public static function hasRightClosePageWithError($handler) {
42
+        if (hasRight($handler) == false)
43
+            die("You are not allowed here"); //FIXME
44
+    }
45 45
 
46 46
 }
Please login to merge, or discard this patch.
main/inc/lib/plugin.lib.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -173,9 +173,9 @@  discard block
 block discarded – undo
173 173
     }
174 174
 
175 175
     /**
176
-    * @param string $pluginName
177
-    * @param int    $urlId
178
-    */
176
+     * @param string $pluginName
177
+     * @param int    $urlId
178
+     */
179 179
     public function uninstall($pluginName, $urlId = null)
180 180
     {
181 181
         if (empty($urlId)) {
@@ -252,12 +252,12 @@  discard block
 block discarded – undo
252 252
     }
253 253
 
254 254
     /**
255
-    * @param string $region
256
-    * @param string $template
257
-    * @param bool   $forced
258
-    *
259
-    * @return null|string
260
-    */
255
+     * @param string $region
256
+     * @param string $template
257
+     * @param bool   $forced
258
+     *
259
+     * @return null|string
260
+     */
261 261
     public function load_region($region, $template, $forced = false)
262 262
     {
263 263
         if ($region == 'course_tool_plugin') {
Please login to merge, or discard this patch.
main/inc/lib/phpseclib/Crypt/Random.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -167,9 +167,9 @@
 block discarded – undo
167 167
             ini_set('session.use_cookies', $old_use_cookies);
168 168
             session_cache_limiter($old_session_cache_limiter);
169 169
         } else {
170
-           if (isset($_OLD_SESSION)) {
171
-               $_SESSION = $_OLD_SESSION;
172
-               unset($_OLD_SESSION);
170
+            if (isset($_OLD_SESSION)) {
171
+                $_SESSION = $_OLD_SESSION;
172
+                unset($_OLD_SESSION);
173 173
             } else {
174 174
                 unset($_SESSION);
175 175
             }
Please login to merge, or discard this patch.