Completed
Push — 1.11.x ( 566ea6...b264ab )
by José
110:20 queued 69:00
created
main/inc/ajax/chat.ajax.php 2 patches
Switch Indentation   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -55,56 +55,56 @@
 block discarded – undo
55 55
 }
56 56
 
57 57
 switch ($action) {
58
-    case 'chatheartbeat':
59
-        $chat->heartbeat();
60
-        break;
61
-    case 'closechat':
62
-        $chat->close();
63
-        break;
64
-    case 'sendchat':
65
-        $chat->send(api_get_user_id(), $to_user_id, $message);
66
-        break;
67
-    case 'startchatsession':
68
-        $chat->startSession();
69
-        break;
70
-    case 'set_status':
71
-        $status = isset($_REQUEST['status']) ? intval($_REQUEST['status']) : 0;
72
-        $chat->setUserStatus($status);
73
-        break;
74
-    case 'create_room':
75
-        $room = VideoChat::getChatRoomByUsers(api_get_user_id(), $to_user_id);
76
-
77
-        if ($room === false) {
78
-            $createdRoom = VideoChat::createRoom(api_get_user_id(), $to_user_id);
79
-
80
-            if ($createdRoom === false) {
81
-                echo Display::return_message(get_lang('ChatRoomNotCreated'), 'error');
82
-                break;
58
+        case 'chatheartbeat':
59
+            $chat->heartbeat();
60
+            break;
61
+        case 'closechat':
62
+            $chat->close();
63
+            break;
64
+        case 'sendchat':
65
+            $chat->send(api_get_user_id(), $to_user_id, $message);
66
+            break;
67
+        case 'startchatsession':
68
+            $chat->startSession();
69
+            break;
70
+        case 'set_status':
71
+            $status = isset($_REQUEST['status']) ? intval($_REQUEST['status']) : 0;
72
+            $chat->setUserStatus($status);
73
+            break;
74
+        case 'create_room':
75
+            $room = VideoChat::getChatRoomByUsers(api_get_user_id(), $to_user_id);
76
+
77
+            if ($room === false) {
78
+                $createdRoom = VideoChat::createRoom(api_get_user_id(), $to_user_id);
79
+
80
+                if ($createdRoom === false) {
81
+                    echo Display::return_message(get_lang('ChatRoomNotCreated'), 'error');
82
+                    break;
83
+                }
84
+
85
+                $room = VideoChat::getChatRoomByUsers(api_get_user_id(), $to_user_id);
83 86
             }
84 87
 
85
-            $room = VideoChat::getChatRoomByUsers(api_get_user_id(), $to_user_id);
86
-        }
87
-
88
-        $videoChatUrl = api_get_path(WEB_LIBRARY_JS_PATH) . "chat/video.php?room={$room['id']}";
89
-        $videoChatLink = Display::url(
90
-            Display::returnFontAwesomeIcon('video-camera') . get_lang('StartVideoChat'),
91
-            $videoChatUrl
92
-        );
93
-
94
-        $chat->send(
95
-            api_get_user_id(),
96
-            $to_user_id,
97
-            $videoChatLink,
98
-            false,
99
-            false
100
-        );
101
-
102
-        echo Display::tag('p', $videoChatLink, ['class' => 'lead']);
103
-        break;
104
-    case 'notify_not_support':
105
-        $chat->send(api_get_user_id(), $to_user_id, get_lang('TheXUserBrowserDoesNotSupportWebRTC'));
106
-        break;
107
-    default:
108
-        echo '';
88
+            $videoChatUrl = api_get_path(WEB_LIBRARY_JS_PATH) . "chat/video.php?room={$room['id']}";
89
+            $videoChatLink = Display::url(
90
+                Display::returnFontAwesomeIcon('video-camera') . get_lang('StartVideoChat'),
91
+                $videoChatUrl
92
+            );
93
+
94
+            $chat->send(
95
+                api_get_user_id(),
96
+                $to_user_id,
97
+                $videoChatLink,
98
+                false,
99
+                false
100
+            );
101
+
102
+            echo Display::tag('p', $videoChatLink, ['class' => 'lead']);
103
+            break;
104
+        case 'notify_not_support':
105
+            $chat->send(api_get_user_id(), $to_user_id, get_lang('TheXUserBrowserDoesNotSupportWebRTC'));
106
+            break;
107
+        default:
108
+            echo '';
109 109
 }
110 110
 exit;
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
  * Responses to AJAX calls
6 6
  */
7 7
 
8
-$_dont_save_user_course_access  = true;
8
+$_dont_save_user_course_access = true;
9 9
 
10 10
 require_once '../global.inc.php';
11 11
 
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 }
35 35
 
36 36
 $to_user_id = isset($_REQUEST['to']) ? $_REQUEST['to'] : null;
37
-$message	= isset($_REQUEST['message']) ? $_REQUEST['message'] : null;
37
+$message = isset($_REQUEST['message']) ? $_REQUEST['message'] : null;
38 38
 
39 39
 if (!isset($_SESSION['chatHistory'])) {
40 40
     $_SESSION['chatHistory'] = array();
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 }
46 46
 
47 47
 $chat = new Chat();
