Passed
Push — 1.10.x ( b65d66...f75118 )
by
unknown
51:21
created
main/inc/lib/api.lib.php 1 patch
Doc Comments   +52 added lines, -25 removed lines patch added patch discarded remove patch
@@ -575,7 +575,6 @@  discard block
 block discarded – undo
575 575
  * Also, this function provides conversion between path types, in this case the input path points inside the Chamilo area too.
576 576
  *
577 577
  * See $_configuration['course_folder'] in the configuration.php to alter the WEB_COURSE_PATH and SYS_COURSE_PATH parameters.
578
- * @param string $type              The requested path type (a defined constant), see the examples.
579 578
  * @param string $path (optional)   A path which type is to be converted. Also, it may be a defined constant for a path.
580 579
  * This parameter has meaning when $type parameter has one of the following values: TO_WEB, TO_SYS, TO_REL. Otherwise it is ignored.
581 580
  * @return string                   The requested path or the converted path.
@@ -1070,7 +1069,7 @@  discard block
 block discarded – undo
1070 1069
  * Checks the RFC 3986 syntax of a given URL.
1071 1070
  * @param string $url       The URL to be checked.
1072 1071
  * @param bool $absolute    Whether the URL is absolute (beginning with a scheme such as "http:").
1073
- * @return bool             Returns the URL if it is valid, FALSE otherwise.
1072
+ * @return string|false             Returns the URL if it is valid, FALSE otherwise.
1074 1073
  * This function is an adaptation from the function valid_url(), Drupal CMS.
1075 1074
  * @link http://drupal.org
1076 1075
  * Note: The built-in function filter_var($urs, FILTER_VALIDATE_URL) has a bug for some versions of PHP.
@@ -1650,6 +1649,7 @@  discard block
 block discarded – undo
1650 1649
  * Gets a course setting from the current course_setting table. Try always using integer values.
1651 1650
  * @param string    The name of the setting we want from the table
1652 1651
  * @param string    Optional: course code
1652
+ * @param string $setting_name
1653 1653
  * @return mixed    The value of that setting in that table. Return -1 if not found.
1654 1654
  */
1655 1655
 function api_get_course_setting($setting_name, $course_code = null)
@@ -1957,7 +1957,7 @@  discard block
 block discarded – undo
1957 1957
 /**
1958 1958
  * Checks a password to see wether it is OK to use.
1959 1959
  * @param string $password
1960
- * @return true if the password is acceptable, false otherwise
1960
+ * @return boolean if the password is acceptable, false otherwise
1961 1961
  * Notes about what a password "OK to use" is:
1962 1962
  * 1. The password should be at least 5 characters long.
1963 1963
  * 2. Only English letters (uppercase or lowercase, it doesn't matter) and digits are allowed.
@@ -2129,7 +2129,7 @@  discard block
 block discarded – undo
2129 2129
      * @author Hugues Peeters <[email protected]>
2130 2130
      * @param  string $failure_type - the type of failure
2131 2131
      * @global array  $api_failureList
2132
-     * @return bolean false to stay consistent with the main script
2132
+     * @return boolean false to stay consistent with the main script
2133 2133
      */
2134 2134
     static function set_failure($failure_type) {
2135 2135
         global $api_failureList;
@@ -3196,8 +3196,8 @@  discard block
 block discarded – undo
3196 3196
 
3197 3197
 /**
3198 3198
 * Checks whether the user is allowed in a specific tool for a specific action
3199
-* @param $tool the tool we are checking if the user has a certain permission
3200
-* @param $action the action we are checking (add, edit, delete, move, visibility)
3199
+* @param string $tool the tool we are checking if the user has a certain permission
3200
+* @param string $action the action we are checking (add, edit, delete, move, visibility)
3201 3201
 * @author Patrick Cool <[email protected]>, Ghent University
3202 3202
 * @author Julio Montoya
3203 3203
 * @version 1.0
@@ -3496,7 +3496,7 @@  discard block
 block discarded – undo
3496 3496
 /**
3497 3497
  * Gets a UNIX timestamp from a database (MySQL) datetime format string
3498 3498
  * @param $last_post_datetime standard output date in a sql query
3499
- * @return unix timestamp
3499
+ * @return integer timestamp
3500 3500
  * @author Toon Van Hoecke <[email protected]>
3501 3501
  * @version October 2003
3502 3502
  * @desc convert sql date to unix timestamp
@@ -3529,6 +3529,9 @@  discard block
 block discarded – undo
3529 3529
  * @param string    Tool (learnpath, document, etc)
3530 3530
  * @param int       The item ID in the given tool
3531 3531
  * @param int       The session ID (optional)
3532
+ * @param string $tool
3533
+ * @param integer $user_id
3534
+ * @param string $type
3532 3535
  * @return int      -1 on error, 0 if invisible, 1 if visible
3533 3536
  */
3534 3537
 function api_get_item_visibility(
@@ -3597,7 +3600,7 @@  discard block
 block discarded – undo
3597 3600
  * @param int $userId
3598 3601
  * @param int $groupId
3599 3602
  * @param int $sessionId
3600
- * @return void
3603
+ * @return false|null
3601 3604
  */
3602 3605
 function api_item_property_delete(
3603 3606
     $courseInfo,
@@ -3652,7 +3655,7 @@  discard block
 block discarded – undo
3652 3655
  * @param array $_course array with course properties
3653 3656
  * @param string $tool tool id, linked to 'rubrique' of the course tool_list (Warning: language sensitive !!)
3654 3657
  * @param int $item_id id of the item itself, linked to key of every tool ('id', ...), "*" = all items of the tool
3655
- * @param string $lastedit_type add or update action
3658
+ * @param string $last_edit_type add or update action
3656 3659
  * (1) message to be translated (in trad4all) : e.g. DocumentAdded, DocumentUpdated;
3657 3660
  * (2) "delete"
3658 3661
  * (3) "visible"
@@ -3935,6 +3938,8 @@  discard block
 block discarded – undo
3935 3938
  * @param string    tool name, linked to 'rubrique' of the course tool_list (Warning: language sensitive !!)
3936 3939
  * @param int       id of the item itself, linked to key of every tool ('id', ...), "*" = all items of the tool
3937 3940
  * @param int $session_id
3941
+ * @param string $tool
3942
+ * @param string $course_code
3938 3943
  * @return array All fields from c_item_property (all rows found) or empty array
3939 3944
  */
3940 3945
 function api_get_item_property_by_tool($tool, $course_code, $session_id = null)
@@ -4197,7 +4202,7 @@  discard block
 block discarded – undo
4197 4202
  * Displays a form (drop down menu) so the user can select his/her preferred language.
4198 4203
  * The form works with or without javascript
4199 4204
  * @param  boolean Hide form if only one language available (defaults to false = show the box anyway)
4200
- * @return void Display the box directly
4205
+ * @return null|string Display the box directly
4201 4206
  */
4202 4207
 function api_display_language_form($hide_if_no_choice = false)
4203 4208
 {
@@ -4477,6 +4482,7 @@  discard block
 block discarded – undo
4477 4482
  * and also when a user subscribes to courses (the new course is added at the end of the main category
4478 4483
  * @author Patrick Cool <[email protected]>, Ghent University
4479 4484
  * @param int $user_course_category: the id of the user_course_category
4485
+ * @param integer $user_id
4480 4486
  * @return int the value of the highest sort of the user_course_category
4481 4487
  */
4482 4488
 function api_max_sort_value($user_course_category, $user_id)
@@ -4685,6 +4691,8 @@  discard block
 block discarded – undo
4685 4691
  * @param the dest folder
4686 4692
  * @param an array of excluded file_name (without extension)
4687 4693
  * @param copied_files the returned array of copied files
4694
+ * @param string $source
4695
+ * @param string $dest
4688 4696
  */
4689 4697
 function copyr($source, $dest, $exclude = array(), $copied_files = array()) {
4690 4698
     if (empty($dest)) { return false; }
@@ -4724,6 +4732,11 @@  discard block
 block discarded – undo
4724 4732
 }
4725 4733
 
4726 4734
 // TODO: Using DIRECTORY_SEPARATOR is not recommended, this is an obsolete approach. Documentation header to be added here.
4735
+/**
4736
+ * @param string $pathname
4737
+ * @param string $base_path_document
4738
+ * @param integer $session_id
4739
+ */
4727 4740
 function copy_folder_course_session(
4728 4741
     $pathname,
4729 4742
     $base_path_document,
@@ -4809,6 +4822,9 @@  discard block
 block discarded – undo
4809 4822
 }
4810 4823
 
4811 4824
 // TODO: chmodr() is a better name. Some corrections are needed. Documentation header to be added here.
4825
+/**
4826
+ * @param string $path
4827
+ */
4812 4828
 function api_chmod_R($path, $filemode) {
4813 4829
     if (!is_dir($path)) {
4814 4830
         return chmod($path, $filemode);
@@ -4891,7 +4907,7 @@  discard block
 block discarded – undo
4891 4907
  *   version = VERSION
4892 4908
  * @endverbatim
4893 4909
  * </code>
4894
- * @param $filename
4910
+ * @param string $filename
4895 4911
  *   The file we are parsing. Accepts file with relative or absolute path.
4896 4912
  * @return
4897 4913
  *   The info array.
@@ -4983,7 +4999,7 @@  discard block
 block discarded – undo
4983 4999
 /**
4984 5000
  * Checks whether status given in parameter exists in the platform
4985 5001
  * @param mixed the status (can be either int either string)
4986
- * @return true if the status exists, else returns false
5002
+ * @return boolean if the status exists, else returns false
4987 5003
  */
4988 5004
 function api_status_exists($status_asked) {
4989 5005
     global $_status_list;
@@ -5005,7 +5021,7 @@  discard block
 block discarded – undo
5005 5021
 
5006 5022
 /**
5007 5023
  * Gets the status langvars list
5008
- * @return array the list of status with their translations
5024
+ * @return string[] the list of status with their translations
5009 5025
  */
5010 5026
 function api_get_status_langvars() {
5011 5027
     return array(
@@ -5081,6 +5097,7 @@  discard block
 block discarded – undo
5081 5097
  * @param string    The sub-variable if any (in most cases, this will remain null)
5082 5098
  * @param string    The category if any (in most cases, this will remain null)
5083 5099
  * @param int       The access_url for which this parameter is valid
5100
+ * @param string $cat
5084 5101
  */
5085 5102
 function api_set_setting($var, $value, $subvar = null, $cat = null, $access_url = 1)
5086 5103
 {
@@ -5178,6 +5195,8 @@  discard block
 block discarded – undo
5178 5195
  * @param string    Value
5179 5196
  * @param int       Access URL. Optional. Defaults to 1
5180 5197
  * @param array     Optional array of filters on field type
5198
+ * @param string $category
5199
+ * @param string $value
5181 5200
  */
5182 5201
 function api_set_settings_category($category, $value = null, $access_url = 1, $fieldtype = array())
5183 5202
 {
@@ -5421,6 +5440,10 @@  discard block
 block discarded – undo
5421 5440
  * @param string    The subkey text
5422 5441
  * @param int       The access_url for which this parameter is valid
5423 5442
  * @param int       The changeability of this setting for non-master urls
5443
+ * @param string $val
5444
+ * @param string $var
5445
+ * @param string $sk
5446
+ * @param string $c
5424 5447
  * @return boolean  true on success, false on failure
5425 5448
  */
5426 5449
 function api_add_setting($val, $var, $sk = null, $type = 'textfield', $c = null, $title = '', $com = '', $sc = null, $skt = null, $a = 1, $v = 0) {
@@ -5686,6 +5709,7 @@  discard block
 block discarded – undo
5686 5709
  * @param String the tool of the element
5687 5710
  * @param int the element id in database
5688 5711
  * @param int the session_id to compare with element session id
5712
+ * @param string $tool
5689 5713
  * @return boolean true if the element is in the session, false else
5690 5714
  */
5691 5715
 function api_is_element_in_the_session($tool, $element_id, $session_id = null) {
@@ -5731,8 +5755,6 @@  discard block
 block discarded – undo
5731 5755
  * Replaces "forbidden" characters in a filename string.
5732 5756
  *
5733 5757
  * @param string $filename
5734
- * @param int $length
5735
- * @param bool $file_name
5736 5758
  *
5737 5759
  * @return string
5738 5760
  */
@@ -5968,6 +5990,7 @@  discard block
 block discarded – undo
5968 5990
  * @link http://php.net/manual/en/function.getimagesize.php
5969 5991
  * @link http://www.dokeos.com/forum/viewtopic.php?t=12345
5970 5992
  * @link http://www.dokeos.com/forum/viewtopic.php?t=16355
5993
+ * @return integer
5971 5994
  */
5972 5995
 function api_getimagesize($path) {
5973 5996
     $image = new Image($path);
@@ -6128,6 +6151,7 @@  discard block
 block discarded – undo
6128 6151
  * with his user id and the access_url_id=1
6129 6152
  *
6130 6153
  * @author Julio Montoya
6154
+ * @param integer $user_id
6131 6155
  */
6132 6156
 function api_is_global_platform_admin($user_id = null)
6133 6157
 {
@@ -6189,7 +6213,7 @@  discard block
 block discarded – undo
6189 6213
  * @param int $admin_id_to_check
6190 6214
  * @param int  $my_user_id
6191 6215
  * @param bool $allow_session_admin
6192
- * @return bool
6216
+ * @return boolean|null
6193 6217
  */
6194 6218
 function api_protect_super_admin($admin_id_to_check, $my_user_id = null, $allow_session_admin = false)
6195 6219
 {
@@ -6431,6 +6455,7 @@  discard block
 block discarded – undo
6431 6455
 
6432 6456
 /**
6433 6457
  * Returns the <link> HTML tag
6458
+ * @param string $file
6434 6459
  */
6435 6460
 function api_get_css($file, $media = 'screen') {
6436 6461
     return '<link href="'.$file.'" rel="stylesheet" media="'.$media.'" type="text/css" />'."\n";
@@ -6568,7 +6593,8 @@  discard block
 block discarded – undo
6568 6593
  * This function relies on api_get_course_info()
6569 6594
  * @param   string  The course code - optional (takes it from session if not given)
6570 6595
  * @param   int     The session id  - optional (takes it from session if not given)
6571
- * @return  mixed   The URL of the course or null if something does not work
6596
+ * @param integer $session_id
6597
+ * @return  string|null   The URL of the course or null if something does not work
6572 6598
  * @author  Julio Montoya <[email protected]>
6573 6599
  */
6574 6600
 function api_get_course_url($course_code = null, $session_id = null)
@@ -6683,7 +6709,7 @@  discard block
 block discarded – undo
6683 6709
  * @param int       LINK_EXERCISE, LINK_STUDENTPUBLICATION, LINK_LEARNPATH LINK_FORUM_THREAD, LINK_ATTENDANCE
6684 6710
  * see gradebook/lib/be/linkfactory
6685 6711
  * @param string    course code
6686
- * @return boolean
6712
+ * @return false|null
6687 6713
  */
6688 6714
 function api_block_course_item_locked_by_gradebook($item_id, $link_type, $course_code = null) {
6689 6715
     if (api_is_platform_admin()) {
@@ -6724,7 +6750,7 @@  discard block
 block discarded – undo
6724 6750
 /**
6725 6751
  * Returns an array of global configuration settings which should be ignored
6726 6752
  * when printing the configuration settings screens
6727
- * @return array Array of strings, each identifying one of the excluded settings
6753
+ * @return string[] Array of strings, each identifying one of the excluded settings
6728 6754
  */
6729 6755
 function api_get_locked_settings() {
6730 6756
     return array(
@@ -6767,7 +6793,7 @@  discard block
 block discarded – undo
6767 6793
  * false if he isn't. If the user ID is given and is an integer, then the same
6768 6794
  * ID is simply returned
6769 6795
  * @param  integer User ID
6770
- * @return mixed Integer User ID is logged in, or false otherwise
6796
+ * @return boolean Integer User ID is logged in, or false otherwise
6771 6797
  */
6772 6798
 function api_user_is_login($user_id = null) {
6773 6799
     $user_id = empty($user_id) ? api_get_user_id() : intval($user_id);
@@ -6802,6 +6828,7 @@  discard block
 block discarded – undo
6802 6828
  * Checks whether an IP is included inside an IP range
6803 6829
  * @param string IP address
6804 6830
  * @param string IP range
6831
+ * @param string $ip
6805 6832
  * @return bool True if IP is in the range, false otherwise
6806 6833
  * @author claudiu at cnixs dot com  on http://www.php.net/manual/fr/ref.network.php#55230
6807 6834
  * @author Yannick Warnier for improvements and managment of multiple ranges
@@ -7185,6 +7212,7 @@  discard block
 block discarded – undo
7185 7212
 /**
7186 7213
  * Tries to set memory limit, if authorized and new limit is higher than current
7187 7214
  * @param string New memory limit
7215
+ * @param string $mem
7188 7216
  * @return bool True on success, false on failure or current is higher than suggested
7189 7217
  * @assert (null) === false
7190 7218
  * @assert (-1) === false
@@ -7241,7 +7269,6 @@  discard block
 block discarded – undo
7241 7269
 
7242 7270
 /**
7243 7271
  * Finds all the information about a user from username instead of user id
7244
- * @param string $username
7245 7272
  *
7246 7273
  * @return array $user_info user_id, lastname, firstname, username, email, ...
7247 7274
  * @author Yannick Warnier <[email protected]>
@@ -7263,7 +7290,6 @@  discard block
 block discarded – undo
7263 7290
 
7264 7291
 /**
7265 7292
  *
7266
- * @param string $inputId the jquery id example: #password
7267 7293
  *
7268 7294
  * @return string
7269 7295
  */
@@ -7388,6 +7414,7 @@  discard block
 block discarded – undo
7388 7414
 /**
7389 7415
  * Remove tags from HTML anf return the $in_number_char first non-HTML char
7390 7416
  * Postfix the text with "..." if it has been truncated.
7417
+ * @param integer $in_number_char
7391 7418
  * @return string
7392 7419
  * @author hubert borderiou
7393 7420
  */
@@ -7432,7 +7459,7 @@  discard block
 block discarded – undo
7432 7459
 /**
7433 7460
  * @param string $tool
7434 7461
  * @param string $setting
7435
- * @param mixed $defaultValue
7462
+ * @param integer $defaultValue
7436 7463
  * @return string
7437 7464
  */
7438 7465
 function api_get_default_tool_setting($tool, $setting, $defaultValue)
@@ -7557,7 +7584,7 @@  discard block
 block discarded – undo
7557 7584
 }
7558 7585
 
7559 7586
 /**
7560
- * @return true if course_code for direct course access after login is set
7587
+ * @return boolean if course_code for direct course access after login is set
7561 7588
  */
7562 7589
 function exist_firstpage_parameter()
7563 7590
 {
@@ -7849,7 +7876,7 @@  discard block
 block discarded – undo
7849 7876
  * @param array     data file (path and filename)
7850 7877
  * @param array     data to attach a file (optional)
7851 7878
  * @param bool      True for attaching a embedded file inside content html (optional)
7852
- * @return          returns true if mail was sent
7879
+ * @return          integer true if mail was sent
7853 7880
  * @see             class.phpmailer.php
7854 7881
  */
7855 7882
 function api_mail_html(
Please login to merge, or discard this patch.
main/document/edit_draw.php 2 patches
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 //path for svg-edit save
39 39
 $_SESSION['draw_dir']=Security::remove_XSS($dir);
40 40
 if ($_SESSION['draw_dir']=='/'){
41
-	$_SESSION['draw_dir'] = '';
41
+    $_SESSION['draw_dir'] = '';
42 42
 }
43 43
 $_SESSION['draw_file']=basename(Security::remove_XSS($file_path));
44 44
 $get_file = Security::remove_XSS($file_path);
@@ -55,42 +55,42 @@  discard block
 block discarded – undo
55 55
 /* Please, do not modify this dirname formatting */
56 56
 
57 57
 if (strstr($dir, '..')) {
58
-	$dir = '/';
58
+    $dir = '/';
59 59
 }
60 60
 
61 61
 if ($dir[0] == '.') {
62
-	$dir = substr($dir, 1);
62
+    $dir = substr($dir, 1);
63 63
 }
64 64
 
65 65
 if ($dir[0] != '/') {
66
-	$dir = '/'.$dir;
66
+    $dir = '/'.$dir;
67 67
 }
68 68
 
69 69
 if ($dir[strlen($dir) - 1] != '/') {
70
-	$dir .= '/';
70
+    $dir .= '/';
71 71
 }
72 72
 
73 73
 $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'.$dir;
74 74
 
75 75
 if (!is_dir($filepath)) {
76
-	$filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/';
77
-	$dir = '/';
76
+    $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/';
77
+    $dir = '/';
78 78
 }
79 79
 
80 80
 //groups //TODO:clean
81 81
 if (!empty($group_id)) {
82
-	$req_gid = '&amp;gidReq='.$group_id;
83
-	$interbreadcrumb[] = array ('url' => api_get_path(WEB_CODE_PATH).'group/group_space.php?gidReq='.$group_id, 'name' => get_lang('GroupSpace'));
84
-	$group_document = true;
85
-	$noPHP_SELF = true;
82
+    $req_gid = '&amp;gidReq='.$group_id;
83
+    $interbreadcrumb[] = array ('url' => api_get_path(WEB_CODE_PATH).'group/group_space.php?gidReq='.$group_id, 'name' => get_lang('GroupSpace'));
84
+    $group_document = true;
85
+    $noPHP_SELF = true;
86 86
 }
87 87
 
88 88
 $is_certificate_mode = DocumentManager::is_certificate_mode($dir);
89 89
 
90 90
 if (!$is_certificate_mode)
91
-	$interbreadcrumb[]= array("url" => "./document.php?curdirpath=".urlencode($my_cur_dir_path).$req_gid, "name"=> get_lang('Documents'));
91
+    $interbreadcrumb[]= array("url" => "./document.php?curdirpath=".urlencode($my_cur_dir_path).$req_gid, "name"=> get_lang('Documents'));
92 92
 else
93
-	$interbreadcrumb[]= array ('url' => '../gradebook/'.$_SESSION['gradebook_dest'], 'name' => get_lang('Gradebook'));
93
+    $interbreadcrumb[]= array ('url' => '../gradebook/'.$_SESSION['gradebook_dest'], 'name' => get_lang('Gradebook'));
94 94
 
95 95
 // Interbreadcrumb for the current directory root path
96 96
 if (empty($document_data['parents'])) {
@@ -105,30 +105,30 @@  discard block
 block discarded – undo
105 105
 }
106 106
 
107 107
 $is_allowedToEdit = api_is_allowed_to_edit(null, true) || $_SESSION['group_member_with_upload_rights'] ||
108
-	DocumentManager::is_my_shared_folder(api_get_user_id(), $dir, $current_session_id);
108
+    DocumentManager::is_my_shared_folder(api_get_user_id(), $dir, $current_session_id);
109 109
 
110 110
 if (!$is_allowedToEdit) {
111
-	api_not_allowed(true);
111
+    api_not_allowed(true);
112 112
 }
113 113
 
114 114
 Event::event_access_tool(TOOL_DOCUMENT);
115 115
 
116 116
 Display :: display_header($nameTools, 'Doc');
117 117
 echo '<div class="actions">';
118
-		echo '<a href="document.php?id='.$parent_id.'">'.Display::return_icon('back.png',get_lang('BackTo').' '.get_lang('DocumentsOverview'),'',ICON_SIZE_MEDIUM).'</a>';
119
-		echo '<a href="edit_document.php?'.api_get_cidreq().'&id='.$document_id.$req_gid.'&origin=editdraw">'.Display::return_icon('edit.png',get_lang('Rename').'/'.get_lang('Comments'),'',ICON_SIZE_MEDIUM).'</a>';
118
+        echo '<a href="document.php?id='.$parent_id.'">'.Display::return_icon('back.png',get_lang('BackTo').' '.get_lang('DocumentsOverview'),'',ICON_SIZE_MEDIUM).'</a>';
119
+        echo '<a href="edit_document.php?'.api_get_cidreq().'&id='.$document_id.$req_gid.'&origin=editdraw">'.Display::return_icon('edit.png',get_lang('Rename').'/'.get_lang('Comments'),'',ICON_SIZE_MEDIUM).'</a>';
120 120
 echo '</div>';
121 121
 
122 122
 if (api_browser_support('svg')) {
123
-	//automatic loading the course language
124
-	$svgedit_code_translation_table = array('' => 'en', 'pt' => 'pt-Pt', 'sr' => 'sr_latn');
125
-	$langsvgedit  = api_get_language_isocode();
126
-	$langsvgedit = isset($svgedit_code_translation_table[$langsvgedit]) ? $svgedit_code_translation_table[$langsvgedit] : $langsvgedit;
127
-	$langsvgedit = file_exists(api_get_path(LIBRARY_PATH).'svg-edit/locale/lang.'.$langsvgedit.'.js') ? $langsvgedit : 'en';
123
+    //automatic loading the course language
124
+    $svgedit_code_translation_table = array('' => 'en', 'pt' => 'pt-Pt', 'sr' => 'sr_latn');
125
+    $langsvgedit  = api_get_language_isocode();
126
+    $langsvgedit = isset($svgedit_code_translation_table[$langsvgedit]) ? $svgedit_code_translation_table[$langsvgedit] : $langsvgedit;
127
+    $langsvgedit = file_exists(api_get_path(LIBRARY_PATH).'svg-edit/locale/lang.'.$langsvgedit.'.js') ? $langsvgedit : 'en';
128 128
 
129
-	$svg_url= api_get_path(WEB_LIBRARY_PATH).'svg-edit/svg-editor.php?url=../../../../courses/'.$courseDir.$dir.$file.'&amp;lang='.$langsvgedit;
129
+    $svg_url= api_get_path(WEB_LIBRARY_PATH).'svg-edit/svg-editor.php?url=../../../../courses/'.$courseDir.$dir.$file.'&amp;lang='.$langsvgedit;
130 130
 
131
-	?>
131
+    ?>
132 132
 
133 133
 	<script type="text/javascript">
134 134
 
@@ -148,9 +148,9 @@  discard block
 block discarded – undo
148 148
 
149 149
     <?php
150 150
     echo '<noscript>';
151
-	echo '<iframe style="height: 550px; width: 100%;" scrolling="no" frameborder="0\' src="'.$svg_url.'"<noframes><p>Sorry, your browser does not handle frames</p></noframes></iframe>';
152
-	echo '</noscript>';
151
+    echo '<iframe style="height: 550px; width: 100%;" scrolling="no" frameborder="0\' src="'.$svg_url.'"<noframes><p>Sorry, your browser does not handle frames</p></noframes></iframe>';
152
+    echo '</noscript>';
153 153
 } else {
154
-	Display::display_error_message(get_lang('BrowserDontSupportsSVG'));
154
+    Display::display_error_message(get_lang('BrowserDontSupportsSVG'));
155 155
 }
156 156
 Display::display_footer();
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -29,25 +29,25 @@  discard block
 block discarded – undo
29 29
     $my_cur_dir_path = Security::remove_XSS($_GET['curdirpath']);
30 30
 }
31 31
 
32
-$dir= str_replace('\\', '/',$dir);//and urlencode each url $curdirpath (hack clean $curdirpath under Windows - Bug #3261)
32
+$dir = str_replace('\\', '/', $dir); //and urlencode each url $curdirpath (hack clean $curdirpath under Windows - Bug #3261)
33 33
 
34 34
 /* Constants & Variables */
35
-$current_session_id=api_get_session_id();
35
+$current_session_id = api_get_session_id();
36 36
 $group_id = api_get_group_id();
37 37
 
38 38
 //path for svg-edit save
39
-$_SESSION['draw_dir']=Security::remove_XSS($dir);
40
-if ($_SESSION['draw_dir']=='/'){
39
+$_SESSION['draw_dir'] = Security::remove_XSS($dir);
40
+if ($_SESSION['draw_dir'] == '/') {
41 41
 	$_SESSION['draw_dir'] = '';
42 42
 }
43
-$_SESSION['draw_file']=basename(Security::remove_XSS($file_path));
43
+$_SESSION['draw_file'] = basename(Security::remove_XSS($file_path));
44 44
 $get_file = Security::remove_XSS($file_path);
45 45
 $file = basename($get_file);
46
-$temp_file = explode(".",$file);
47
-$filename=$temp_file[0];
48
-$nameTools = get_lang('EditDocument') . ': '.$filename;
46
+$temp_file = explode(".", $file);
47
+$filename = $temp_file[0];
48
+$nameTools = get_lang('EditDocument').': '.$filename;
49 49
 
50
-$courseDir   = $_course['path'].'/document';
50
+$courseDir = $_course['path'].'/document';
51 51
 $is_allowed_to_edit = api_is_allowed_to_edit(null, true);
52 52
 
53 53
 /*	Other initialization code */
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 //groups //TODO:clean
81 81
 if (!empty($group_id)) {
82 82
 	$req_gid = '&amp;gidReq='.$group_id;
83
-	$interbreadcrumb[] = array ('url' => api_get_path(WEB_CODE_PATH).'group/group_space.php?gidReq='.$group_id, 'name' => get_lang('GroupSpace'));
83
+	$interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'group/group_space.php?gidReq='.$group_id, 'name' => get_lang('GroupSpace'));
84 84
 	$group_document = true;
85 85
 	$noPHP_SELF = true;
86 86
 }
@@ -88,15 +88,15 @@  discard block
 block discarded – undo
88 88
 $is_certificate_mode = DocumentManager::is_certificate_mode($dir);
89 89
 
90 90
 if (!$is_certificate_mode)
91
-	$interbreadcrumb[]= array("url" => "./document.php?curdirpath=".urlencode($my_cur_dir_path).$req_gid, "name"=> get_lang('Documents'));
91
+	$interbreadcrumb[] = array("url" => "./document.php?curdirpath=".urlencode($my_cur_dir_path).$req_gid, "name"=> get_lang('Documents'));
92 92
 else
93
-	$interbreadcrumb[]= array ('url' => '../gradebook/'.$_SESSION['gradebook_dest'], 'name' => get_lang('Gradebook'));
93
+	$interbreadcrumb[] = array('url' => '../gradebook/'.$_SESSION['gradebook_dest'], 'name' => get_lang('Gradebook'));
94 94
 
95 95
 // Interbreadcrumb for the current directory root path
96 96
 if (empty($document_data['parents'])) {
97 97
     $interbreadcrumb[] = array('url' => '#', 'name' => $document_data['title']);
98 98
 } else {
99
-    foreach($document_data['parents'] as $document_sub_data) {
99
+    foreach ($document_data['parents'] as $document_sub_data) {
100 100
         if ($document_data['title'] == $document_sub_data['title']) {
101 101
             continue;
102 102
         }
@@ -115,18 +115,18 @@  discard block
 block discarded – undo
115 115
 
116 116
 Display :: display_header($nameTools, 'Doc');
117 117
 echo '<div class="actions">';
118
-		echo '<a href="document.php?id='.$parent_id.'">'.Display::return_icon('back.png',get_lang('BackTo').' '.get_lang('DocumentsOverview'),'',ICON_SIZE_MEDIUM).'</a>';
119
-		echo '<a href="edit_document.php?'.api_get_cidreq().'&id='.$document_id.$req_gid.'&origin=editdraw">'.Display::return_icon('edit.png',get_lang('Rename').'/'.get_lang('Comments'),'',ICON_SIZE_MEDIUM).'</a>';
118
+		echo '<a href="document.php?id='.$parent_id.'">'.Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('DocumentsOverview'), '', ICON_SIZE_MEDIUM).'</a>';
119
+		echo '<a href="edit_document.php?'.api_get_cidreq().'&id='.$document_id.$req_gid.'&origin=editdraw">'.Display::return_icon('edit.png', get_lang('Rename').'/'.get_lang('Comments'), '', ICON_SIZE_MEDIUM).'</a>';
120 120
 echo '</div>';
121 121
 
122 122
 if (api_browser_support('svg')) {
123 123
 	//automatic loading the course language
124 124
 	$svgedit_code_translation_table = array('' => 'en', 'pt' => 'pt-Pt', 'sr' => 'sr_latn');
125
-	$langsvgedit  = api_get_language_isocode();
125
+	$langsvgedit = api_get_language_isocode();
126 126
 	$langsvgedit = isset($svgedit_code_translation_table[$langsvgedit]) ? $svgedit_code_translation_table[$langsvgedit] : $langsvgedit;
127 127
 	$langsvgedit = file_exists(api_get_path(LIBRARY_PATH).'svg-edit/locale/lang.'.$langsvgedit.'.js') ? $langsvgedit : 'en';
128 128
 
129
-	$svg_url= api_get_path(WEB_LIBRARY_PATH).'svg-edit/svg-editor.php?url=../../../../courses/'.$courseDir.$dir.$file.'&amp;lang='.$langsvgedit;
129
+	$svg_url = api_get_path(WEB_LIBRARY_PATH).'svg-edit/svg-editor.php?url=../../../../courses/'.$courseDir.$dir.$file.'&amp;lang='.$langsvgedit;
130 130
 
131 131
 	?>
132 132
 
Please login to merge, or discard this patch.
main/document/edit_paint.php 2 patches
Indentation   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -61,44 +61,44 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
148 148
 $locktitle="false";
149 149
 
150 150
 if ($_SERVER['HTTP_HOST']=="localhost") {
151
-	$path_and_file= api_get_path(SYS_SERVER_ROOT_PATH).'/crossdomain.xml';
152
-	if (!file_exists($path_and_file)) {
153
-		$crossdomain='<?xml version="1.0"?>
151
+    $path_and_file= api_get_path(SYS_SERVER_ROOT_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
 block discarded – undo
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
Please login to merge, or discard this patch.
Spacing   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -33,26 +33,26 @@  discard block
 block discarded – undo
33 33
     $my_cur_dir_path = isset($_GET['curdirpath']) ? Security::remove_XSS($_GET['curdirpath']) : null;
34 34
 }
35 35
 
36
-$dir= str_replace('\\', '/', $dir);//and urlencode each url $curdirpath (hack clean $curdirpath under Windows - Bug #3261)
36
+$dir = str_replace('\\', '/', $dir); //and urlencode each url $curdirpath (hack clean $curdirpath under Windows - Bug #3261)
37 37
 
38 38
 /* Constants & Variables */
39
-$current_session_id=api_get_session_id();
39
+$current_session_id = api_get_session_id();
40 40
 //path for pixlr save
41
-$_SESSION['paint_dir']=Security::remove_XSS($dir);
42
-if($_SESSION['paint_dir']=='/'){
43
-    $_SESSION['paint_dir']='';
41
+$_SESSION['paint_dir'] = Security::remove_XSS($dir);
42
+if ($_SESSION['paint_dir'] == '/') {
43
+    $_SESSION['paint_dir'] = '';
44 44
 }
45
-$_SESSION['paint_file']=basename(Security::remove_XSS($file_path));
45
+$_SESSION['paint_file'] = basename(Security::remove_XSS($file_path));
46 46
 
47 47
 $get_file = Security::remove_XSS($file_path);
48 48
 
49 49
 $file = basename($get_file);
50 50
 
51
-$temp_file = explode(".",$file);
52
-$filename=$temp_file[0];
53
-$nameTools = get_lang('EditDocument') . ': '.$filename;
51
+$temp_file = explode(".", $file);
52
+$filename = $temp_file[0];
53
+$nameTools = get_lang('EditDocument').': '.$filename;
54 54
 
55
-$courseDir   = $_course['path'].'/document';
55
+$courseDir = $_course['path'].'/document';
56 56
 
57 57
 $is_allowed_to_edit = api_is_allowed_to_edit(null, true);
58 58
 
@@ -96,15 +96,15 @@  discard block
 block discarded – undo
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'])) {
105 105
     $interbreadcrumb[] = array('url' => '#', 'name' => $document_data['title']);
106 106
 } else {
107
-    foreach($document_data['parents'] as $document_sub_data) {
107
+    foreach ($document_data['parents'] as $document_sub_data) {
108 108
         if ($document_data['title'] == $document_sub_data['title']) {
109 109
             continue;
110 110
         }
@@ -124,33 +124,33 @@  discard block
 block discarded – undo
124 124
 Display :: display_header($nameTools, 'Doc');
125 125
 echo '<div class="actions">';
126 126
 echo '<a href="document.php?id='.$parent_id.'&'.api_get_cidreq().'">'.
127
-    Display::return_icon('back.png',get_lang('BackTo').' '.get_lang('DocumentsOverview'),'',ICON_SIZE_MEDIUM).'</a>';
127
+    Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('DocumentsOverview'), '', ICON_SIZE_MEDIUM).'</a>';
128 128
 echo '<a href="edit_document.php?'.api_get_cidreq().'&id='.$document_id.'&'.api_get_cidreq().'&origin=editpaint">'.
129
-    Display::return_icon('edit.png', get_lang('Rename').'/'.get_lang('Comment'),'',ICON_SIZE_MEDIUM).'</a>';
129
+    Display::return_icon('edit.png', get_lang('Rename').'/'.get_lang('Comment'), '', ICON_SIZE_MEDIUM).'</a>';
130 130
 echo '</div>';
131 131
 
132 132
 ///pixlr
133
-$title=$file;//disk name. No sql name because pixlr return this when save
133
+$title = $file; //disk name. No sql name because pixlr return this when save
134 134
 $pixlr_code_translation_table = array('' => 'en', 'pt' => 'pt-Pt', 'sr' => 'sr_latn');
135
-$langpixlr  = api_get_language_isocode();
135
+$langpixlr = api_get_language_isocode();
136 136
 $langpixlr = isset($pixlr_code_translation_table[$langpixlr]) ? $pixlredit_code_translation_table[$langpixlr] : $langpixlr;
137
-$loc=$langpixlr;// deprecated ?? TODO:check pixlr read user browser
137
+$loc = $langpixlr; // deprecated ?? TODO:check pixlr read user browser
138 138
 
139
-$exit_path=api_get_path(WEB_CODE_PATH).'document/exit_pixlr.php';
140
-$_SESSION['exit_pixlr']= Security::remove_XSS($parent_id);
139
+$exit_path = api_get_path(WEB_CODE_PATH).'document/exit_pixlr.php';
140
+$_SESSION['exit_pixlr'] = Security::remove_XSS($parent_id);
141 141
 
142
-$referrer="Chamilo";
142
+$referrer = "Chamilo";
143 143
 
144
-$target_path=api_get_path(WEB_CODE_PATH).'document/save_pixlr.php';
145
-$target=$target_path;
144
+$target_path = api_get_path(WEB_CODE_PATH).'document/save_pixlr.php';
145
+$target = $target_path;
146 146
 
147
-$locktarget="true";
148
-$locktitle="false";
147
+$locktarget = "true";
148
+$locktitle = "false";
149 149
 
150
-if ($_SERVER['HTTP_HOST']=="localhost") {
151
-	$path_and_file= api_get_path(SYS_SERVER_ROOT_PATH).'/crossdomain.xml';
150
+if ($_SERVER['HTTP_HOST'] == "localhost") {
151
+	$path_and_file = api_get_path(SYS_SERVER_ROOT_PATH).'/crossdomain.xml';
152 152
 	if (!file_exists($path_and_file)) {
153
-		$crossdomain='<?xml version="1.0"?>
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" />
@@ -159,23 +159,23 @@  discard block
 block discarded – undo
159 159
 			</cross-domain-policy>';//more open domain="*"
160 160
 		@file_put_contents($path_and_file, $crossdomain);
161 161
 	}
162
-	$credentials="true";
162
+	$credentials = "true";
163 163
 }
164 164
 else {
165
-	$credentials="false";
165
+	$credentials = "false";
166 166
 }
167 167
 
168 168
 //make temp images
169
-$temp_folder=api_get_path(SYS_ARCHIVE_PATH).'temp/images';
169
+$temp_folder = api_get_path(SYS_ARCHIVE_PATH).'temp/images';
170 170
 if (!file_exists($temp_folder)) {
171
-    @mkdir($temp_folder, api_get_permissions_for_new_directories(), true);//TODO:check $permissions value, now empty;
171
+    @mkdir($temp_folder, api_get_permissions_for_new_directories(), true); //TODO:check $permissions value, now empty;
172 172
 }
173 173
 
174 174
 //make htaccess with allow from all, and file index.html into temp/images
175
-$htaccess=api_get_path(SYS_ARCHIVE_PATH).'temp/images/.htaccess';
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 180
 	$fp = @ fopen(api_get_path(SYS_ARCHIVE_PATH).'temp/images/.htaccess', 'w');
181 181
 	if ($fp) {
@@ -184,9 +184,9 @@  discard block
 block discarded – undo
184 184
 	}
185 185
 }
186 186
 
187
-$html_index=api_get_path(SYS_ARCHIVE_PATH).'temp/images/index.html';
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>";
189
+	$html_index_content = "<html><head></head><body></body></html>";
190 190
 	$fp = @ fopen(api_get_path(SYS_ARCHIVE_PATH).'temp/images/index.html', 'w');
191 191
 	if ($fp) {
192 192
 		fwrite($fp, $html_index_content);
@@ -195,20 +195,20 @@  discard block
 block discarded – undo
195 195
 }
196 196
 
197 197
 //encript temp name file
198
-$name_crip=sha1(uniqid());//encript
199
-$findext= explode(".", $file);
200
-$extension= $findext[count($findext)-1];
201
-$file_crip=$name_crip.'.'.$extension;
198
+$name_crip = sha1(uniqid()); //encript
199
+$findext = explode(".", $file);
200
+$extension = $findext[count($findext) - 1];
201
+$file_crip = $name_crip.'.'.$extension;
202 202
 
203 203
 //copy file to temp/images directory
204
-$from=$filepath.$file;
205
-$to=api_get_path(SYS_ARCHIVE_PATH).'temp/images/'.$file_crip;
204
+$from = $filepath.$file;
205
+$to = api_get_path(SYS_ARCHIVE_PATH).'temp/images/'.$file_crip;
206 206
 copy($from, $to);
207
-$_SESSION['temp_realpath_image']=$to;
207
+$_SESSION['temp_realpath_image'] = $to;
208 208
 
209 209
 //load image to url
210
-$to_url=api_get_path(WEB_ARCHIVE_PATH).'temp/images/'.$file_crip;
211
-$image=urlencode($to_url);
210
+$to_url = api_get_path(WEB_ARCHIVE_PATH).'temp/images/'.$file_crip;
211
+$image = urlencode($to_url);
212 212
 $pixlr_url = api_get_protocol().'://pixlr.com/editor/?title='.$title.'&image='.$image.'&loc='.$loc.'&referrer='.$referrer.'&target='.$target.'&exit='.$exit_path.'&locktarget='.$locktarget.'&locktitle='.$locktitle.'&credentials='.$credentials;
213 213
 
214 214
 //make frame an send image
Please login to merge, or discard this patch.
main/forum/newthread.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -54,12 +54,12 @@  discard block
 block discarded – undo
54 54
 
55 55
 /* Breadcrumbs */
56 56
 
57
-if (isset($_SESSION['gradebook'])){
57
+if (isset($_SESSION['gradebook'])) {
58 58
     $gradebook = Security::remove_XSS($_SESSION['gradebook']);
59 59
 }
60 60
 
61 61
 if (!empty($gradebook) && $gradebook == 'view') {
62
-    $interbreadcrumb[] = array (
62
+    $interbreadcrumb[] = array(
63 63
         'url' => '../gradebook/'.Security::remove_XSS($_SESSION['gradebook_dest']),
64 64
         'name' => get_lang('ToolGradebook')
65 65
     );
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
     $interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'group/group.php?'.$cidreq, 'name' => get_lang('Groups'));
118 118
     $interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'group/group_space.php?'.$cidreq, 'name' => get_lang('GroupSpace').' '.$groupProperties['name']);
119 119
     $interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'forum/viewforum.php?'.$cidreq.'&forum='.intval($_GET['forum']), 'name' => $current_forum['forum_title']);
120
-    $interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'forum/newthread.php?'.$cidreq.'&forum='.intval($_GET['forum']),'name' => get_lang('NewTopic'));
120
+    $interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'forum/newthread.php?'.$cidreq.'&forum='.intval($_GET['forum']), 'name' => get_lang('NewTopic'));
121 121
 } else {
122 122
     $interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'forum/index.php?'.$cidreq, 'name' => $nameTools);
123 123
     $interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'forum/viewforumcategory.php?'.$cidreq.'&forumcategory='.$current_forum_category['cat_id'], 'name' => $current_forum_category['cat_title']);
@@ -127,9 +127,9 @@  discard block
 block discarded – undo
127 127
 
128 128
 /* Resource Linker */
129 129
 if (isset($_POST['add_resources']) AND $_POST['add_resources'] == get_lang('Resources')) {
130
-    $_SESSION['formelements']	= $_POST;
131
-    $_SESSION['origin']			= $_SERVER['REQUEST_URI'];
132
-    $_SESSION['breadcrumbs']	= $interbreadcrumb;
130
+    $_SESSION['formelements'] = $_POST;
131
+    $_SESSION['origin'] = $_SERVER['REQUEST_URI'];
132
+    $_SESSION['breadcrumbs'] = $interbreadcrumb;
133 133
     header('Location: ../resourcelinker/resourcelinker.php');
134 134
     exit;
135 135
 }
Please login to merge, or discard this patch.
main/forum/editthread.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 }
46 46
 
47 47
 if (!empty($gradebook) && $gradebook == 'view') {
48
-    $interbreadcrumb[] = array (
48
+    $interbreadcrumb[] = array(
49 49
         'url' => '../gradebook/'.Security::remove_XSS($_SESSION['gradebook_dest']),
50 50
         'name' => get_lang('ToolGradebook')
51 51
     );
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
     $interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'group/group.php?'.$cidreq, 'name' => get_lang('Groups'));
108 108
     $interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'group/group_space.php?'.$cidreq, 'name' => get_lang('GroupSpace').' '.$groupProperties['name']);
109 109
     $interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'forum/viewforum.php?'.$cidreq.'&forum='.intval($_GET['forum']), 'name' => $currentForum['forum_title']);
110
-    $interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'forum/newthread.php?'.$cidreq.'&forum='.intval($_GET['forum']),'name' => get_lang('EditThread'));
110
+    $interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'forum/newthread.php?'.$cidreq.'&forum='.intval($_GET['forum']), 'name' => get_lang('EditThread'));
111 111
 } else {
112 112
     $interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'forum/index.php?'.$cidreq, 'name' => $nameTools);
113 113
     $interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'forum/viewforumcategory.php?'.$cidreq.'&forumcategory='.$currentForumCategory['cat_id'], 'name' => $currentForumCategory['cat_title']);
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 echo '<div class="actions">';
157 157
 echo '<span style="float:right;">'.search_link().'</span>';
158 158
 echo '<a href="viewforum.php?forum='.intval($_GET['forum']).'&'.$cidreq.'">'.
159
-    Display::return_icon('back.png',get_lang('BackToForum'),'',ICON_SIZE_MEDIUM).'</a>';
159
+    Display::return_icon('back.png', get_lang('BackToForum'), '', ICON_SIZE_MEDIUM).'</a>';
160 160
 echo '</div>';
161 161
 
162 162
 $threadData = getThreadInfo($threadId, $cId);
Please login to merge, or discard this patch.
main/forum/viewthread.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  */
8 8
 
9 9
 require_once '../inc/global.inc.php';
10
-$current_course_tool  = TOOL_FORUM;
10
+$current_course_tool = TOOL_FORUM;
11 11
 
12 12
 $this_section = SECTION_COURSES;
13 13
 
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 // Are we in a lp ?
24 24
 $origin = '';
25 25
 if (isset($_GET['origin'])) {
26
-    $origin =  Security::remove_XSS($_GET['origin']);
26
+    $origin = Security::remove_XSS($_GET['origin']);
27 27
 }
28 28
 $my_search = null;
29 29
 $gradebook = null;
@@ -36,10 +36,10 @@  discard block
 block discarded – undo
36 36
 // Note pcool: I tried to use only one sql statement (and function) for this,
37 37
 // but the problem is that the visibility of the forum AND forum category are stored in the item_property table.
38 38
 // Note: This has to be validated that it is an existing thread
39
-$current_thread	= get_thread_information($_GET['thread']);
39
+$current_thread = get_thread_information($_GET['thread']);
40 40
 // Note: This has to be validated that it is an existing forum.
41
-$current_forum	= get_forum_information($current_thread['forum_id']);
42
-$current_forum_category	= get_forumcategory_information($current_forum['forum_category']);
41
+$current_forum = get_forum_information($current_thread['forum_id']);
42
+$current_forum_category = get_forumcategory_information($current_forum['forum_category']);
43 43
 $whatsnew_post_info = isset($_SESSION['whatsnew_post_info']) ? $_SESSION['whatsnew_post_info'] : null;
44 44
 /* Header and Breadcrumbs */
45 45
 
@@ -49,8 +49,8 @@  discard block
 block discarded – undo
49 49
 }
50 50
 
51 51
 if (!empty($gradebook) && $gradebook == 'view') {
52
-    $interbreadcrumb[] = array (
53
-        'url' => '../gradebook/' . $_SESSION['gradebook_dest'],
52
+    $interbreadcrumb[] = array(
53
+        'url' => '../gradebook/'.$_SESSION['gradebook_dest'],
54 54
         'name' => get_lang('ToolGradebook')
55 55
     );
56 56
 }
@@ -65,15 +65,15 @@  discard block
 block discarded – undo
65 65
         'name' => get_lang('Groups')
66 66
     );
67 67
     $interbreadcrumb[] = array(
68
-        'url' => api_get_path(WEB_CODE_PATH).'group/group_space.php?' . api_get_cidreq(),
69
-        'name' => get_lang('GroupSpace') . ' ' . $group_properties['name']
68
+        'url' => api_get_path(WEB_CODE_PATH).'group/group_space.php?'.api_get_cidreq(),
69
+        'name' => get_lang('GroupSpace').' '.$group_properties['name']
70 70
     );
71 71
     $interbreadcrumb[] = array(
72
-        'url' => api_get_path(WEB_CODE_PATH).'forum/viewforum.php?forum='.intval($_GET['forum']).'&'.api_get_cidreq(). "&origin=$origin&search=" . Security::remove_XSS(urlencode($my_search)),
72
+        'url' => api_get_path(WEB_CODE_PATH).'forum/viewforum.php?forum='.intval($_GET['forum']).'&'.api_get_cidreq()."&origin=$origin&search=".Security::remove_XSS(urlencode($my_search)),
73 73
         'name' => Security::remove_XSS($current_forum['forum_title'])
74 74
     );
75 75
     $interbreadcrumb[] = array(
76
-        'url' => 'viewthread.php?forum=' . intval($_GET['forum']) . '&' . api_get_cidreq(). '&thread=' . intval($_GET['thread']),
76
+        'url' => 'viewthread.php?forum='.intval($_GET['forum']).'&'.api_get_cidreq().'&thread='.intval($_GET['thread']),
77 77
         'name' => Security::remove_XSS($current_thread['thread_title'])
78 78
     );
79 79
 
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
         $interbreadcrumb[] = array(
87 87
             'url' => api_get_path(WEB_CODE_PATH).'forum/index.php?'
88 88
                 . (isset($gradebook) ? "gradebook=$gradebook&" : '')
89
-                . 'search=' . Security::remove_XSS(urlencode($my_search)),
89
+                . 'search='.Security::remove_XSS(urlencode($my_search)),
90 90
             'name' => $nameTools
91 91
         );
92 92
         $interbreadcrumb[] = array(
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
             'name' => Security::remove_XSS($current_forum_category['cat_title'])
98 98
         );
99 99
         $interbreadcrumb[] = array(
100
-            'url' => api_get_path(WEB_CODE_PATH).'forum/viewforum.php?forum=' . intval($_GET['forum'])
100
+            'url' => api_get_path(WEB_CODE_PATH).'forum/viewforum.php?forum='.intval($_GET['forum'])
101 101
                 . "&origin=$origin&search="
102 102
                 . Security::remove_XSS(urlencode($my_search)),
103 103
             'name' => Security::remove_XSS($current_forum['forum_title'])
@@ -168,9 +168,9 @@  discard block
 block discarded – undo
168 168
     echo '<div class="actions">';
169 169
     echo '<span style="float:right;">'.search_link().'</span>';
170 170
     if ($origin != 'learnpath') {
171
-        echo '<a href="' . $forumUrl . 'viewforum.php?forum='
172
-            . intval($_GET['forum']) . '&' . api_get_cidreq() . '">'
173
-            . Display::return_icon('back.png', get_lang('BackToForum'), '', ICON_SIZE_MEDIUM) . '</a>';
171
+        echo '<a href="'.$forumUrl.'viewforum.php?forum='
172
+            . intval($_GET['forum']).'&'.api_get_cidreq().'">'
173
+            . Display::return_icon('back.png', get_lang('BackToForum'), '', ICON_SIZE_MEDIUM).'</a>';
174 174
     }
175 175
     // The reply to thread link should only appear when the forum_category is
176 176
     // not locked AND the forum is not locked AND the thread is not locked.
@@ -186,9 +186,9 @@  discard block
 block discarded – undo
186 186
         if ($_user['user_id'] || ($current_forum['allow_anonymous'] == 1 && !$_user['user_id'])) {
187 187
             // reply link
188 188
             if (!api_is_anonymous() && api_is_allowed_to_session_edit(false, true)) {
189
-                echo '<a href="' . $forumUrl . 'reply.php?' . api_get_cidreq() . '&forum='
190
-                    . intval($_GET['forum']) . '&thread='
191
-                    . intval($_GET['thread']) . '&action=replythread">'
189
+                echo '<a href="'.$forumUrl.'reply.php?'.api_get_cidreq().'&forum='
190
+                    . intval($_GET['forum']).'&thread='
191
+                    . intval($_GET['thread']).'&action=replythread">'
192 192
                     . Display::return_icon('reply_thread.png', get_lang('ReplyToThread'), '', ICON_SIZE_MEDIUM)
193 193
                     . '</a>';
194 194
             }
@@ -212,13 +212,13 @@  discard block
 block discarded – undo
212 212
 
213 213
     // The different views of the thread.
214 214
     if ($origin != 'learnpath') {
215
-        $my_url = '<a href="' . $forumUrl . 'viewthread.php?' . api_get_cidreq() . '&' . api_get_cidreq()
216
-            . '&forum=' . intval($_GET['forum']) . '&thread=' . intval($_GET['thread'])
217
-            . '&search=' . Security::remove_XSS(urlencode($my_search));
218
-        echo $my_url . '&view=flat">'
215
+        $my_url = '<a href="'.$forumUrl.'viewthread.php?'.api_get_cidreq().'&'.api_get_cidreq()
216
+            . '&forum='.intval($_GET['forum']).'&thread='.intval($_GET['thread'])
217
+            . '&search='.Security::remove_XSS(urlencode($my_search));
218
+        echo $my_url.'&view=flat">'
219 219
             . Display::return_icon('forum_listview.png', get_lang('FlatView'), null, ICON_SIZE_MEDIUM)
220 220
             . '</a>';
221
-        echo $my_url . '&view=nested">'
221
+        echo $my_url.'&view=nested">'
222 222
             . Display::return_icon('forum_nestedview.png', get_lang('NestedView'), null, ICON_SIZE_MEDIUM)
223 223
             . '</a>';
224 224
     }
Please login to merge, or discard this patch.
main/forum/forumsearch.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 // Are we in a lp ?
41 41
 $origin = '';
42 42
 if (isset($_GET['origin'])) {
43
-    $origin =  Security::remove_XSS($_GET['origin']);
43
+    $origin = Security::remove_XSS($_GET['origin']);
44 44
 }
45 45
 
46 46
 // Name of the tool
@@ -48,12 +48,12 @@  discard block
 block discarded – undo
48 48
 
49 49
 // Breadcrumbs
50 50
 
51
-if (isset($_SESSION['gradebook'])){
51
+if (isset($_SESSION['gradebook'])) {
52 52
     $gradebook = $_SESSION['gradebook'];
53 53
 }
54 54
 
55 55
 if (!empty($gradebook) && $gradebook == 'view') {
56
-    $interbreadcrumb[] = array (
56
+    $interbreadcrumb[] = array(
57 57
         'url' => '../gradebook/'.$_SESSION['gradebook_dest'],
58 58
         'name' => get_lang('ToolGradebook')
59 59
     );
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
     $interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'group/group.php?'.api_get_cidreq(), 'name' => get_lang('Groups'));
67 67
     $interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'group/group_space.php?'.api_get_cidreq(), 'name' => get_lang('GroupSpace').' ('.$group_properties['name'].')');
68 68
     $interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'forum/viewforum.php?origin='.$origin.'&forum='.intval($_GET['forum']).'&'.api_get_cidreq(), 'name' => prepare4display($current_forum['forum_title']));
69
-    $interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'forum/forumsearch.php?'.api_get_cidreq(),'name' => get_lang('ForumSearch'));
69
+    $interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'forum/forumsearch.php?'.api_get_cidreq(), 'name' => get_lang('ForumSearch'));
70 70
 } else {
71 71
     $interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'forum/index.php?'.api_get_cidreq(), 'name' => $nameTools);
72 72
     $nameTools = get_lang('ForumSearch');
Please login to merge, or discard this patch.
main/group/group_space.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 require_once '../inc/global.inc.php';
13
-$current_course_tool  = TOOL_GROUP;
13
+$current_course_tool = TOOL_GROUP;
14 14
 
15 15
 // Notice for unauthorized people.
16 16
 api_protect_course_script(true);
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 
70 70
 echo '<div class="actions">';
71 71
 echo '<a href="group.php">'.
72
-    Display::return_icon('back.png',get_lang('BackToGroupList'),'',ICON_SIZE_MEDIUM).
72
+    Display::return_icon('back.png', get_lang('BackToGroupList'), '', ICON_SIZE_MEDIUM).
73 73
     '</a>';
74 74
 
75 75
 /*
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
  */
87 87
 $unsubscribe_group = '';
88 88
 if (GroupManager :: is_self_unregistration_allowed($user_id, $current_group['id'])) {
89
-    $unsubscribe_group = '<a class="btn btn-default" href="'.api_get_self().'?selfUnReg=1" onclick="javascript: if(!confirm('."'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES))."'".')) return false;">'.
89
+    $unsubscribe_group = '<a class="btn btn-default" href="'.api_get_self().'?selfUnReg=1" onclick="javascript: if(!confirm('."'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"), ENT_QUOTES))."'".')) return false;">'.
90 90
         get_lang("StudentUnsubscribe").'</a>';
91 91
 }
92 92
 echo '&nbsp;</div>';
@@ -98,8 +98,8 @@  discard block
 block discarded – undo
98 98
     GroupManager::is_tutor_of_group(api_get_user_id(), api_get_group_id())
99 99
 ) {
100 100
     $my_origin = isset($origin) ? $origin : '';
101
-    $edit_url =  '<a href="'.api_get_path(WEB_CODE_PATH).'group/settings.php?'.api_get_cidreq().'&origin='.$my_origin.'">'.
102
-        Display::return_icon('edit.png', get_lang('EditGroup'),'',ICON_SIZE_SMALL).'</a>';
101
+    $edit_url = '<a href="'.api_get_path(WEB_CODE_PATH).'group/settings.php?'.api_get_cidreq().'&origin='.$my_origin.'">'.
102
+        Display::return_icon('edit.png', get_lang('EditGroup'), '', ICON_SIZE_SMALL).'</a>';
103 103
 }
104 104
 
105 105
 echo Display::page_header(
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
     $forums_of_groups = get_forums_of_group($current_group['id']);
217 217
 
218 218
     if (is_array($forums_of_groups)) {
219
-        if ( $current_group['forum_state'] == GroupManager::TOOL_PUBLIC) {
219
+        if ($current_group['forum_state'] == GroupManager::TOOL_PUBLIC) {
220 220
             foreach ($forums_of_groups as $key => $value) {
221 221
                 if ($value['forum_group_public_private'] == 'public') {
222 222
                     $actions_array[] = array(
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
 if (count($tutors) == 0) {
299 299
     $tutor_info = get_lang('GroupNoneMasc');
300 300
 } else {
301
-    isset($origin) ? $my_origin = $origin:$my_origin='';
301
+    isset($origin) ? $my_origin = $origin : $my_origin = '';
302 302
     $tutor_info .= '<ul class="thumbnails">';
303 303
     foreach ($tutors as $index => $tutor) {
304 304
         $userInfo = api_get_user_info($tutor['user_id']);
@@ -404,8 +404,8 @@  discard block
 block discarded – undo
404 404
     global $current_group;
405 405
 
406 406
     // Database table definition
407
-    $table_group_user 	= Database :: get_course_table(TABLE_GROUP_USER);
408
-    $table_user 		= Database :: get_main_table(TABLE_MAIN_USER);
407
+    $table_group_user = Database :: get_course_table(TABLE_GROUP_USER);
408
+    $table_user = Database :: get_main_table(TABLE_MAIN_USER);
409 409
 
410 410
     $course_id = api_get_course_int_id();
411 411
 
Please login to merge, or discard this patch.
main/inc/lib/groupmanager.lib.php 1 patch
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -221,8 +221,8 @@  discard block
 block discarded – undo
221 221
             $sql = "UPDATE $table_group SET id = iid WHERE iid = $lastId";
222 222
             Database::query($sql);
223 223
 
224
-            $desired_dir_name= '/'.api_replace_dangerous_char($name).'_groupdocs';
225
-            $my_path = api_get_path(SYS_COURSE_PATH) . $currentCourseRepository . '/document';
224
+            $desired_dir_name = '/'.api_replace_dangerous_char($name).'_groupdocs';
225
+            $my_path = api_get_path(SYS_COURSE_PATH).$currentCourseRepository.'/document';
226 226
 
227 227
             $newFolderData = create_unexisting_directory(
228 228
                 $_course,
@@ -285,11 +285,11 @@  discard block
 block discarded – undo
285 285
                 $values['default_view_type_group']['default_view_type'] = api_get_setting('default_forum_view');
286 286
                 $values['group_forum'] = $lastId;
287 287
                 if ($forumState == '1') {
288
-                    $values['public_private_group_forum_group']['public_private_group_forum']='public';
288
+                    $values['public_private_group_forum_group']['public_private_group_forum'] = 'public';
289 289
                 } elseif ($forumState == '2') {
290
-                    $values['public_private_group_forum_group']['public_private_group_forum']='private';
290
+                    $values['public_private_group_forum_group']['public_private_group_forum'] = 'private';
291 291
                 } elseif ($forumState == '0') {
292
-                    $values['public_private_group_forum_group']['public_private_group_forum']='unavailable';
292
+                    $values['public_private_group_forum_group']['public_private_group_forum'] = 'unavailable';
293 293
                 }
294 294
                 store_forum($values);
295 295
             }
@@ -320,9 +320,9 @@  discard block
 block discarded – undo
320 320
             1
321 321
         );
322 322
         $users = self::get_users($group_id);
323
-        $group_ids = array ();
323
+        $group_ids = array();
324 324
 
325
-        for ($group_nr = 1; $group_nr <= $number_of_groups; $group_nr ++) {
325
+        for ($group_nr = 1; $group_nr <= $number_of_groups; $group_nr++) {
326 326
             $group_ids[] = self::create_group(
327 327
                 get_lang('Subgroup').' '.$group_nr,
328 328
                 $category_id,
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
                 0,
367 367
                 count($users_ids)
368 368
             );
369
-            self::subscribe_users($users_ids,$group_id);
369
+            self::subscribe_users($users_ids, $group_id);
370 370
             $group_ids[] = $group_id;
371 371
         }
372 372
         return $group_ids;
@@ -391,14 +391,14 @@  discard block
 block discarded – undo
391 391
         $group_table = Database:: get_course_table(TABLE_GROUP);
392 392
         $forum_table = Database:: get_course_table(TABLE_FORUM);
393 393
 
394
-        $group_ids = is_array($group_ids) ? $group_ids : array ($group_ids);
395
-        $group_ids = array_map('intval',$group_ids);
394
+        $group_ids = is_array($group_ids) ? $group_ids : array($group_ids);
395
+        $group_ids = array_map('intval', $group_ids);
396 396
 
397 397
         if (api_is_course_coach()) {
398 398
             //a coach can only delete courses from his session
399
-            for ($i=0 ; $i<count($group_ids) ; $i++) {
400
-                if (!api_is_element_in_the_session(TOOL_GROUP,$group_ids[$i])) {
401
-                    array_splice($group_ids,$i,1);
399
+            for ($i = 0; $i < count($group_ids); $i++) {
400
+                if (!api_is_element_in_the_session(TOOL_GROUP, $group_ids[$i])) {
401
+                    array_splice($group_ids, $i, 1);
402 402
                     $i--;
403 403
                 }
404 404
             }
@@ -633,7 +633,7 @@  discard block
 block discarded – undo
633 633
         } elseif ($forum_state === 0) {
634 634
             $sql2 .= " forum_group_public_private='unavailable' ";
635 635
         }
636
-        $sql2 .=" WHERE c_id = $course_id AND forum_of_group=".$group_id;
636
+        $sql2 .= " WHERE c_id = $course_id AND forum_of_group=".$group_id;
637 637
         Database::query($sql2);
638 638
         return $result;
639 639
     }
@@ -662,13 +662,13 @@  discard block
 block discarded – undo
662 662
     public static function get_categories($course_code = null)
663 663
     {
664 664
         $course_info = api_get_course_info($course_code);
665
-        $course_id     = $course_info['real_id'];
665
+        $course_id = $course_info['real_id'];
666 666
         $table_group_cat = Database :: get_course_table(TABLE_GROUP_CATEGORY);
667 667
         $sql = "SELECT * FROM $table_group_cat
668 668
                 WHERE c_id = $course_id
669 669
                 ORDER BY display_order";
670 670
         $res = Database::query($sql);
671
-        $cats = array ();
671
+        $cats = array();
672 672
         while ($cat = Database::fetch_array($res)) {
673 673
             $cats[] = $cat;
674 674
         }
@@ -779,7 +779,7 @@  discard block
 block discarded – undo
779 779
                 WHERE c_id = $course_id AND category_id='".$cat_id."'";
780 780
         $res = Database::query($sql);
781 781
         if (Database::num_rows($res) > 0) {
782
-            $groups_to_delete = array ();
782
+            $groups_to_delete = array();
783 783
             while ($group = Database::fetch_object($res)) {
784 784
                 $groups_to_delete[] = $group->id;
785 785
             }
@@ -947,7 +947,7 @@  discard block
 block discarded – undo
947 947
      */
948 948
     public static function get_current_max_groups_per_user($category_id = null, $course_code = null)
949 949
     {
950
-        $course_info = api_get_course_info ($course_code);
950
+        $course_info = api_get_course_info($course_code);
951 951
         $group_table = Database :: get_course_table(TABLE_GROUP);
952 952
         $group_user_table = Database :: get_course_table(TABLE_GROUP_USER);
953 953
         $sql = 'SELECT COUNT(gu.group_id) AS current_max
@@ -1186,17 +1186,17 @@  discard block
 block discarded – undo
1186 1186
     {
1187 1187
         $_course = api_get_course_info();
1188 1188
 
1189
-        $group_ids = is_array($group_ids) ? $group_ids : array ($group_ids);
1189
+        $group_ids = is_array($group_ids) ? $group_ids : array($group_ids);
1190 1190
         $group_ids = array_map('intval', $group_ids);
1191 1191
 
1192 1192
         if (api_is_course_coach()) {
1193
-            for ($i=0 ; $i< count($group_ids) ; $i++) {
1194
-                if (!api_is_element_in_the_session(TOOL_GROUP, $group_ids[$i])){
1195
-                    array_splice($group_ids,$i,1);
1193
+            for ($i = 0; $i < count($group_ids); $i++) {
1194
+                if (!api_is_element_in_the_session(TOOL_GROUP, $group_ids[$i])) {
1195
+                    array_splice($group_ids, $i, 1);
1196 1196
                     $i--;
1197 1197
                 }
1198 1198
             }
1199
-            if (count($group_ids)==0) {
1199
+            if (count($group_ids) == 0) {
1200 1200
                 return false;
1201 1201
             }
1202 1202
         }
@@ -1235,9 +1235,9 @@  discard block
 block discarded – undo
1235 1235
          * Retrieve course users (reverse) ordered by the number
1236 1236
          * of group they are already enrolled
1237 1237
          */
1238
-        for ($i = 0; $i < count($complete_user_list); $i ++) {
1238
+        for ($i = 0; $i < count($complete_user_list); $i++) {
1239 1239
             //find # of groups the user is enrolled in
1240
-            $number_of_groups = self :: user_in_number_of_groups($complete_user_list[$i]["user_id"], (isset($category['id'])?$category['id']:null));
1240
+            $number_of_groups = self :: user_in_number_of_groups($complete_user_list[$i]["user_id"], (isset($category['id']) ? $category['id'] : null));
1241 1241
             //add # of groups to user list
1242 1242
             $complete_user_list[$i]['number_groups_left'] = $number_groups_per_user - $number_of_groups;
1243 1243
         }
@@ -1249,7 +1249,7 @@  discard block
 block discarded – undo
1249 1249
 
1250 1250
         //now sort by # of group left
1251 1251
         $complete_user_list = TableSort :: sort_table($complete_user_list, 'number_groups_left', SORT_DESC);
1252
-        $userToken = array ();
1252
+        $userToken = array();
1253 1253
         foreach ($complete_user_list as $this_user) {
1254 1254
             if ($this_user['number_groups_left'] > 0) {
1255 1255
                 $userToken[$this_user['user_id']] = $this_user['number_groups_left'];
@@ -1444,7 +1444,7 @@  discard block
 block discarded – undo
1444 1444
                 if ($category['groups_per_user'] == self::GROUP_PER_MEMBER_NO_LIMIT) {
1445 1445
                     $category['groups_per_user'] = self::INFINITE;
1446 1446
                 }
1447
-                $result = self:: user_in_number_of_groups($user_id, $category['id'] ) < $category['groups_per_user'];
1447
+                $result = self:: user_in_number_of_groups($user_id, $category['id']) < $category['groups_per_user'];
1448 1448
                 if ($result == false) {
1449 1449
                     return false;
1450 1450
                 }
@@ -1555,7 +1555,7 @@  discard block
 block discarded – undo
1555 1555
                     tg.group_id='".$group_id."' AND
1556 1556
                     tg.user_id=u.user_id".$order_clause;
1557 1557
         $db_result = Database::query($sql);
1558
-        $users = array ();
1558
+        $users = array();
1559 1559
         while ($user = Database::fetch_object($db_result)) {
1560 1560
             if (!$id_only) {
1561 1561
                 $member['user_id'] = $user->user_id;
@@ -1620,8 +1620,8 @@  discard block
 block discarded – undo
1620 1620
         foreach ($user_ids as $user_id) {
1621 1621
             $user_id = intval($user_id);
1622 1622
             if (self::can_user_subscribe($user_id, $group_id, false)) {
1623
-                $sql = "INSERT INTO " . $table_group_tutor . " (c_id, user_id, group_id)
1624
-                        VALUES ('$course_id', '" . $user_id . "', '" . $group_id . "')";
1623
+                $sql = "INSERT INTO ".$table_group_tutor." (c_id, user_id, group_id)
1624
+                        VALUES ('$course_id', '".$user_id."', '".$group_id."')";
1625 1625
                 $result &= Database::query($sql);
1626 1626
             }
1627 1627
         }
@@ -1637,7 +1637,7 @@  discard block
 block discarded – undo
1637 1637
      */
1638 1638
     public static function unsubscribe_users($user_ids, $group_id)
1639 1639
     {
1640
-        $user_ids = is_array($user_ids) ? $user_ids : array ($user_ids);
1640
+        $user_ids = is_array($user_ids) ? $user_ids : array($user_ids);
1641 1641
         $table_group_user = Database :: get_course_table(TABLE_GROUP_USER);
1642 1642
         $group_id = intval($group_id);
1643 1643
         $course_id = api_get_course_int_id();
@@ -2183,7 +2183,7 @@  discard block
 block discarded – undo
2183 2183
          * Retrieve course users (reverse) ordered by the number
2184 2184
          * of group they are already enrolled
2185 2185
          */
2186
-        for ($i = 0; $i < count($complete_user_list); $i ++) {
2186
+        for ($i = 0; $i < count($complete_user_list); $i++) {
2187 2187
             // find # of groups the user is enrolled in
2188 2188
             $number_of_groups = self:: user_in_number_of_groups(
2189 2189
                 $complete_user_list[$i]["user_id"],
@@ -2315,14 +2315,14 @@  discard block
 block discarded – undo
2315 2315
                 !(api_is_course_coach() && intval($this_group['session_id']) != $session_id)
2316 2316
             ) {
2317 2317
                 $edit_actions = '<a href="'.$url.'settings.php?'.api_get_cidreq(true, false).'&gidReq='.$this_group['id'].'"  title="'.get_lang('Edit').'">'.
2318
-                    Display::return_icon('edit.png', get_lang('EditGroup'),'',ICON_SIZE_SMALL).'</a>&nbsp;';
2318
+                    Display::return_icon('edit.png', get_lang('EditGroup'), '', ICON_SIZE_SMALL).'</a>&nbsp;';
2319 2319
 
2320 2320
                 if ($this_group['status'] == 1) {
2321
-                    $edit_actions .= '<a href="' . api_get_self() . '?' . api_get_cidreq(true,false) . '&category=' . $category_id . '&action=set_invisible&id=' . $this_group['id'] . '" title="' . get_lang('Hide') . '">' .
2322
-                        Display::return_icon('visible.png', get_lang('Hide'), '', ICON_SIZE_SMALL) . '</a>&nbsp;';
2321
+                    $edit_actions .= '<a href="'.api_get_self().'?'.api_get_cidreq(true, false).'&category='.$category_id.'&action=set_invisible&id='.$this_group['id'].'" title="'.get_lang('Hide').'">'.
2322
+                        Display::return_icon('visible.png', get_lang('Hide'), '', ICON_SIZE_SMALL).'</a>&nbsp;';
2323 2323
                 } else {
2324
-                    $edit_actions .= '<a href="' . api_get_self() . '?' . api_get_cidreq(true, false) . '&category=' . $category_id . '&action=set_visible&id=' . $this_group['id'] . '" title="' . get_lang('Show') . '">' .
2325
-                        Display::return_icon('invisible.png', get_lang('Show'), '', ICON_SIZE_SMALL) . '</a>&nbsp;';
2324
+                    $edit_actions .= '<a href="'.api_get_self().'?'.api_get_cidreq(true, false).'&category='.$category_id.'&action=set_visible&id='.$this_group['id'].'" title="'.get_lang('Show').'">'.
2325
+                        Display::return_icon('invisible.png', get_lang('Show'), '', ICON_SIZE_SMALL).'</a>&nbsp;';
2326 2326
                 }
2327 2327
 
2328 2328
                 $edit_actions .= '<a href="'.$url.'member_settings.php?'.api_get_cidreq(true, false).'&gidReq='.$this_group['id'].'"  title="'.get_lang('GroupMembers').'">'.
@@ -2335,10 +2335,10 @@  discard block
 block discarded – undo
2335 2335
                     Display::return_icon('clean.png',get_lang('EmptyGroup'),'',ICON_SIZE_SMALL).'</a>&nbsp;';*/
2336 2336
 
2337 2337
                 $edit_actions .= '<a href="'.api_get_self().'?'.api_get_cidreq(true, false).'&category='.$category_id.'&action=fill_one&id='.$this_group['id'].'" onclick="javascript: if(!confirm('."'".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES))."'".')) return false;" title="'.get_lang('FillGroup').'">'.
2338
-                    Display::return_icon('fill.png',get_lang('FillGroup'),'',ICON_SIZE_SMALL).'</a>&nbsp;';
2338
+                    Display::return_icon('fill.png', get_lang('FillGroup'), '', ICON_SIZE_SMALL).'</a>&nbsp;';
2339 2339
 
2340 2340
                 $edit_actions .= '<a href="'.api_get_self().'?'.api_get_cidreq(true, false).'&category='.$category_id.'&action=delete_one&id='.$this_group['id'].'" onclick="javascript: if(!confirm('."'".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES))."'".')) return false;" title="'.get_lang('Delete').'">'.
2341
-                    Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>&nbsp;';
2341
+                    Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a>&nbsp;';
2342 2342
 
2343 2343
                 $row[] = $edit_actions;
2344 2344
             }
@@ -2710,7 +2710,7 @@  discard block
 block discarded – undo
2710 2710
         $activeTutor = null;
2711 2711
         $activeMember = null;
2712 2712
 
2713
-        switch($default) {
2713
+        switch ($default) {
2714 2714
             case 'settings':
2715 2715
                 $activeSettings = 'active';
2716 2716
                 break;
Please login to merge, or discard this patch.