48
-if (chat::disableChat()){
48
+if (chat::disableChat()) {
49 49
     exit;
50 50
 }
51 51
 if ($chat->is_chat_blocked_by_exercises()) {
@@ -85,9 +85,9 @@  discard block
 block discarded – undo
85 85
             $room = VideoChat::getChatRoomByUsers(api_get_user_id(), $to_user_id);
86 86
         }
87 87
 
88
-        $videoChatUrl = api_get_path(WEB_LIBRARY_JS_PATH) . "chat/video.php?room={$room['id']}";
88
+        $videoChatUrl = api_get_path(WEB_LIBRARY_JS_PATH)."chat/video.php?room={$room['id']}";
89 89
         $videoChatLink = Display::url(
90
-            Display::returnFontAwesomeIcon('video-camera') . get_lang('StartVideoChat'),
90
+            Display::returnFontAwesomeIcon('video-camera').get_lang('StartVideoChat'),
91 91
             $videoChatUrl
92 92
         );
93 93
 
Please login to merge, or discard this patch.
main/inc/ajax/myspace.ajax.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -58,9 +58,9 @@
 block discarded – undo
58 58
             $db['is_empty'] = false;
59 59
             $db['result'] = convert_to_string($sql_result);
60 60
             $rst = get_stats($user_id, $course_code, $start_date, $end_date);
61
-            $foo_stats = '<strong>' . get_lang('Total') . ': </strong>' . $rst['total'] . '<br />';
62
-            $foo_stats .= '<strong>' . get_lang('Average') . ': </strong>' . $rst['avg'] . '<br />';
63
-            $foo_stats .= '<strong>' . get_lang('Quantity') . ' : </strong>' . $rst['times'] . '<br />';
61
+            $foo_stats = '<strong>'.get_lang('Total').': </strong>'.$rst['total'].'<br />';
62
+            $foo_stats .= '<strong>'.get_lang('Average').': </strong>'.$rst['avg'].'<br />';
63
+            $foo_stats .= '<strong>'.get_lang('Quantity').' : </strong>'.$rst['times'].'<br />';
64 64
             $db['stats'] = $foo_stats;
65 65
             $db['graph_result'] = grapher($sql_result, $start_date, $end_date, $type);
66 66
         } else {
Please login to merge, or discard this patch.
main/inc/ajax/user_manager.ajax.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
                 <div class="row">
59 59
                     <div class="col-sm-10 col-sm-offset-2">
60 60
                         <a class="btn btn-primary" id="send_message_link">
61
-                            <em class="fa fa-envelope"></em> ' . get_lang('Send') . '
61
+                            <em class="fa fa-envelope"></em> ' . get_lang('Send').'
62 62
                         </a>
63 63
                     </div>
64 64
                 </div>
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 
113 113
             if (!empty($user_id)) {
114 114
                 $user_table = Database :: get_main_table(TABLE_MAIN_USER);
115
-                $sql="UPDATE $user_table SET active='".$status."' WHERE user_id='".$user_id."'";
115
+                $sql = "UPDATE $user_table SET active='".$status."' WHERE user_id='".$user_id."'";
116 116
                 $result = Database::query($sql);
117 117
 
118 118
                 //Send and email if account is active
@@ -122,13 +122,13 @@  discard block
 block discarded – undo
122 122
                     $emailsubject = '['.api_get_setting('siteName').'] '.get_lang('YourReg').' '.api_get_setting('siteName');
123 123
                     $email_admin = api_get_setting('emailAdministrator');
124 124
                     $sender_name = api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'), null, PERSON_NAME_EMAIL_ADDRESS);
125
-                    $emailbody=get_lang('Dear')." ".stripslashes($recipient_name).",\n\n";
125
+                    $emailbody = get_lang('Dear')." ".stripslashes($recipient_name).",\n\n";
126 126
 
127
-                    $emailbody.=sprintf(get_lang('YourAccountOnXHasJustBeenApprovedByOneOfOurAdministrators'), api_get_setting('siteName'))."\n";
128
-                    $emailbody.=sprintf(get_lang('YouCanNowLoginAtXUsingTheLoginAndThePasswordYouHaveProvided'), api_get_path(WEB_PATH)).",\n\n";
129
-                    $emailbody.=get_lang('HaveFun')."\n\n";
127
+                    $emailbody .= sprintf(get_lang('YourAccountOnXHasJustBeenApprovedByOneOfOurAdministrators'), api_get_setting('siteName'))."\n";
128
+                    $emailbody .= sprintf(get_lang('YouCanNowLoginAtXUsingTheLoginAndThePasswordYouHaveProvided'), api_get_path(WEB_PATH)).",\n\n";
129
+                    $emailbody .= get_lang('HaveFun')."\n\n";
130 130
                     //$emailbody.=get_lang('Problem'). "\n\n". get_lang('SignatureFormula');
131
-                    $emailbody.=api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'))."\n". get_lang('Manager'). " ".api_get_setting('siteName')."\nT. ".api_get_setting('administratorTelephone')."\n" .get_lang('Email') ." : ".api_get_setting('emailAdministrator');
131
+                    $emailbody .= api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'))."\n".get_lang('Manager')." ".api_get_setting('siteName')."\nT. ".api_get_setting('administratorTelephone')."\n".get_lang('Email')." : ".api_get_setting('emailAdministrator');
132 132
 
133 133
                     $additionalParameters = array(
134 134
                         'smsType' => SmsPlugin::ACCOUNT_APPROVED_CONNECT,
Please login to merge, or discard this patch.
main/inc/ajax/thematic.ajax.php 2 patches
Indentation   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -11,8 +11,8 @@  discard block
 block discarded – undo
11 11
 $thematic = new Thematic();
12 12
 
13 13
 switch ($action) {
14
-	case 'save_thematic_plan':
15
-		/*$title_list         = $_REQUEST['title'];
14
+    case 'save_thematic_plan':
15
+        /*$title_list         = $_REQUEST['title'];
16 16
 		$description_list   = $_REQUEST['desc'];
17 17
 		//$description_list   = $_REQUEST['description'];
18 18
 		$description_type   = $_REQUEST['description_type'];
@@ -25,13 +25,13 @@  discard block
 block discarded – undo
25 25
 		$thematic_plan_data = $thematic->get_thematic_plan_data();
26 26
 		$return = $thematic->get_thematic_plan_div($thematic_plan_data);
27 27
 		echo $return[$_REQUEST['thematic_id']];*/
28
-		break;
29
-	case 'save_thematic_advance':
30
-		if (!api_is_allowed_to_edit(null, true)) {
31
-			echo '';
32
-			exit;
33
-		}
34
-		/*
28
+        break;
29
+    case 'save_thematic_advance':
30
+        if (!api_is_allowed_to_edit(null, true)) {
31
+            echo '';
32
+            exit;
33
+        }
34
+        /*
35 35
         if (($_REQUEST['start_date_type'] == 1 && empty($_REQUEST['start_date_by_attendance'])) || (!empty($_REQUEST['duration_in_hours']) && !is_numeric($_REQUEST['duration_in_hours'])) ) {
36 36
             if ($_REQUEST['start_date_type'] == 1 && empty($_REQUEST['start_date_by_attendance'])) {
37 37
                 $start_date_error = true;
@@ -79,80 +79,80 @@  discard block
 block discarded – undo
79 79
         $thematic_advance_data = $thematic->get_thematic_advance_list(null, null, true);
80 80
         $return = $thematic->get_thematic_advance_div($thematic_advance_data);
81 81
         echo $return[$_REQUEST['thematic_id']][$_REQUEST['thematic_advance_id']];*/
82
-		break;
83
-	case 'get_datetime_by_attendance':
84
-		$attendance_id       = intval($_REQUEST['attendance_id']);
85
-		$thematic_advance_id = intval($_REQUEST['thematic_advance_id']);
82
+        break;
83
+    case 'get_datetime_by_attendance':
84
+        $attendance_id       = intval($_REQUEST['attendance_id']);
85
+        $thematic_advance_id = intval($_REQUEST['thematic_advance_id']);
86 86
 
87
-		$label = '';
88
-		$input_select = '';
89
-		if (!empty($attendance_id)) {
90
-			$attendance = new Attendance();
91
-			$thematic   = new Thematic();
92
-			$thematic_list = $thematic->get_thematic_list();
87
+        $label = '';
88
+        $input_select = '';
89
+        if (!empty($attendance_id)) {
90
+            $attendance = new Attendance();
91
+            $thematic   = new Thematic();
92
+            $thematic_list = $thematic->get_thematic_list();
93 93
 
94
-			$my_list = $thematic_list_temp = array();
95
-			foreach ($thematic_list as $item) {
96
-				$my_list = $thematic->get_thematic_advance_by_thematic_id($item['id']);
97
-				$thematic_list_temp = array_merge($my_list, $thematic_list_temp);
98
-			}
99
-			$new_thematic_list = array();
94
+            $my_list = $thematic_list_temp = array();
95
+            foreach ($thematic_list as $item) {
96
+                $my_list = $thematic->get_thematic_advance_by_thematic_id($item['id']);
97
+                $thematic_list_temp = array_merge($my_list, $thematic_list_temp);
98
+            }
99
+            $new_thematic_list = array();
100 100
 
101
-			foreach($thematic_list_temp as $item) {
102
-				if (!empty($item['attendance_id']) ) {
103
-					$new_thematic_list[$item['id']] = array('attendance_id' =>$item['attendance_id'], 'start_date'=>$item['start_date']);
104
-				}
105
-			}
101
+            foreach($thematic_list_temp as $item) {
102
+                if (!empty($item['attendance_id']) ) {
103
+                    $new_thematic_list[$item['id']] = array('attendance_id' =>$item['attendance_id'], 'start_date'=>$item['start_date']);
104
+                }
105
+            }
106 106
 
107
-			$attendance_calendar = $attendance->get_attendance_calendar($attendance_id);
107
+            $attendance_calendar = $attendance->get_attendance_calendar($attendance_id);
108 108
 
109
-			$label = get_lang('StartDate');
110
-			if (!empty($attendance_calendar)) {
111
-				$input_select .= '<select id="start_date_select_calendar" name="start_date_by_attendance" size="5">';
112
-				foreach ($attendance_calendar as $calendar) {
113
-					$selected = null;
114
-					$insert = true;
115
-					//checking if was already taken
116
-					foreach ($new_thematic_list as $key => $thematic_item) {
117
-						//if ($calendar['db_date_time'] == $thematic_item['start_date'] && $calendar['attendance_id'] == $thematic_item['attendance_id'] ) {
118
-						if ($calendar['db_date_time'] == $thematic_item['start_date'] ) {
119
-							$insert = false;
120
-							if ($thematic_advance_id == $key) {
121
-								$insert = true;
122
-								$selected = 'selected';
123
-							}
124
-							break;
125
-						}
126
-					}
127
-					if ($insert == true) {
128
-						$input_select .= '<option '.$selected.' value="'.$calendar['date_time'].'">'.$calendar['date_time'].'</option>';
129
-					}
130
-				}
131
-				$input_select .= '</select>';
132
-			} else {
133
-				$input_select .= '<em>'.get_lang('ThereAreNoRegisteredDatetimeYet').'</em>';
134
-			}
135
-		}
136
-		?>
109
+            $label = get_lang('StartDate');
110
+            if (!empty($attendance_calendar)) {
111
+                $input_select .= '<select id="start_date_select_calendar" name="start_date_by_attendance" size="5">';
112
+                foreach ($attendance_calendar as $calendar) {
113
+                    $selected = null;
114
+                    $insert = true;
115
+                    //checking if was already taken
116
+                    foreach ($new_thematic_list as $key => $thematic_item) {
117
+                        //if ($calendar['db_date_time'] == $thematic_item['start_date'] && $calendar['attendance_id'] == $thematic_item['attendance_id'] ) {
118
+                        if ($calendar['db_date_time'] == $thematic_item['start_date'] ) {
119
+                            $insert = false;
120
+                            if ($thematic_advance_id == $key) {
121
+                                $insert = true;
122
+                                $selected = 'selected';
123
+                            }
124
+                            break;
125
+                        }
126
+                    }
127
+                    if ($insert == true) {
128
+                        $input_select .= '<option '.$selected.' value="'.$calendar['date_time'].'">'.$calendar['date_time'].'</option>';
129
+                    }
130
+                }
131
+                $input_select .= '</select>';
132
+            } else {
133
+                $input_select .= '<em>'.get_lang('ThereAreNoRegisteredDatetimeYet').'</em>';
134
+            }
135
+        }
136
+        ?>
137 137
 		<div class="form-group">
138 138
 			<label class="col-sm-2 control-label"><?php echo $label ?></label>
139 139
 			<div class="col-sm-10"><?php echo $input_select ?></div>
140 140
 		</div>
141 141
 		<?php
142
-		break;
143
-	case 'update_done_thematic_advance':
144
-		$thematic_advance_id = intval($_GET['thematic_advance_id']);
145
-		$total_average = 0;
146
-		if (!empty($thematic_advance_id)) {
147
-			$thematic = new Thematic();
148
-			$affected_rows  = $thematic->update_done_thematic_advances($thematic_advance_id);
149
-			//if ($affected_rows) {
150
-			$total_average  = $thematic->get_total_average_of_thematic_advances(api_get_course_id(), api_get_session_id());
151
-			//}
152
-		}
153
-		echo $total_average;
154
-		break;
155
-	default:
156
-		echo '';
142
+        break;
143
+    case 'update_done_thematic_advance':
144
+        $thematic_advance_id = intval($_GET['thematic_advance_id']);
145
+        $total_average = 0;
146
+        if (!empty($thematic_advance_id)) {
147
+            $thematic = new Thematic();
148
+            $affected_rows  = $thematic->update_done_thematic_advances($thematic_advance_id);
149
+            //if ($affected_rows) {
150
+            $total_average  = $thematic->get_total_average_of_thematic_advances(api_get_course_id(), api_get_session_id());
151
+            //}
152
+        }
153
+        echo $total_average;
154
+        break;
155
+    default:
156
+        echo '';
157 157
 }
158 158
 exit;
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -98,8 +98,8 @@  discard block
 block discarded – undo
98 98
 			}
99 99
 			$new_thematic_list = array();
100 100
 
101
-			foreach($thematic_list_temp as $item) {
102
-				if (!empty($item['attendance_id']) ) {
101
+			foreach ($thematic_list_temp as $item) {
102
+				if (!empty($item['attendance_id'])) {
103 103
 					$new_thematic_list[$item['id']] = array('attendance_id' =>$item['attendance_id'], 'start_date'=>$item['start_date']);
104 104
 				}
105 105
 			}
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 					//checking if was already taken
116 116
 					foreach ($new_thematic_list as $key => $thematic_item) {
117 117
 						//if ($calendar['db_date_time'] == $thematic_item['start_date'] && $calendar['attendance_id'] == $thematic_item['attendance_id'] ) {
118
-						if ($calendar['db_date_time'] == $thematic_item['start_date'] ) {
118
+						if ($calendar['db_date_time'] == $thematic_item['start_date']) {
119 119
 							$insert = false;
120 120
 							if ($thematic_advance_id == $key) {
121 121
 								$insert = true;
Please login to merge, or discard this patch.
main/inc/ajax/model.ajax.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -731,7 +731,7 @@  discard block
 block discarded – undo
731 731
         }
732 732
 
733 733
         break;
734
-	case 'get_user_skill_ranking':
734
+    case 'get_user_skill_ranking':
735 735
         $columns = array('photo', 'firstname', 'lastname', 'skills_acquired', 'currently_learning', 'rank');
736 736
         $result = $skill->get_user_list_skill_ranking($start, $limit, $sidx, $sord, $whereCondition);
737 737
         $result = msort($result, 'skills_acquired', 'asc');
@@ -1281,7 +1281,7 @@  discard block
 block discarded – undo
1281 1281
 
1282 1282
             if (!empty($item['certif_min_score']) && !empty($item['document_id'])) {
1283 1283
                 $item['certificates'] = Display::return_icon('accept.png', get_lang('WithCertificate'), array(), ICON_SIZE_SMALL);
1284
-                 $item['has_certificates'] = '1';
1284
+                    $item['has_certificates'] = '1';
1285 1285
             } else {
1286 1286
                 $item['certificates'] = Display::return_icon('warning.png', get_lang('NoCertificate'), array(), ICON_SIZE_SMALL);
1287 1287
                 $item['has_certificates'] = '0';
Please login to merge, or discard this patch.
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -11,8 +11,8 @@  discard block
 block discarded – undo
11 11
 $action = $_GET['a'];
12 12
 $page = intval($_REQUEST['page']); //page
13 13
 $limit = intval($_REQUEST['rows']); //quantity of rows
14
-$sidx = $_REQUEST['sidx'];         //index (field) to filter
15
-$sord = $_REQUEST['sord'];         //asc or desc
14
+$sidx = $_REQUEST['sidx']; //index (field) to filter
15
+$sord = $_REQUEST['sord']; //asc or desc
16 16
 
17 17
 if (strpos(strtolower($sidx), 'asc') !== false) {
18 18
     $sidx = str_replace(array('asc', ','), '', $sidx);
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
     $sord = 'desc';
25 25
 }
26 26
 
27
-if (!in_array($sord, array('asc','desc'))) {
27
+if (!in_array($sord, array('asc', 'desc'))) {
28 28
     $sord = 'desc';
29 29
 }
30 30
 
@@ -64,19 +64,19 @@  discard block
 block discarded – undo
64 64
 function getWhereClause($col, $oper, $val)
65 65
 {
66 66
     $ops = array(
67
-        'eq' => '=',        //equal
68
-        'ne' => '<>',       //not equal
69
-        'lt' => '<',        //less than
70
-        'le' => '<=',       //less than or equal
71
-        'gt' => '>',        //greater than
72
-        'ge' => '>=',       //greater than or equal
73
-        'bw' => 'LIKE',     //begins with
67
+        'eq' => '=', //equal
68
+        'ne' => '<>', //not equal
69
+        'lt' => '<', //less than
70
+        'le' => '<=', //less than or equal
71
+        'gt' => '>', //greater than
72
+        'ge' => '>=', //greater than or equal
73
+        'bw' => 'LIKE', //begins with
74 74
         'bn' => 'NOT LIKE', //doesn't begin with
75
-        'in' => 'LIKE',     //is in
75
+        'in' => 'LIKE', //is in
76 76
         'ni' => 'NOT LIKE', //is not in
77
-        'ew' => 'LIKE',     //ends with
77
+        'ew' => 'LIKE', //ends with
78 78
         'en' => 'NOT LIKE', //doesn't end with
79
-        'cn' => 'LIKE',     //contains
79
+        'cn' => 'LIKE', //contains
80 80
         'nc' => 'NOT LIKE'  //doesn't contain
81 81
     );
82 82
 
@@ -100,10 +100,10 @@  discard block
 block discarded – undo
100 100
 
101 101
 // If there is no search request sent by jqgrid, $where should be empty
102 102
 $whereCondition = null;
103
-$operation = isset($_REQUEST['oper'])  ? $_REQUEST['oper']  : false;
104
-$exportFormat = isset($_REQUEST['export_format'])  ? $_REQUEST['export_format']  : 'csv';
105
-$searchField = isset($_REQUEST['searchField'])  ? $_REQUEST['searchField']  : false;
106
-$searchOperator = isset($_REQUEST['searchOper'])   ? $_REQUEST['searchOper']   : false;
103
+$operation = isset($_REQUEST['oper']) ? $_REQUEST['oper'] : false;
104
+$exportFormat = isset($_REQUEST['export_format']) ? $_REQUEST['export_format'] : 'csv';
105
+$searchField = isset($_REQUEST['searchField']) ? $_REQUEST['searchField'] : false;
106
+$searchOperator = isset($_REQUEST['searchOper']) ? $_REQUEST['searchOper'] : false;
107 107
 $searchString = isset($_REQUEST['searchString']) ? $_REQUEST['searchString'] : false;
108 108
 $search = isset($_REQUEST['_search']) ? $_REQUEST['_search'] : false;
109 109
 $forceSearch = isset($_REQUEST['_force_search']) ? $_REQUEST['_force_search'] : false;
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
             foreach ($filters->rules as $key => $rule) {
168 168
                 $whereCondition .= getWhereClause($rule->field, $rule->op, $rule->data);
169 169
 
170
-                if ($counter < count($filters->rules) -1) {
170
+                if ($counter < count($filters->rules) - 1) {
171 171
                     $whereCondition .= $filters->groupOp;
172 172
                 }
173 173
                 $counter++;
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
         $userId = api_get_user_id();
198 198
         $sessionId = isset($_GET['session_id']) ? intval($_GET['session_id']) : 0;
199 199
         $courseCodeList = array();
200
-        $userIdList  = array();
200
+        $userIdList = array();
201 201
         $sessionIdList = [];
202 202
         $searchByGroups = false;
203 203
         if (api_is_drh()) {
@@ -577,7 +577,7 @@  discard block
 block discarded – undo
577 577
 $total_pages = 0;
578 578
 if ($count > 0) {
579 579
     if (!empty($limit)) {
580
-        $total_pages = ceil((float)$count/(float)$limit);
580
+        $total_pages = ceil((float) $count / (float) $limit);
581 581
     }
582 582
 }
583 583
 if ($page > $total_pages) {
@@ -858,10 +858,10 @@  discard block
 block discarded – undo
858 858
     case 'get_work_user_list_others':
859 859
         if (isset($_GET['type']) && $_GET['type'] === 'simple') {
860 860
             $columns = array(
861
-                'type', 'firstname', 'lastname',  'title', 'qualification', 'sent_date', 'qualificator_id', 'actions'
861
+                'type', 'firstname', 'lastname', 'title', 'qualification', 'sent_date', 'qualificator_id', 'actions'
862 862
             );
863 863
         } else {
864
-            $columns = array('type', 'firstname', 'lastname',  'title', 'sent_date', 'actions');
864
+            $columns = array('type', 'firstname', 'lastname', 'title', 'sent_date', 'actions');
865 865
         }
866 866
         $whereCondition .= " AND u.user_id <> ".api_get_user_id();
867 867
         $result = get_work_user_list($start, $limit, $sidx, $sord, $work_id, $whereCondition);
@@ -895,7 +895,7 @@  discard block
 block discarded – undo
895 895
     case 'get_exercise_results':
896 896
         $course = api_get_course_info();
897 897
         // Used inside ExerciseLib::get_exam_results_data()
898
-        $documentPath = api_get_path(SYS_COURSE_PATH) . $course['path'] . "/document";
898
+        $documentPath = api_get_path(SYS_COURSE_PATH).$course['path']."/document";
899 899
         if ($is_allowedToEdit || api_is_student_boss()) {
900 900
             $columns = array(
901 901
                 'firstname',
@@ -920,11 +920,11 @@  discard block
 block discarded – undo
920 920
         break;
921 921
     case 'get_hotpotatoes_exercise_results':
922 922
         $course = api_get_course_info();
923
-        $documentPath = api_get_path(SYS_COURSE_PATH) . $course['path'] . "/document";
923
+        $documentPath = api_get_path(SYS_COURSE_PATH).$course['path']."/document";
924 924
         if (api_is_allowed_to_edit()) {
925
-            $columns = array('firstname', 'lastname', 'username', 'group_name', 'exe_date',  'score', 'actions');
925
+            $columns = array('firstname', 'lastname', 'username', 'group_name', 'exe_date', 'score', 'actions');
926 926
         } else {
927
-            $columns = array('exe_date',  'score', 'actions');
927
+            $columns = array('exe_date', 'score', 'actions');
928 928
         }
929 929
         $result = ExerciseLib::get_exam_results_hotpotatoes_data(
930 930
             $start,
@@ -957,12 +957,12 @@  discard block
 block discarded – undo
957 957
         break;
958 958
     case 'get_hotpotatoes_exercise_results':
959 959
         $course = api_get_course_info();
960
-        $documentPath = api_get_path(SYS_COURSE_PATH) . $course['path'] . "/document";
960
+        $documentPath = api_get_path(SYS_COURSE_PATH).$course['path']."/document";
961 961
 
962 962
         if (api_is_allowed_to_edit(null, true) || api_is_drh()) {
963
-            $columns = array('firstname', 'lastname', 'username', 'group_name', 'exe_date',  'score', 'actions');
963
+            $columns = array('firstname', 'lastname', 'username', 'group_name', 'exe_date', 'score', 'actions');
964 964
         } else {
965
-            $columns = array('exe_date',  'score', 'actions');
965
+            $columns = array('exe_date', 'score', 'actions');
966 966
         }
967 967
         $result = ExerciseLib::get_exam_results_hotpotatoes_data(
968 968
             $start,
@@ -998,7 +998,7 @@  discard block
 block discarded – undo
998 998
             );
999 999
         }
1000 1000
 
1001
-        $columns =  array(
1001
+        $columns = array(
1002 1002
             'name',
1003 1003
             'date',
1004 1004
             'course_per_session',
@@ -1034,11 +1034,11 @@  discard block
 block discarded – undo
1034 1034
                 $detailButtons = [];
1035 1035
                 $detailButtons[] = Display::url(
1036 1036
                     Display::return_icon('works.png', get_lang('Works')),
1037
-                    api_get_path(WEB_CODE_PATH) . 'mySpace/works_in_session_report.php'
1037
+                    api_get_path(WEB_CODE_PATH).'mySpace/works_in_session_report.php'
1038 1038
                 );
1039 1039
                 $detailButtons[] = Display::url(
1040 1040
                     Display::return_icon('2rightarrow.png'),
1041
-                    api_get_path(WEB_CODE_PATH) . 'mySpace/course.php?session_id=' . $session['id']
1041
+                    api_get_path(WEB_CODE_PATH).'mySpace/course.php?session_id='.$session['id']
1042 1042
                 );
1043 1043
 
1044 1044
                 $result[] = array(
@@ -1354,7 +1354,7 @@  discard block
 block discarded – undo
1354 1354
         $result = $new_result;
1355 1355
         break;
1356 1356
     case 'get_gradebooks':
1357
-        $columns = array('name', 'certificates','skills', 'actions', 'has_certificates');
1357
+        $columns = array('name', 'certificates', 'skills', 'actions', 'has_certificates');
1358 1358
         if (!in_array($sidx, $columns)) {
1359 1359
             $sidx = 'name';
1360 1360
         }
@@ -1527,7 +1527,7 @@  discard block
 block discarded – undo
1527 1527
                     if (!empty($exercises[$cnt - 4]['title'])) {
1528 1528
                         $title = ucwords(strtolower(trim($exercises[$cnt - 4]['title'])));
1529 1529
                     }
1530
-                    $columns[] = 'exer' . $i;
1530
+                    $columns[] = 'exer'.$i;
1531 1531
                     $column_names[] = $title;
1532 1532
                     $i++;
1533 1533
                     break;
@@ -1560,7 +1560,7 @@  discard block
 block discarded – undo
1560 1560
             $sessionInfo = SessionManager::fetch($listUserSess[$user['user_id']]['id_session']);
1561 1561
             $result[$i]['session'] = $sessionInfo['name'];
1562 1562
             $result[$i]['username'] = $user['username'];
1563
-            $result[$i]['name'] = $user['lastname'] . " " . $user['firstname'];
1563
+            $result[$i]['name'] = $user['lastname']." ".$user['firstname'];
1564 1564
             $j = 1;
1565 1565
             $finalScore = 0;
1566 1566
             foreach ($quizIds as $quizID) {
@@ -1568,7 +1568,7 @@  discard block
 block discarded – undo
1568 1568
                 if (!empty($arrGrade [$user['user_id']][$quizID]) || $arrGrade [$user['user_id']][$quizID] == 0) {
1569 1569
                     $finalScore += $grade = $arrGrade [$user['user_id']][$quizID];
1570 1570
                 }
1571
-                $result[$i]['exer' . $j] = $grade;
1571
+                $result[$i]['exer'.$j] = $grade;
1572 1572
                 $j++;
1573 1573
             }
1574 1574
 
@@ -1736,9 +1736,9 @@  discard block
 block discarded – undo
1736 1736
         foreach ($result as $row) {
1737 1737
             // if results tab give not id, set id to $i otherwise id="null" for all <tr> of the jqgrid - ref #4235
1738 1738
             if (!isset($row['id']) || isset($row['id']) && $row['id'] == '') {
1739
-                $response->rows[$i]['id']= $i;
1739
+                $response->rows[$i]['id'] = $i;
1740 1740
             } else {
1741
-                $response->rows[$i]['id']= $row['id'];
1741
+                $response->rows[$i]['id'] = $row['id'];
1742 1742
             }
1743 1743
             $array = array();
1744 1744
             foreach ($columns as $col) {
@@ -1748,7 +1748,7 @@  discard block
 block discarded – undo
1748 1748
                     $array[] = isset($row[$col]) ? Security::remove_XSS($row[$col]) : '';
1749 1749
                 }
1750 1750
             }
1751
-            $response->rows[$i]['cell']=$array;
1751
+            $response->rows[$i]['cell'] = $array;
1752 1752
             $i++;
1753 1753
         }
1754 1754
     }
Please login to merge, or discard this patch.
main/inc/local.inc.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -758,7 +758,7 @@
 block discarded – undo
758 758
     //    $gidReset = true;
759 759
 } // end else
760 760
 
761
- // Now check for anonymous user mode
761
+    // Now check for anonymous user mode
762 762
 if (isset($use_anonymous) && $use_anonymous) {
763 763
     //if anonymous mode is set, then try to set the current user as anonymous
764 764
     //if he doesn't have a login yet
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 
217 217
             // is necessary verify check
218 218
             if ($legal_type == 1) {
219
-                if ((isset($_POST['legal_accept']) && $_POST['legal_accept']=='1')) {
219
+                if ((isset($_POST['legal_accept']) && $_POST['legal_accept'] == '1')) {
220 220
                     $legal_option = true;
221 221
                 } else {
222 222
                     $legal_option = false;
@@ -518,7 +518,7 @@  discard block
 block discarded – undo
518 518
                  * Process external authentication
519 519
                  * on the basis of the given login name
520 520
                  */
521
-                $loginFailed = true;  // Default initialisation. It could
521
+                $loginFailed = true; // Default initialisation. It could
522 522
                 // change after the external authentication
523 523
                 $key = $uData['auth_source']; //'ldap','shibboleth'...
524 524
                 /* >>>>>>>> External authentication modules <<<<<<<<< */
@@ -537,7 +537,7 @@  discard block
 block discarded – undo
537 537
             }
538 538
         } else {
539 539
             // login failed, Database::num_rows($result) <= 0
540
-            $loginFailed = true;  // Default initialisation. It could
540
+            $loginFailed = true; // Default initialisation. It could
541 541
             // change after the external authentication
542 542
 
543 543
             /*
@@ -563,7 +563,7 @@  discard block
 block discarded – undo
563 563
                         include_once($thisAuthSource['newUser']);
564 564
                     } else {
565 565
                         error_log(
566
-                            'Chamilo Authentication external file' .
566
+                            'Chamilo Authentication external file'.
567 567
                             ' could not be found - this might prevent your system from using'.
568 568
                             ' the authentication process in the user creation process',
569 569
                             0
@@ -672,7 +672,7 @@  discard block
 block discarded – undo
672 672
             online_logout(null, false);
673 673
             $osso->logout(); //redirects and exits
674 674
         }
675
-    } elseif (api_get_setting('openid_authentication')=='true') {
675
+    } elseif (api_get_setting('openid_authentication') == 'true') {
676 676
         if (!empty($_POST['openid_url'])) {
677 677
             include api_get_path(SYS_CODE_PATH).'auth/openid/login.php';
678 678
             openid_begin(trim($_POST['openid_url']), api_get_path(WEB_PATH).'index.php');
@@ -685,7 +685,7 @@  discard block
 block discarded – undo
685 685
             if ($res['status'] == 'success') {
686 686
                 $id1 = Database::escape_string($res['openid.identity']);
687 687
                 //have another id with or without the final '/'
688
-                $id2 = (substr($id1, -1, 1)=='/'?substr($id1, 0, -1):$id1.'/');
688
+                $id2 = (substr($id1, -1, 1) == '/' ? substr($id1, 0, -1) : $id1.'/');
689 689
                 //lookup the user in the main database
690 690
                 $user_table = Database::get_main_table(TABLE_MAIN_USER);
691 691
                 $sql = "SELECT user_id, username, password, auth_source, active, expiration_date
@@ -694,14 +694,14 @@  discard block
 block discarded – undo
694 694
                         OR openid = '$id2' ";
695 695
                 $result = Database::query($sql);
696 696
                 if ($result !== false) {
697
-                    if (Database::num_rows($result)>0) {
697
+                    if (Database::num_rows($result) > 0) {
698 698
                         $uData = Database::fetch_array($result);
699 699
 
700 700
                         if ($uData['auth_source'] == PLATFORM_AUTH_SOURCE) {
701 701
                             //the authentification of this user is managed by Chamilo itself
702 702
 
703 703
                             // check if the account is active (not locked)
704
-                            if ($uData['active']=='1') {
704
+                            if ($uData['active'] == '1') {
705 705
                                 // check if the expiration date has not been reached
706 706
                                 if ($uData['expiration_date'] > date('Y-m-d H:i:s')
707 707
                                     || empty($uData['expiration_date'])
@@ -780,7 +780,7 @@  discard block
 block discarded – undo
780 780
     (isset($_SESSION['_cid']) && $cidReq != $_SESSION['_cid']))
781 781
 ) {
782 782
     $cidReset = true;
783
-    $gidReset = true;    // As groups depend from courses, group id is reset
783
+    $gidReset = true; // As groups depend from courses, group id is reset
784 784
 }
785 785
 
786 786
 /* USER INIT */
@@ -930,8 +930,8 @@  discard block
 block discarded – undo
930 930
             $tbl_session_course_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
931 931
 
932 932
             if (!empty($_GET['id_session'])) {
933
-                $sql = 'SELECT name FROM '.$tbl_session . '
934
-                        WHERE id="'.intval($_GET['id_session']) . '"';
933
+                $sql = 'SELECT name FROM '.$tbl_session.'
934
+                        WHERE id="'.intval($_GET['id_session']).'"';
935 935
                 $rs = Database::query($sql);
936 936
                 if (Database::num_rows($rs)) {
937 937
                     list($_SESSION['session_name']) = Database::fetch_array($rs);
@@ -1019,7 +1019,7 @@  discard block
 block discarded – undo
1019 1019
         // Moreover, if we want to track a course with another session it can be usefull
1020 1020
         if (!empty($_GET['id_session']) && is_numeric($_GET['id_session'])) {
1021 1021
             $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
1022
-            $sql = 'SELECT name FROM '.$tbl_session . ' WHERE id="'.intval($_GET['id_session']). '"';
1022
+            $sql = 'SELECT name FROM '.$tbl_session.' WHERE id="'.intval($_GET['id_session']).'"';
1023 1023
             $rs = Database::query($sql);
1024 1024
             if (Database::num_rows($rs)) {
1025 1025
                 list($_SESSION['session_name']) = Database::fetch_array($rs);
@@ -1144,7 +1144,7 @@  discard block
 block discarded – undo
1144 1144
                     }
1145 1145
                 }
1146 1146
                 $url = api_get_path(WEB_CODE_PATH).'auth/inscription.php';
1147
-                header("Location:". $url);
1147
+                header("Location:".$url);
1148 1148
                 exit;
1149 1149
             }
1150 1150
         }
@@ -1165,8 +1165,8 @@  discard block
 block discarded – undo
1165 1165
         if (Database::num_rows($result) > 0) { // this  user have a recorded state for this course
1166 1166
             $cuData = Database::fetch_array($result, 'ASSOC');
1167 1167
 
1168
-            $is_courseAdmin = (bool)($cuData['status'] == 1);
1169
-            $is_courseTutor = (bool)($cuData['is_tutor'] == 1);
1168
+            $is_courseAdmin = (bool) ($cuData['status'] == 1);
1169
+            $is_courseTutor = (bool) ($cuData['is_tutor'] == 1);
1170 1170
             $is_courseMember = true;
1171 1171
         }
1172 1172
 
@@ -1177,7 +1177,7 @@  discard block
 block discarded – undo
1177 1177
                 // This user has no status related to this course
1178 1178
                 // The user is subscribed in a session? The user is a Session coach a Session admin ?
1179 1179
 
1180
-                $tbl_session  = Database :: get_main_table(TABLE_MAIN_SESSION);
1180
+                $tbl_session = Database :: get_main_table(TABLE_MAIN_SESSION);
1181 1181
                 $tbl_session_course = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE);
1182 1182
                 $tbl_session_course_user = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
1183 1183
 
@@ -1290,7 +1290,7 @@  discard block
 block discarded – undo
1290 1290
 
1291 1291
             //If I'm the admin platform i'm a teacher of the course
1292 1292
             if ($is_platformAdmin) {
1293
-                $is_courseAdmin     = true;
1293
+                $is_courseAdmin = true;
1294 1294
             }
1295 1295
         }
1296 1296
     } else { // keys missing => not anymore in the course - user relation
@@ -1448,12 +1448,12 @@  discard block
 block discarded – undo
1448 1448
     ($logging_in && exist_firstpage_parameter())
1449 1449
 ) {
1450 1450
     $redirectCourseDir = api_get_firstpage_parameter();
1451
-    api_delete_firstpage_parameter();    // delete the cookie
1451
+    api_delete_firstpage_parameter(); // delete the cookie
1452 1452
 
1453 1453
     if (!isset($_SESSION['request_uri'])) {
1454 1454
         if (CourseManager::get_course_id_from_path($redirectCourseDir)) {
1455 1455
             $_SESSION['noredirection'] = false;
1456
-            $_SESSION['request_uri'] = api_get_path(WEB_COURSE_PATH) . $redirectCourseDir . '/';
1456
+            $_SESSION['request_uri'] = api_get_path(WEB_COURSE_PATH).$redirectCourseDir.'/';
1457 1457
         }
1458 1458
     }
1459 1459
 } elseif (api_user_is_login() && exist_firstpage_parameter()) {
@@ -1461,7 +1461,7 @@  discard block
 block discarded – undo
1461 1461
     api_delete_firstpage_parameter(); // delete the cookie
1462 1462
     if (CourseManager::get_course_id_from_path($redirectCourseDir)) {
1463 1463
         $_SESSION['noredirection'] = false;
1464
-        $_SESSION['request_uri'] = api_get_path(WEB_COURSE_PATH) . $redirectCourseDir . '/';
1464
+        $_SESSION['request_uri'] = api_get_path(WEB_COURSE_PATH).$redirectCourseDir.'/';
1465 1465
     }
1466 1466
 }
1467 1467
 
Please login to merge, or discard this patch.
main/inc/lib/AnnouncementEmail.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -196,7 +196,7 @@
 block discarded – undo
196 196
      *
197 197
      * @return array
198 198
      */
199
-    public function sender($key = '',  $userId = '')
199
+    public function sender($key = '', $userId = '')
200 200
     {
201 201
         $_user = api_get_user_info($userId);
202 202
 
Please login to merge, or discard this patch.
main/inc/lib/custom_pages.class.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
      */
36 36
     public static function path($name = '')
37 37
     {
38
-        return api_get_path(SYS_PATH) . 'custompages/' . $name;
38
+        return api_get_path(SYS_PATH).'custompages/'.$name;
39 39
     }
40 40
 
41 41
     /**
@@ -50,12 +50,12 @@  discard block
 block discarded – undo
50 50
             return false;
51 51
         }
52 52
 
53
-        $file = self::path($page_name . '.php');
53
+        $file = self::path($page_name.'.php');
54 54
         if (file_exists($file)) {
55 55
             include($file);
56 56
             exit;
57 57
         } else {
58
-            error_log('CustomPages::displayPage : could not read file ' . $file);
58
+            error_log('CustomPages::displayPage : could not read file '.$file);
59 59
         }
60 60
     }
61 61
 
@@ -69,14 +69,14 @@  discard block
 block discarded – undo
69 69
     public static function getURLImages($url_id = null)
70 70
     {
71 71
         if (is_null($url_id)) {
72
-            $url = 'http://' . $_SERVER['HTTP_HOST'] . '/';
72
+            $url = 'http://'.$_SERVER['HTTP_HOST'].'/';
73 73
             $url_id = UrlManager::get_url_id($url);
74 74
         }
75
-        $url_images_dir = api_get_path(SYS_PATH) . 'custompages/url-images/';
75
+        $url_images_dir = api_get_path(SYS_PATH).'custompages/url-images/';
76 76
         $images = array();
77 77
         for ($img_id = 1; $img_id <= 3; $img_id++) {
78
-            if (file_exists($url_images_dir . $url_id . '_url_image_' . $img_id . '.png')) {
79
-                $images[] = api_get_path(WEB_PATH) . 'custompages/url-images/' . $url_id . '_url_image_' . $img_id . '.png';
78
+            if (file_exists($url_images_dir.$url_id.'_url_image_'.$img_id.'.png')) {
79
+                $images[] = api_get_path(WEB_PATH).'custompages/url-images/'.$url_id.'_url_image_'.$img_id.'.png';
80 80
             }
81 81
         }
82 82
 
Please login to merge, or discard this patch.
main/inc/lib/usermanager.lib.php 4 patches
Braces   +97 added lines, -62 removed lines patch added patch discarded remove patch
@@ -774,10 +774,12 @@  discard block
 block discarded – undo
774 774
     public static function update_openid($user_id, $openid)
775 775
     {
776 776
         $table_user = Database :: get_main_table(TABLE_MAIN_USER);
777
-        if ($user_id != strval(intval($user_id)))
778
-            return false;
779
-        if ($user_id === false)
780
-            return false;
777
+        if ($user_id != strval(intval($user_id))) {
778
+                    return false;
779
+        }
780
+        if ($user_id === false) {
781
+                    return false;
782
+        }
781 783
         $sql = "UPDATE $table_user SET
782 784
                 openid='".Database::escape_string($openid)."'";
783 785
         $sql .= " WHERE id= $user_id";
@@ -2069,8 +2071,9 @@  discard block
 block discarded – undo
2069 2071
         if (empty($user_id)) {
2070 2072
             $user_id = 0;
2071 2073
         } else {
2072
-            if ($user_id != strval(intval($user_id)))
2073
-                return array();
2074
+            if ($user_id != strval(intval($user_id))) {
2075
+                            return array();
2076
+            }
2074 2077
         }
2075 2078
         $extra_data = array();
2076 2079
         $t_uf = Database::get_main_table(TABLE_EXTRA_FIELD);
@@ -2162,8 +2165,9 @@  discard block
 block discarded – undo
2162 2165
         if (empty($user_id)) {
2163 2166
             $user_id = 0;
2164 2167
         } else {
2165
-            if ($user_id != strval(intval($user_id)))
2166
-                return array();
2168
+            if ($user_id != strval(intval($user_id))) {
2169
+                            return array();
2170
+            }
2167 2171
         }
2168 2172
         $extra_data = array();
2169 2173
         $t_uf = Database::get_main_table(TABLE_EXTRA_FIELD);
@@ -2880,13 +2884,15 @@  discard block
 block discarded – undo
2880 2884
      */
2881 2885
     public static function get_api_keys($user_id = null, $api_service = 'dokeos')
2882 2886
     {
2883
-        if ($user_id != strval(intval($user_id)))
2884
-            return false;
2887
+        if ($user_id != strval(intval($user_id))) {
2888
+                    return false;
2889
+        }
2885 2890
         if (empty($user_id)) {
2886 2891
             $user_id = api_get_user_id();
2887 2892
         }
2888
-        if ($user_id === false)
2889
-            return false;
2893
+        if ($user_id === false) {
2894
+                    return false;
2895
+        }
2890 2896
         $service_name = Database::escape_string($api_service);
2891 2897
         if (is_string($service_name) === false) {
2892 2898
             return false;
@@ -2894,11 +2900,14 @@  discard block
 block discarded – undo
2894 2900
         $t_api = Database::get_main_table(TABLE_MAIN_USER_API_KEY);
2895 2901
         $sql = "SELECT * FROM $t_api WHERE user_id = $user_id AND api_service='$api_service';";
2896 2902
         $res = Database::query($sql);
2897
-        if ($res === false)
2898
-            return false; //error during query
2903
+        if ($res === false) {
2904
+                    return false;
2905
+        }
2906
+        //error during query
2899 2907
         $num = Database::num_rows($res);
2900
-        if ($num == 0)
2901
-            return false;
2908
+        if ($num == 0) {
2909
+                    return false;
2910
+        }
2902 2911
         $list = array();
2903 2912
         while ($row = Database::fetch_array($res)) {
2904 2913
             $list[$row['id']] = $row['api_key'];
@@ -2913,13 +2922,15 @@  discard block
 block discarded – undo
2913 2922
      */
2914 2923
     public static function add_api_key($user_id = null, $api_service = 'dokeos')
2915 2924
     {
2916
-        if ($user_id != strval(intval($user_id)))
2917
-            return false;
2925
+        if ($user_id != strval(intval($user_id))) {
2926
+                    return false;
2927
+        }
2918 2928
         if (empty($user_id)) {
2919 2929
             $user_id = api_get_user_id();
2920 2930
         }
2921
-        if ($user_id === false)
2922
-            return false;
2931
+        if ($user_id === false) {
2932
+                    return false;
2933
+        }
2923 2934
         $service_name = Database::escape_string($api_service);
2924 2935
         if (is_string($service_name) === false) {
2925 2936
             return false;
@@ -2928,8 +2939,10 @@  discard block
 block discarded – undo
2928 2939
         $md5 = md5((time() + ($user_id * 5)) - rand(10000, 10000)); //generate some kind of random key
2929 2940
         $sql = "INSERT INTO $t_api (user_id, api_key,api_service) VALUES ($user_id,'$md5','$service_name')";
2930 2941
         $res = Database::query($sql);
2931
-        if ($res === false)
2932
-            return false; //error during query
2942
+        if ($res === false) {
2943
+                    return false;
2944
+        }
2945
+        //error during query
2933 2946
         $num = Database::insert_id();
2934 2947
         return ($num == 0) ? false : $num;
2935 2948
     }
@@ -2941,22 +2954,29 @@  discard block
 block discarded – undo
2941 2954
      */
2942 2955
     public static function delete_api_key($key_id)
2943 2956
     {
2944
-        if ($key_id != strval(intval($key_id)))
2945
-            return false;
2946
-        if ($key_id === false)
2947
-            return false;
2957
+        if ($key_id != strval(intval($key_id))) {
2958
+                    return false;
2959
+        }
2960
+        if ($key_id === false) {
2961
+                    return false;
2962
+        }
2948 2963
         $t_api = Database::get_main_table(TABLE_MAIN_USER_API_KEY);
2949 2964
         $sql = "SELECT * FROM $t_api WHERE id = ".$key_id;
2950 2965
         $res = Database::query($sql);
2951
-        if ($res === false)
2952
-            return false; //error during query
2966
+        if ($res === false) {
2967
+                    return false;
2968
+        }
2969
+        //error during query
2953 2970
         $num = Database::num_rows($res);
2954
-        if ($num !== 1)
2955
-            return false;
2971
+        if ($num !== 1) {
2972
+                    return false;
2973
+        }
2956 2974
         $sql = "DELETE FROM $t_api WHERE id = ".$key_id;
2957 2975
         $res = Database::query($sql);
2958
-        if ($res === false)
2959
-            return false; //error during query
2976
+        if ($res === false) {
2977
+                    return false;
2978
+        }
2979
+        //error during query
2960 2980
         return true;
2961 2981
     }
2962 2982
 
@@ -2968,10 +2988,12 @@  discard block
 block discarded – undo
2968 2988
      */
2969 2989
     public static function update_api_key($user_id, $api_service)
2970 2990
     {
2971
-        if ($user_id != strval(intval($user_id)))
2972
-            return false;
2973
-        if ($user_id === false)
2974
-            return false;
2991
+        if ($user_id != strval(intval($user_id))) {
2992
+                    return false;
2993
+        }
2994
+        if ($user_id === false) {
2995
+                    return false;
2996
+        }
2975 2997
         $service_name = Database::escape_string($api_service);
2976 2998
         if (is_string($service_name) === false) {
2977 2999
             return false;
@@ -2997,12 +3019,15 @@  discard block
 block discarded – undo
2997 3019
      */
2998 3020
     public static function get_api_key_id($user_id, $api_service)
2999 3021
     {
3000
-        if ($user_id != strval(intval($user_id)))
3001
-            return false;
3002
-        if ($user_id === false)
3003
-            return false;
3004
-        if (empty($api_service))
3005
-            return false;
3022
+        if ($user_id != strval(intval($user_id))) {
3023
+                    return false;
3024
+        }
3025
+        if ($user_id === false) {
3026
+                    return false;
3027
+        }
3028
+        if (empty($api_service)) {
3029
+                    return false;
3030
+        }
3006 3031
         $t_api = Database::get_main_table(TABLE_MAIN_USER_API_KEY);
3007 3032
         $api_service = Database::escape_string($api_service);
3008 3033
         $sql = "SELECT id FROM $t_api WHERE user_id=".$user_id." AND api_service='".$api_service."'";
@@ -4473,8 +4498,9 @@  discard block
 block discarded – undo
4473 4498
                     $form->applyFilter('extra_'.$field_details[1], 'stripslashes');
4474 4499
                     $form->applyFilter('extra_'.$field_details[1], 'trim');
4475 4500
                     if (!$admin_permissions) {
4476
-                        if ($field_details[7] == 0)
4477
-                            $form->freeze('extra_'.$field_details[1]);
4501
+                        if ($field_details[7] == 0) {
4502
+                                                    $form->freeze('extra_'.$field_details[1]);
4503
+                        }
4478 4504
                     }
4479 4505
                     break;
4480 4506
                 case ExtraField::FIELD_TYPE_RADIO:
@@ -4491,8 +4517,9 @@  discard block
 block discarded – undo
4491 4517
                     }
4492 4518
                     $form->addGroup($group, 'extra_'.$field_details[1], $field_details[3], '');
4493 4519
                     if (!$admin_permissions) {
4494
-                        if ($field_details[7] == 0)
4495
-                            $form->freeze('extra_'.$field_details[1]);
4520
+                        if ($field_details[7] == 0) {
4521
+                                                    $form->freeze('extra_'.$field_details[1]);
4522
+                        }
4496 4523
                     }
4497 4524
                     break;
4498 4525
                 case ExtraField::FIELD_TYPE_SELECT:
@@ -4530,8 +4557,9 @@  discard block
 block discarded – undo
4530 4557
                     );
4531 4558
 
4532 4559
                     if (!$admin_permissions) {
4533
-                        if ($field_details[7] == 0)
4534
-                            $form->freeze('extra_'.$field_details[1]);
4560
+                        if ($field_details[7] == 0) {
4561
+                                                    $form->freeze('extra_'.$field_details[1]);
4562
+                        }
4535 4563
                     }
4536 4564
                     break;
4537 4565
                 case ExtraField::FIELD_TYPE_SELECT_MULTIPLE:
@@ -4547,8 +4575,9 @@  discard block
 block discarded – undo
4547 4575
                         array('multiple' => 'multiple')
4548 4576
                     );
4549 4577
                     if (!$admin_permissions) {
4550
-                        if ($field_details[7] == 0)
4551
-                            $form->freeze('extra_'.$field_details[1]);
4578
+                        if ($field_details[7] == 0) {
4579
+                                                    $form->freeze('extra_'.$field_details[1]);
4580
+                        }
4552 4581
                     }
4553 4582
                     break;
4554 4583
                 case ExtraField::FIELD_TYPE_DATE:
@@ -4556,8 +4585,9 @@  discard block
 block discarded – undo
4556 4585
                     $defaults['extra_'.$field_details[1]] = date('Y-m-d 12:00:00');
4557 4586
                     $form->setDefaults($defaults);
4558 4587
                     if (!$admin_permissions) {
4559
-                        if ($field_details[7] == 0)
4560
-                            $form->freeze('extra_'.$field_details[1]);
4588
+                        if ($field_details[7] == 0) {
4589
+                                                    $form->freeze('extra_'.$field_details[1]);
4590
+                        }
4561 4591
                     }
4562 4592
                     $form->applyFilter('theme', 'trim');
4563 4593
                     break;
@@ -4566,8 +4596,9 @@  discard block
 block discarded – undo
4566 4596
                     $defaults['extra_'.$field_details[1]] = date('Y-m-d 12:00:00');
4567 4597
                     $form->setDefaults($defaults);
4568 4598
                     if (!$admin_permissions) {
4569
-                        if ($field_details[7] == 0)
4570
-                            $form->freeze('extra_'.$field_details[1]);
4599
+                        if ($field_details[7] == 0) {
4600
+                                                    $form->freeze('extra_'.$field_details[1]);
4601
+                        }
4571 4602
                     }
4572 4603
                     $form->applyFilter('theme', 'trim');
4573 4604
                     break;
@@ -4586,8 +4617,9 @@  discard block
 block discarded – undo
4586 4617
                     $form->addGroup($group, 'extra_'.$field_details[1], $field_details[3], '&nbsp;');
4587 4618
 
4588 4619
                     if (!$admin_permissions) {
4589
-                        if ($field_details[7] == 0)
4590
-                            $form->freeze('extra_'.$field_details[1]);
4620
+                        if ($field_details[7] == 0) {
4621
+                                                    $form->freeze('extra_'.$field_details[1]);
4622
+                        }
4591 4623
                     }
4592 4624
 
4593 4625
                     /* Recoding the selected values for double : if the user has
@@ -4647,8 +4679,9 @@  discard block
 block discarded – undo
4647 4679
                     break;
4648 4680
                 case ExtraField::FIELD_TYPE_TIMEZONE:
4649 4681
                     $form->addElement('select', 'extra_'.$field_details[1], $field_details[3], api_get_timezones(), '');
4650
-                    if ($field_details[7] == 0)
4651
-                        $form->freeze('extra_'.$field_details[1]);
4682
+                    if ($field_details[7] == 0) {
4683
+                                            $form->freeze('extra_'.$field_details[1]);
4684
+                    }
4652 4685
                     break;
4653 4686
                 case ExtraField::FIELD_TYPE_SOCIAL_PROFILE:
4654 4687
                     // get the social network's favicon
@@ -4673,8 +4706,9 @@  discard block
 block discarded – undo
4673 4706
                     );
4674 4707
                     $form->applyFilter('extra_'.$field_details[1], 'stripslashes');
4675 4708
                     $form->applyFilter('extra_'.$field_details[1], 'trim');
4676
-                    if ($field_details[7] == 0)
4677
-                        $form->freeze('extra_'.$field_details[1]);
4709
+                    if ($field_details[7] == 0) {
4710
+                                            $form->freeze('extra_'.$field_details[1]);
4711
+                    }
4678 4712
                     break;
4679 4713
                 case ExtraField::FIELD_TYPE_FILE:
4680 4714
                     $extra_field = 'extra_'.$field_details[1];
@@ -4991,8 +5025,9 @@  discard block
 block discarded – undo
4991 5025
         $url .= "?s=$s&d=$d&r=$r";
4992 5026
         if ( $img ) {
4993 5027
             $url = '<img src="' . $url . '"';
4994
-            foreach ( $atts as $key => $val )
4995
-                $url .= ' ' . $key . '="' . $val . '"';
5028
+            foreach ( $atts as $key => $val ) {
5029
+                            $url .= ' ' . $key . '="' . $val . '"';
5030
+            }
4996 5031
             $url .= ' />';
4997 5032
         }
4998 5033
         return $url;
Please login to merge, or discard this patch.
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
     const USER_FIELD_TYPE_TIMEZONE = 11;
35 35
     const USER_FIELD_TYPE_SOCIAL_PROFILE = 12;
36 36
     const USER_FIELD_TYPE_FILE = 13;
37
-    const USER_FIELD_TYPE_MOBILE_PHONE_NUMBER  = 14;
37
+    const USER_FIELD_TYPE_MOBILE_PHONE_NUMBER = 14;
38 38
 
39 39
     private static $encryptionMethod;
40 40
 
@@ -506,7 +506,7 @@  discard block
 block discarded – undo
506 506
         $res = Database::query($sql);
507 507
         while ($course = Database::fetch_object($res)) {
508 508
             $sql = "SELECT id FROM $table_course_user
509
-                    WHERE status=1 AND c_id = " . intval($course->c_id);
509
+                    WHERE status=1 AND c_id = ".intval($course->c_id);
510 510
             $res2 = Database::query($sql);
511 511
             if (Database::num_rows($res2) == 1) {
512 512
 
@@ -770,7 +770,7 @@  discard block
 block discarded – undo
770 770
         $sql = "UPDATE $table_user SET active = 1 WHERE id IN ($ids)";
771 771
         $r = Database::query($sql);
772 772
         if ($r !== false) {
773
-            Event::addEvent(LOG_USER_ENABLE,LOG_USER_ID,$ids);
773
+            Event::addEvent(LOG_USER_ENABLE, LOG_USER_ID, $ids);
774 774
         }
775 775
         return $r;
776 776
     }
@@ -1176,7 +1176,7 @@  discard block
 block discarded – undo
1176 1176
             // 1. Conversion of unacceptable letters (latinian letters with accents for example) into ASCII letters in order they not to be totally removed.
1177 1177
             // 2. Applying the strict purifier.
1178 1178
             // 3. Length limitation.
1179
-            $return  = api_get_setting('login_is_email') == 'true' ? substr(preg_replace(USERNAME_PURIFIER_MAIL, '', $username), 0, USERNAME_MAX_LENGTH) : substr(preg_replace(USERNAME_PURIFIER, '', $username), 0, USERNAME_MAX_LENGTH);
1179
+            $return = api_get_setting('login_is_email') == 'true' ? substr(preg_replace(USERNAME_PURIFIER_MAIL, '', $username), 0, USERNAME_MAX_LENGTH) : substr(preg_replace(USERNAME_PURIFIER, '', $username), 0, USERNAME_MAX_LENGTH);
1180 1180
             $return = URLify::transliterate($return);
1181 1181
             return $return;
1182 1182
         }
@@ -1268,12 +1268,12 @@  discard block
 block discarded – undo
1268 1268
 
1269 1269
         if (!is_null($order)) {
1270 1270
             $order = Database::escape_string($order);
1271
-            $sql .= ' ORDER BY ' . $order;
1271
+            $sql .= ' ORDER BY '.$order;
1272 1272
         }
1273 1273
 
1274 1274
         if (!is_null($limit)) {
1275 1275
             $limit = Database::escape_string($limit);
1276
-            $sql .= ' LIMIT ' . $limit;
1276
+            $sql .= ' LIMIT '.$limit;
1277 1277
         }
1278 1278
 
1279 1279
         $rs = Database::query($sql);
@@ -1462,7 +1462,7 @@  discard block
 block discarded – undo
1462 1462
             // directory might not have been created. Make sure it is before
1463 1463
             // going further.
1464 1464
 
1465
-            $rootPath = api_get_path(SYS_UPLOAD_PATH) . 'users/' . substr((string) $id, 0, 1);
1465
+            $rootPath = api_get_path(SYS_UPLOAD_PATH).'users/'.substr((string) $id, 0, 1);
1466 1466
             if (!is_dir($rootPath)) {
1467 1467
                 $perm = api_get_permissions_for_new_directories();
1468 1468
                 try {
@@ -1710,7 +1710,7 @@  discard block
 block discarded – undo
1710 1710
         $path_info = self::get_user_picture_path_by_id($user_id, 'system');
1711 1711
         $path = $path_info['dir'];
1712 1712
         if (!empty($extra_field)) {
1713
-            $path .= $extra_field . '/';
1713
+            $path .= $extra_field.'/';
1714 1714
         }
1715 1715
         // If this directory does not exist - we create it.
1716 1716
         if (!file_exists($path)) {
@@ -1718,7 +1718,7 @@  discard block
 block discarded – undo
1718 1718
         }
1719 1719
 
1720 1720
         if (filter_extension($file)) {
1721
-            if (@move_uploaded_file($source_file,$path.$file)) {
1721
+            if (@move_uploaded_file($source_file, $path.$file)) {
1722 1722
                 if ($extra_field) {
1723 1723
                     return $extra_field.'/'.$file;
1724 1724
                 } else {
@@ -1971,10 +1971,10 @@  discard block
 block discarded – undo
1971 1971
         if (count($extra_files) > 0) {
1972 1972
             $extra_file_list = '<div class="files-production"><ul id="productions">';
1973 1973
             foreach ($extra_files as $file) {
1974
-                $filename = substr($file,strlen($extra_field)+1);
1974
+                $filename = substr($file, strlen($extra_field) + 1);
1975 1975
                 $extra_file_list .= '<li>'.Display::return_icon('archive.png').'<a href="'.$path.$extra_field.'/'.urlencode($filename).'" target="_blank">'.htmlentities($filename).'</a> ';
1976 1976
                 if ($showdelete) {
1977
-                    $extra_file_list .= '<input style="width:16px;" type="image" name="remove_extra_' . $extra_field . '['.urlencode($file).']" src="'.$del_image.'" alt="'.$del_text.'" title="'.$del_text.' '.htmlentities($filename).'" onclick="javascript: return confirmation(\''.htmlentities($filename).'\');" /></li>';
1977
+                    $extra_file_list .= '<input style="width:16px;" type="image" name="remove_extra_'.$extra_field.'['.urlencode($file).']" src="'.$del_image.'" alt="'.$del_text.'" title="'.$del_text.' '.htmlentities($filename).'" onclick="javascript: return confirmation(\''.htmlentities($filename).'\');" /></li>';
1978 1978
                 }
1979 1979
             }
1980 1980
             $extra_file_list .= '</ul></div>';
@@ -2563,7 +2563,7 @@  discard block
 block discarded – undo
2563 2563
 
2564 2564
         if (api_is_allowed_to_create_course()) {
2565 2565
             $sessionListFromCourseCoach = array();
2566
-            $sql =" SELECT DISTINCT session_id
2566
+            $sql = " SELECT DISTINCT session_id
2567 2567
                     FROM $tbl_session_course_user
2568 2568
                     WHERE user_id = $user_id AND status = 2 ";
2569 2569
 
@@ -2571,7 +2571,7 @@  discard block
 block discarded – undo
2571 2571
             if (Database::num_rows($result)) {
2572 2572
                 $result = Database::store_result($result);
2573 2573
                 foreach ($result as $session) {
2574
-                    $sessionListFromCourseCoach[]= $session['session_id'];
2574
+                    $sessionListFromCourseCoach[] = $session['session_id'];
2575 2575
                 }
2576 2576
             }
2577 2577
             if (!empty($sessionListFromCourseCoach)) {
@@ -2594,7 +2594,7 @@  discard block
 block discarded – undo
2594 2594
                 ORDER BY access_start_date, access_end_date, name";
2595 2595
 
2596 2596
         $result = Database::query($sql);
2597
-        if (Database::num_rows($result)>0) {
2597
+        if (Database::num_rows($result) > 0) {
2598 2598
             while ($row = Database::fetch_assoc($result)) {
2599 2599
                 $sessions[$row['id']] = $row;
2600 2600
             }
@@ -2610,7 +2610,7 @@  discard block
 block discarded – undo
2610 2610
                 ORDER BY access_start_date, access_end_date, name";
2611 2611
 
2612 2612
         $result = Database::query($sql);
2613
-        if (Database::num_rows($result)>0) {
2613
+        if (Database::num_rows($result) > 0) {
2614 2614
             while ($row = Database::fetch_assoc($result)) {
2615 2615
                 if (empty($sessions[$row['id']])) {
2616 2616
                     $sessions[$row['id']] = $row;
@@ -3602,13 +3602,13 @@  discard block
 block discarded – undo
3602 3602
         $useExtraFields = false;
3603 3603
         $extraFields = UserManager::get_extra_filtrable_fields();
3604 3604
         $extraFieldResult = array();
3605
-        if (is_array($extraFields) && count($extraFields)>0 ) {
3605
+        if (is_array($extraFields) && count($extraFields) > 0) {
3606 3606
             foreach ($extraFields as $extraField) {
3607 3607
                 $varName = 'field_'.$extraField['variable'];
3608 3608
                 if (UserManager::is_extra_field_available($extraField['variable'])) {
3609
-                    if (isset($_GET[$varName]) && $_GET[$varName]!='0') {
3609
+                    if (isset($_GET[$varName]) && $_GET[$varName] != '0') {
3610 3610
                         $useExtraFields = true;
3611
-                        $extraFieldResult[]= UserManager::get_extra_user_data_by_value(
3611
+                        $extraFieldResult[] = UserManager::get_extra_user_data_by_value(
3612 3612
                             $extraField['variable'],
3613 3613
                             $_GET[$varName]
3614 3614
                         );
@@ -3619,17 +3619,17 @@  discard block
 block discarded – undo
3619 3619
 
3620 3620
         if ($useExtraFields) {
3621 3621
             $finalResult = array();
3622
-            if (count($extraFieldResult)>1) {
3623
-                for ($i=0; $i < count($extraFieldResult) -1; $i++) {
3624
-                if (is_array($extraFieldResult[$i]) && is_array($extraFieldResult[$i+1])) {
3625
-                        $finalResult  = array_intersect($extraFieldResult[$i], $extraFieldResult[$i+1]);
3622
+            if (count($extraFieldResult) > 1) {
3623
+                for ($i = 0; $i < count($extraFieldResult) - 1; $i++) {
3624
+                if (is_array($extraFieldResult[$i]) && is_array($extraFieldResult[$i + 1])) {
3625
+                        $finalResult = array_intersect($extraFieldResult[$i], $extraFieldResult[$i + 1]);
3626 3626
                     }
3627 3627
                 }
3628 3628
             } else {
3629 3629
                 $finalResult = $extraFieldResult[0];
3630 3630
             }
3631 3631
 
3632
-            if (is_array($finalResult) && count($finalResult)>0) {
3632
+            if (is_array($finalResult) && count($finalResult) > 0) {
3633 3633
                 $whereFilter = " AND u.id IN  ('".implode("','", $finalResult)."') ";
3634 3634
             } else {
3635 3635
                 //no results
@@ -3806,7 +3806,7 @@  discard block
 block discarded – undo
3806 3806
             $sql = 'DELETE FROM '.$tbl_my_friend.'
3807 3807
                     WHERE relation_type <> '.USER_RELATION_TYPE_RRHH.' AND friend_user_id='.$friend_id.' '.$extra_condition;
3808 3808
             Database::query($sql);
3809
-            $sql= 'DELETE FROM '.$tbl_my_friend.'
3809
+            $sql = 'DELETE FROM '.$tbl_my_friend.'
3810 3810
                    WHERE relation_type <> '.USER_RELATION_TYPE_RRHH.' AND user_id='.$friend_id.' '.$extra_condition;
3811 3811
             Database::query($sql);
3812 3812
         } else {
@@ -4007,7 +4007,7 @@  discard block
 block discarded – undo
4007 4007
 
4008 4008
         if (!empty($lastConnectionDate)) {
4009 4009
             $lastConnectionDate = Database::escape_string($lastConnectionDate);
4010
-            $userConditions .=  " AND u.last_login <= '$lastConnectionDate' ";
4010
+            $userConditions .= " AND u.last_login <= '$lastConnectionDate' ";
4011 4011
         }
4012 4012
 
4013 4013
         $courseConditions = null;
@@ -4074,7 +4074,7 @@  discard block
 block discarded – undo
4074 4074
                 break;
4075 4075
             case STUDENT_BOSS :
4076 4076
                 $drhConditions = " AND friend_user_id = $userId AND "
4077
-                . "relation_type = " . USER_RELATION_TYPE_BOSS;
4077
+                . "relation_type = ".USER_RELATION_TYPE_BOSS;
4078 4078
                 break;
4079 4079
         }
4080 4080
 
@@ -4165,7 +4165,7 @@  discard block
 block discarded – undo
4165 4165
                     WHERE 
4166 4166
                         friend_user_id = $userId AND 
4167 4167
                         relation_type = $relationType AND 
4168
-                        access_url_id = " . api_get_current_access_url_id();
4168
+                        access_url_id = ".api_get_current_access_url_id();
4169 4169
         } else {
4170 4170
             $sql = "SELECT user_id FROM $userRelUserTable 
4171 4171
                     WHERE friend_user_id = $userId 
@@ -4447,7 +4447,7 @@  discard block
 block discarded – undo
4447 4447
         if (empty($years)) {
4448 4448
             $years = 1;
4449 4449
         }
4450
-        $inactive_time = $years * 31536000;  //1 year
4450
+        $inactive_time = $years * 31536000; //1 year
4451 4451
         $rs = Database::query($sql);
4452 4452
         if (Database::num_rows($rs) > 0) {
4453 4453
             if ($last_login_date = Database::result($rs, 0, 0)) {
@@ -4580,7 +4580,7 @@  discard block
 block discarded – undo
4580 4580
                         'extra_'.$field_details[1],
4581 4581
                         $field_details[3],
4582 4582
                         $options,
4583
-                        array('id' => 'extra_' . $field_details[1])
4583
+                        array('id' => 'extra_'.$field_details[1])
4584 4584
                     );
4585 4585
 
4586 4586
                     if (!$admin_permissions) {
@@ -4734,7 +4734,7 @@  discard block
 block discarded – undo
4734 4734
                     $extra_field = 'extra_'.$field_details[1];
4735 4735
                     $form->addElement('file', $extra_field, $field_details[3], null, '');
4736 4736
                     if ($extra_file_list = UserManager::build_user_extra_file_list($user_id, $field_details[1], '', true)) {
4737
-                        $form->addElement('static', $extra_field . '_list', null, $extra_file_list);
4737
+                        $form->addElement('static', $extra_field.'_list', null, $extra_file_list);
4738 4738
                     }
4739 4739
                     if ($field_details[7] == 0) {
4740 4740
                         $form->freeze($extra_field);
@@ -4907,7 +4907,7 @@  discard block
 block discarded – undo
4907 4907
         $direction = null,
4908 4908
         $active = null,
4909 4909
         $lastConnectionDate = null
4910
-    ){
4910
+    ) {
4911 4911
         return self::getUsersFollowedByUser(
4912 4912
             $userId,
4913 4913
             $userStatus,
@@ -5114,12 +5114,12 @@  discard block
 block discarded – undo
5114 5114
         if (!empty($_SERVER['HTTPS'])) {
5115 5115
             $url = 'https://secure.gravatar.com/avatar/';
5116 5116
         }
5117
-        $url .= md5( strtolower( trim( $email ) ) );
5117
+        $url .= md5(strtolower(trim($email)));
5118 5118
         $url .= "?s=$s&d=$d&r=$r";
5119
-        if ( $img ) {
5120
-            $url = '<img src="' . $url . '"';
5121
-            foreach ( $atts as $key => $val )
5122
-                $url .= ' ' . $key . '="' . $val . '"';
5119
+        if ($img) {
5120
+            $url = '<img src="'.$url.'"';
5121
+            foreach ($atts as $key => $val)
5122
+                $url .= ' '.$key.'="'.$val.'"';
5123 5123
             $url .= ' />';
5124 5124
         }
5125 5125
         return $url;
Please login to merge, or discard this patch.
Doc Comments   +29 added lines, -15 removed lines patch added patch discarded remove patch
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
     /**
139 139
      * Validates the password
140 140
      *
141
-     * @param $encoded
141
+     * @param string $encoded
142 142
      * @param $raw
143 143
      * @param $salt
144 144
      * @return bool
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
      * @param string $raw
156 156
      * @param User   $user
157 157
      *
158
-     * @return bool
158
+     * @return string
159 159
      */
160 160
     public static function encryptPassword($raw, User $user)
161 161
     {
@@ -1003,6 +1003,7 @@  discard block
 block discarded – undo
1003 1003
      * Disables or enables a user
1004 1004
      * @param int user_id
1005 1005
      * @param int Enable or disable
1006
+     * @param integer $active
1006 1007
      * @return void
1007 1008
      * @assert (-1,0) === false
1008 1009
      * @assert (1,1) === true
@@ -1033,6 +1034,7 @@  discard block
 block discarded – undo
1033 1034
     /**
1034 1035
      * Disables a user
1035 1036
      * @param int User id
1037
+     * @param integer $user_id
1036 1038
      * @return bool
1037 1039
      * @uses UserManager::change_active_state() to actually disable the user
1038 1040
      * @assert (0) === false
@@ -1049,6 +1051,7 @@  discard block
 block discarded – undo
1049 1051
     /**
1050 1052
      * Enable a user
1051 1053
      * @param int User id
1054
+     * @param integer $user_id
1052 1055
      * @return bool
1053 1056
      * @uses UserManager::change_active_state() to actually disable the user
1054 1057
      * @assert (0) === false
@@ -1213,6 +1216,7 @@  discard block
 block discarded – undo
1213 1216
      * Checks whether the user id exists in the database
1214 1217
      *
1215 1218
      * @param int User id
1219
+     * @param integer $userId
1216 1220
      * @return bool True if user id was found, false otherwise
1217 1221
      */
1218 1222
     public static function is_user_id_valid($userId)
@@ -1410,7 +1414,7 @@  discard block
 block discarded – undo
1410 1414
      * @param   array $userInfo user information to avoid query the DB
1411 1415
      * returns the /main/img/unknown.jpg image set it at true
1412 1416
      *
1413
-     * @return    array     Array of 2 elements: 'dir' and 'file' which contain
1417
+     * @return    integer     Array of 2 elements: 'dir' and 'file' which contain
1414 1418
      * the dir and file as the name implies if image does not exist it will
1415 1419
      * return the unknow image if anonymous parameter is true if not it returns an empty array
1416 1420
      */
@@ -1778,7 +1782,7 @@  discard block
 block discarded – undo
1778 1782
      * @param    int $user_id    User id
1779 1783
      * @param    $force    Optional parameter to force building after a removal request
1780 1784
      *
1781
-     * @return    A string containing the XHTML code to dipslay the production list, or FALSE
1785
+     * @return    boolean|string string containing the XHTML code to dipslay the production list, or FALSE
1782 1786
      */
1783 1787
     public static function build_production_list($user_id, $force = false, $showdelete = false)
1784 1788
     {
@@ -1814,7 +1818,7 @@  discard block
 block discarded – undo
1814 1818
     /**
1815 1819
      * Returns an array with the user's productions.
1816 1820
      *
1817
-     * @param    $user_id    User id
1821
+     * @param    integer $user_id    User id
1818 1822
      * @return   array  An array containing the user's productions
1819 1823
      */
1820 1824
     public static function get_user_productions($user_id)
@@ -1969,7 +1973,7 @@  discard block
 block discarded – undo
1969 1973
 
1970 1974
     /**
1971 1975
      * Build a list of extra file already uploaded in $user_folder/{$extra_field}/
1972
-     * @param $user_id
1976
+     * @param integer $user_id
1973 1977
      * @param $extra_field
1974 1978
      * @param bool $force
1975 1979
      * @param bool $showdelete
@@ -2074,7 +2078,7 @@  discard block
 block discarded – undo
2074 2078
      * @param    int       $fieldType  Field's type
2075 2079
      * @param    string    $displayText Field's language var name
2076 2080
      * @param    string    $default Field's default value
2077
-     * @return int
2081
+     * @return boolean
2078 2082
      */
2079 2083
     public static function create_extra_field($variable, $fieldType, $displayText, $default)
2080 2084
     {
@@ -2108,6 +2112,7 @@  discard block
 block discarded – undo
2108 2112
      * @param    boolean    Whether to prefix the fields indexes with "extra_" (might be used by formvalidator)
2109 2113
      * @param    boolean    Whether to return invisible fields as well
2110 2114
      * @param    boolean    Whether to split multiple-selection fields or not
2115
+     * @param boolean $field_filter
2111 2116
      * @return    array    Array of fields => value for the given user
2112 2117
      */
2113 2118
     public static function get_extra_user_data(
@@ -2350,6 +2355,7 @@  discard block
 block discarded – undo
2350 2355
     /**
2351 2356
      * Get extra user data by field variable
2352 2357
      * @param string    field variable
2358
+     * @param string $field_variable
2353 2359
      * @return array    data
2354 2360
      */
2355 2361
     public static function get_extra_user_data_by_field_variable($field_variable)
@@ -2899,7 +2905,7 @@  discard block
 block discarded – undo
2899 2905
      * @param    string    User ID
2900 2906
      * @param   string  course directory
2901 2907
      * @param   string  resourcetype: images, all
2902
-     * @return    int        User ID (or false if not found)
2908
+     * @return    string        User ID (or false if not found)
2903 2909
      */
2904 2910
     public static function get_user_upload_files_by_course($user_id, $course, $resourcetype = 'all')
2905 2911
     {
@@ -2979,7 +2985,7 @@  discard block
 block discarded – undo
2979 2985
     /**
2980 2986
      * Adds a new API key to the users' account
2981 2987
      * @param   int     Optional user ID (defaults to the results of api_get_user_id())
2982
-     * @return  boolean True on success, false on failure
2988
+     * @return  false|string True on success, false on failure
2983 2989
      */
2984 2990
     public static function add_api_key($user_id = null, $api_service = 'dokeos')
2985 2991
     {
@@ -3034,6 +3040,7 @@  discard block
 block discarded – undo
3034 3040
      * Regenerate an API key from the user's account
3035 3041
      * @param   int     user ID (defaults to the results of api_get_user_id())
3036 3042
      * @param   string  API key's internal ID
3043
+     * @param string $api_service
3037 3044
      * @return  int        num
3038 3045
      */
3039 3046
     public static function update_api_key($user_id, $api_service)
@@ -3063,6 +3070,7 @@  discard block
 block discarded – undo
3063 3070
     /**
3064 3071
      * @param   int     user ID (defaults to the results of api_get_user_id())
3065 3072
      * @param   string    API key's internal ID
3073
+     * @param string $api_service
3066 3074
      * @return  int    row ID, or return false if not found
3067 3075
      */
3068 3076
     public static function get_api_key_id($user_id, $api_service)
@@ -3277,7 +3285,7 @@  discard block
 block discarded – undo
3277 3285
      * @param int $field_id
3278 3286
      * @param bool $show_links show links or not
3279 3287
      *
3280
-     * @return array
3288
+     * @return string
3281 3289
      */
3282 3290
     public static function get_user_tags_to_string($user_id, $field_id, $show_links = true)
3283 3291
     {
@@ -3374,7 +3382,7 @@  discard block
 block discarded – undo
3374 3382
      * @param mixed $tag
3375 3383
      * @param int $user_id
3376 3384
      * @param int $field_id field id of the tag
3377
-     * @return bool
3385
+     * @return boolean|null
3378 3386
      */
3379 3387
     public static function add_tag($tag, $user_id, $field_id)
3380 3388
     {
@@ -4190,7 +4198,7 @@  discard block
 block discarded – undo
4190 4198
      * Add subscribed users to a user by relation type
4191 4199
      * @param int $userId The user id
4192 4200
      * @param array $subscribedUsersId The id of suscribed users
4193
-     * @param action $relationType The relation type
4201
+     * @param integer $relationType The relation type
4194 4202
      */
4195 4203
     public static function subscribeUsersToUser($userId, $subscribedUsersId, $relationType, $deleteUsersBeforeInsert = false)
4196 4204
     {
@@ -4255,6 +4263,8 @@  discard block
 block discarded – undo
4255 4263
      * This function check if an user is followed by human resources manager
4256 4264
      * @param     int     User id
4257 4265
      * @param    int        Human resources manager
4266
+     * @param integer $user_id
4267
+     * @param integer $hr_dept_id
4258 4268
      * @return    bool
4259 4269
      */
4260 4270
     public static function is_user_followed_by_drh($user_id, $hr_dept_id)
@@ -4327,6 +4337,8 @@  discard block
 block discarded – undo
4327 4337
      * Determines if a user is a gradebook certified
4328 4338
      * @param int The category id of gradebook
4329 4339
      * @param int The user id
4340
+     * @param integer $cat_id
4341
+     * @param integer $user_id
4330 4342
      * @return boolean
4331 4343
      */
4332 4344
     public static function is_user_certified($cat_id, $user_id)
@@ -4349,6 +4361,8 @@  discard block
 block discarded – undo
4349 4361
      * Gets the info about a gradebook certificate for a user by course
4350 4362
      * @param string The course code
4351 4363
      * @param int The user id
4364
+     * @param integer $course_code
4365
+     * @param integer $user_id
4352 4366
      * @return array  if there is not information return false
4353 4367
      */
4354 4368
     public static function get_info_gradebook_certificate($course_code, $user_id)
@@ -4812,7 +4826,7 @@  discard block
 block discarded – undo
4812 4826
     }
4813 4827
 
4814 4828
     /**
4815
-     * @return array
4829
+     * @return string[]
4816 4830
      */
4817 4831
     static function get_user_field_types()
4818 4832
     {
@@ -5105,7 +5119,7 @@  discard block
 block discarded – undo
5105 5119
 
5106 5120
     /**
5107 5121
      * Get the boss user ID from a followed user id
5108
-     * @param $userId
5122
+     * @param integer $userId
5109 5123
      * @return bool
5110 5124
      */
5111 5125
     public static function getStudentBossList($userId)
@@ -5157,7 +5171,7 @@  discard block
 block discarded – undo
5157 5171
      * Get either a Gravatar URL or complete image tag for a specified email address.
5158 5172
      *
5159 5173
      * @param string $email The email address
5160
-     * @param string $s Size in pixels, defaults to 80px [ 1 - 2048 ]
5174
+     * @param integer $s Size in pixels, defaults to 80px [ 1 - 2048 ]
5161 5175
      * @param string $d Default imageset to use [ 404 | mm | identicon | monsterid | wavatar ]
5162 5176
      * @param string $r Maximum rating (inclusive) [ g | pg | r | x ]
5163 5177
      * @param boole $img True to return a complete IMG tag False for just the URL
Please login to merge, or discard this patch.
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -1267,13 +1267,13 @@  discard block
 block discarded – undo
1267 1267
     }
1268 1268
 
1269 1269
     /**
1270
-    * Get the users by ID
1271
-    * @param array $ids student ids
1272
-    * @param string $active
1273
-    * @param string $order
1274
-    * @param string $limit
1275
-    * @return array $result student information
1276
-    */
1270
+     * Get the users by ID
1271
+     * @param array $ids student ids
1272
+     * @param string $active
1273
+     * @param string $order
1274
+     * @param string $limit
1275
+     * @return array $result student information
1276
+     */
1277 1277
     public static function get_user_list_by_ids($ids = array(), $active = null, $order = null, $limit = null)
1278 1278
     {
1279 1279
         if (empty($ids)) {
@@ -2314,7 +2314,7 @@  discard block
 block discarded – undo
2314 2314
      *
2315 2315
      * @return array with extra data info of a user i.e array('field_variable'=>'value');
2316 2316
      */
2317
-     public static function get_extra_user_data_by_value($variable, $value, $all_visibility = true)
2317
+        public static function get_extra_user_data_by_value($variable, $value, $all_visibility = true)
2318 2318
     {
2319 2319
         $extraFieldValue = new ExtraFieldValue('user');
2320 2320
         $extraField = new ExtraField('user');
@@ -3409,12 +3409,12 @@  discard block
 block discarded – undo
3409 3409
         if ($tag_id == 0) {
3410 3410
             //the tag doesn't exist
3411 3411
             $sql = "INSERT INTO $table_user_tag (tag, field_id,count) VALUES ('$tag','$field_id', count + 1)";
3412
-             Database::query($sql);
3412
+                Database::query($sql);
3413 3413
             $last_insert_id = Database::insert_id();
3414 3414
         } else {
3415 3415
             //the tag exists we update it
3416 3416
             $sql = "UPDATE $table_user_tag SET count = count + 1 WHERE id  = $tag_id";
3417
-             Database::query($sql);
3417
+                Database::query($sql);
3418 3418
             $last_insert_id = $tag_id;
3419 3419
         }
3420 3420
 
@@ -3610,9 +3610,9 @@  discard block
 block discarded – undo
3610 3610
     }
3611 3611
 
3612 3612
     /**
3613
-      * Get extra filtrable user fields (only type select)
3614
-      * @return array
3615
-      */
3613
+     * Get extra filtrable user fields (only type select)
3614
+     * @return array
3615
+     */
3616 3616
     public static function get_extra_filtrable_fields()
3617 3617
     {
3618 3618
         $extraFieldList = UserManager::get_extra_fields();
@@ -3637,9 +3637,9 @@  discard block
 block discarded – undo
3637 3637
     }
3638 3638
 
3639 3639
     /**
3640
-      * Get extra where clauses for finding users based on extra filtrable user fields (type select)
3641
-      * @return string With AND clauses based on user's ID which have the values to search in extra user fields
3642
-      */
3640
+     * Get extra where clauses for finding users based on extra filtrable user fields (type select)
3641
+     * @return string With AND clauses based on user's ID which have the values to search in extra user fields
3642
+     */
3643 3643
     public static function get_search_form_where_extra_fields()
3644 3644
     {
3645 3645
         $useExtraFields = false;
@@ -3958,23 +3958,23 @@  discard block
 block discarded – undo
3958 3958
     }
3959 3959
 
3960 3960
     /**
3961
-    * Get users followed by human resource manager
3962
-    * @param int $userId
3963
-    * @param int  $userStatus Filter users by status (STUDENT, COURSEMANAGER, etc)
3964
-    * @param bool $getOnlyUserId
3965
-    * @param bool $getSql
3966
-    * @param bool $getCount
3967
-    * @param int $from
3968
-    * @param int $numberItems
3969
-    * @param int $column
3970
-    * @param string $direction
3971
-    * @param int $active
3972
-    * @param string $lastConnectionDate
3973
-    * @param int $status the function is called by who? COURSEMANAGER, DRH?
3974
-    * @param string $keyword
3961
+     * Get users followed by human resource manager
3962
+     * @param int $userId
3963
+     * @param int  $userStatus Filter users by status (STUDENT, COURSEMANAGER, etc)
3964
+     * @param bool $getOnlyUserId
3965
+     * @param bool $getSql
3966
+     * @param bool $getCount
3967
+     * @param int $from
3968
+     * @param int $numberItems
3969
+     * @param int $column
3970
+     * @param string $direction
3971
+     * @param int $active
3972
+     * @param string $lastConnectionDate
3973
+     * @param int $status the function is called by who? COURSEMANAGER, DRH?
3974
+     * @param string $keyword
3975 3975
      *
3976
-    * @return array user list
3977
-    */
3976
+     * @return array user list
3977
+     */
3978 3978
     public static function getUsersFollowedByUser(
3979 3979
         $userId,
3980 3980
         $userStatus = null,
Please login to merge, or discard this patch.