@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | $list_sessions = SessionManager::get_sessions_by_user($user_id, true); |
16 | 16 | if (!empty($list_sessions)) { |
17 | 17 | foreach ($list_sessions as $session_item) { |
18 | - echo $session_item['session_name'] . '<br />'; |
|
18 | + echo $session_item['session_name'].'<br />'; |
|
19 | 19 | } |
20 | 20 | } else { |
21 | 21 | echo get_lang('NoSessionsForThisUser'); |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | [ |
30 | 30 | 's.name' => [ |
31 | 31 | 'operator' => 'LIKE', |
32 | - 'value' => "%" . $_REQUEST['q'] . "%" |
|
32 | + 'value' => "%".$_REQUEST['q']."%" |
|
33 | 33 | ] |
34 | 34 | ] |
35 | 35 | ); |
@@ -488,7 +488,7 @@ |
||
488 | 488 | $remind_list |
489 | 489 | ); |
490 | 490 | |
491 | - // Destruction of the Question object |
|
491 | + // Destruction of the Question object |
|
492 | 492 | unset($objQuestionTmp); |
493 | 493 | if ($debug) { |
494 | 494 | error_log(" -- end question -- "); |
@@ -32,10 +32,10 @@ discard block |
||
32 | 32 | $exercise_id = intval($_GET['exercise_id']); |
33 | 33 | $page = intval($_REQUEST['page']); //page |
34 | 34 | $limit = intval($_REQUEST['rows']); //quantity of rows |
35 | - $sidx = $_REQUEST['sidx']; //index to filter |
|
36 | - $sord = $_REQUEST['sord']; //asc or desc |
|
35 | + $sidx = $_REQUEST['sidx']; //index to filter |
|
36 | + $sord = $_REQUEST['sord']; //asc or desc |
|
37 | 37 | |
38 | - if (!in_array($sord, array('asc','desc'))) { |
|
38 | + if (!in_array($sord, array('asc', 'desc'))) { |
|
39 | 39 | $sord = 'desc'; |
40 | 40 | } |
41 | 41 | // get index row - i.e. user click to sort $sord = $_GET['sord']; |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | $total_pages = 0; |
65 | 65 | if ($count > 0) { |
66 | 66 | if (!empty($limit)) { |
67 | - $total_pages = ceil($count/$limit); |
|
67 | + $total_pages = ceil($count / $limit); |
|
68 | 68 | } |
69 | 69 | } |
70 | 70 | |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | $response->page = $page; |
127 | 127 | $response->total = $total_pages; |
128 | 128 | $response->records = $count; |
129 | - $i=0; |
|
129 | + $i = 0; |
|
130 | 130 | |
131 | 131 | if (!empty($results)) { |
132 | 132 | foreach ($results as $row) { |
@@ -149,16 +149,16 @@ discard block |
||
149 | 149 | $row['count_questions'] = $count_questions; |
150 | 150 | |
151 | 151 | $response->rows[$i]['id'] = $row['exe_id']; |
152 | - $remaining = strtotime($row['start_date'])+($oExe->expired_time*60) - strtotime(api_get_utc_datetime(time())); |
|
153 | - $h = floor($remaining/3600); |
|
154 | - $m = floor(($remaining - ($h*3600))/60); |
|
155 | - $s = ($remaining - ($h*3600) - ($m*60)); |
|
152 | + $remaining = strtotime($row['start_date']) + ($oExe->expired_time * 60) - strtotime(api_get_utc_datetime(time())); |
|
153 | + $h = floor($remaining / 3600); |
|
154 | + $m = floor(($remaining - ($h * 3600)) / 60); |
|
155 | + $s = ($remaining - ($h * 3600) - ($m * 60)); |
|
156 | 156 | $array = array( |
157 | 157 | $row['firstname'], |
158 | 158 | $row['lastname'], |
159 | - api_format_date($row['start_date'], DATE_TIME_FORMAT_LONG).' ['.($h>0?$h.':':'').sprintf("%02d",$m).':'.sprintf("%02d",$s).']', |
|
159 | + api_format_date($row['start_date'], DATE_TIME_FORMAT_LONG).' ['.($h > 0 ? $h.':' : '').sprintf("%02d", $m).':'.sprintf("%02d", $s).']', |
|
160 | 160 | $row['count_questions'], |
161 | - round($row['score']*100).'%' |
|
161 | + round($row['score'] * 100).'%' |
|
162 | 162 | ); |
163 | 163 | $response->rows[$i]['cell'] = $array; |
164 | 164 | $i++; |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | |
364 | 364 | // Getting free choice data. |
365 | 365 | if ( |
366 | - ($objQuestionTmp->type == FREE_ANSWER || $objQuestionTmp->type == ORAL_EXPRESSION) |
|
366 | + ($objQuestionTmp->type == FREE_ANSWER || $objQuestionTmp->type == ORAL_EXPRESSION) |
|
367 | 367 | && $type == 'all' |
368 | 368 | ) { |
369 | 369 | $my_choice = isset($_REQUEST['free_choice'][$my_question_id]) && !empty($_REQUEST['free_choice'][$my_question_id]) |
@@ -531,7 +531,7 @@ discard block |
||
531 | 531 | $objQuestion = Question::read($questionId); |
532 | 532 | $objQuestion->get_question_type_name(); |
533 | 533 | |
534 | - echo '<p class="lead">' . $objQuestion->get_question_type_name() . '</p>'; |
|
534 | + echo '<p class="lead">'.$objQuestion->get_question_type_name().'</p>'; |
|
535 | 535 | //echo get_lang('Level').': '.$objQuestionTmp->selectLevel(); |
536 | 536 | ExerciseLib::showQuestion( |
537 | 537 | $questionId, |
@@ -55,56 +55,56 @@ |
||
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; |
@@ -5,7 +5,7 @@ discard block |
||
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 __DIR__.'/../global.inc.php'; |
11 | 11 | |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | } |
27 | 27 | |
28 | 28 | $to_user_id = isset($_REQUEST['to']) ? $_REQUEST['to'] : null; |
29 | -$message = isset($_REQUEST['message']) ? $_REQUEST['message'] : null; |
|
29 | +$message = isset($_REQUEST['message']) ? $_REQUEST['message'] : null; |
|
30 | 30 | |
31 | 31 | if (!isset($_SESSION['chatHistory'])) { |
32 | 32 | $_SESSION['chatHistory'] = array(); |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | } |
38 | 38 | |
39 | 39 | $chat = new Chat(); |
40 | -if (chat::disableChat()){ |
|
40 | +if (chat::disableChat()) { |
|
41 | 41 | exit; |
42 | 42 | } |
43 | 43 | if ($chat->is_chat_blocked_by_exercises()) { |
@@ -77,9 +77,9 @@ discard block |
||
77 | 77 | $room = VideoChat::getChatRoomByUsers(api_get_user_id(), $to_user_id); |
78 | 78 | } |
79 | 79 | |
80 | - $videoChatUrl = api_get_path(WEB_LIBRARY_JS_PATH) . "chat/video.php?room={$room['id']}"; |
|
80 | + $videoChatUrl = api_get_path(WEB_LIBRARY_JS_PATH)."chat/video.php?room={$room['id']}"; |
|
81 | 81 | $videoChatLink = Display::url( |
82 | - Display::returnFontAwesomeIcon('video-camera') . get_lang('StartVideoChat'), |
|
82 | + Display::returnFontAwesomeIcon('video-camera').get_lang('StartVideoChat'), |
|
83 | 83 | $videoChatUrl |
84 | 84 | ); |
85 | 85 |
@@ -58,7 +58,7 @@ discard block |
||
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 |
||
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 |
||
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, |
@@ -731,7 +731,7 @@ discard block |
||
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 |
||
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'; |
@@ -11,8 +11,8 @@ discard block |
||
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 |
||
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 |
||
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 |
||
100 | 100 | |
101 | 101 | // If there is no search request sent by jqgrid, $where should be empty |
102 | 102 | $whereCondition = ''; |
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; |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | foreach ($filters->rules as $key => $rule) { |
172 | 172 | $whereCondition .= getWhereClause($rule->field, $rule->op, $rule->data); |
173 | 173 | |
174 | - if ($counter < count($filters->rules) -1) { |
|
174 | + if ($counter < count($filters->rules) - 1) { |
|
175 | 175 | $whereCondition .= $filters->groupOp; |
176 | 176 | } |
177 | 177 | $counter++; |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | $userId = api_get_user_id(); |
202 | 202 | $sessionId = isset($_GET['session_id']) ? intval($_GET['session_id']) : 0; |
203 | 203 | $courseCodeList = array(); |
204 | - $userIdList = array(); |
|
204 | + $userIdList = array(); |
|
205 | 205 | $sessionIdList = []; |
206 | 206 | $searchByGroups = false; |
207 | 207 | if (api_is_drh()) { |
@@ -585,7 +585,7 @@ discard block |
||
585 | 585 | $total_pages = 0; |
586 | 586 | if ($count > 0) { |
587 | 587 | if (!empty($limit)) { |
588 | - $total_pages = ceil((float)$count/(float)$limit); |
|
588 | + $total_pages = ceil((float) $count / (float) $limit); |
|
589 | 589 | } |
590 | 590 | } |
591 | 591 | if ($page > $total_pages) { |
@@ -865,10 +865,10 @@ discard block |
||
865 | 865 | case 'get_work_user_list_others': |
866 | 866 | if (isset($_GET['type']) && $_GET['type'] === 'simple') { |
867 | 867 | $columns = array( |
868 | - 'type', 'firstname', 'lastname', 'title', 'qualification', 'sent_date', 'qualificator_id', 'actions' |
|
868 | + 'type', 'firstname', 'lastname', 'title', 'qualification', 'sent_date', 'qualificator_id', 'actions' |
|
869 | 869 | ); |
870 | 870 | } else { |
871 | - $columns = array('type', 'firstname', 'lastname', 'title', 'sent_date', 'actions'); |
|
871 | + $columns = array('type', 'firstname', 'lastname', 'title', 'sent_date', 'actions'); |
|
872 | 872 | } |
873 | 873 | $whereCondition .= " AND u.user_id <> ".api_get_user_id(); |
874 | 874 | $result = get_work_user_list($start, $limit, $sidx, $sord, $work_id, $whereCondition); |
@@ -902,7 +902,7 @@ discard block |
||
902 | 902 | case 'get_exercise_results': |
903 | 903 | $course = api_get_course_info(); |
904 | 904 | // Used inside ExerciseLib::get_exam_results_data() |
905 | - $documentPath = api_get_path(SYS_COURSE_PATH) . $course['path'] . "/document"; |
|
905 | + $documentPath = api_get_path(SYS_COURSE_PATH).$course['path']."/document"; |
|
906 | 906 | if ($is_allowedToEdit || api_is_student_boss()) { |
907 | 907 | $columns = array( |
908 | 908 | 'firstname', |
@@ -927,11 +927,11 @@ discard block |
||
927 | 927 | break; |
928 | 928 | case 'get_hotpotatoes_exercise_results': |
929 | 929 | $course = api_get_course_info(); |
930 | - $documentPath = api_get_path(SYS_COURSE_PATH) . $course['path'] . "/document"; |
|
930 | + $documentPath = api_get_path(SYS_COURSE_PATH).$course['path']."/document"; |
|
931 | 931 | if (api_is_allowed_to_edit()) { |
932 | - $columns = array('firstname', 'lastname', 'username', 'group_name', 'exe_date', 'score', 'actions'); |
|
932 | + $columns = array('firstname', 'lastname', 'username', 'group_name', 'exe_date', 'score', 'actions'); |
|
933 | 933 | } else { |
934 | - $columns = array('exe_date', 'score', 'actions'); |
|
934 | + $columns = array('exe_date', 'score', 'actions'); |
|
935 | 935 | } |
936 | 936 | $result = ExerciseLib::get_exam_results_hotpotatoes_data( |
937 | 937 | $start, |
@@ -964,12 +964,12 @@ discard block |
||
964 | 964 | break; |
965 | 965 | case 'get_hotpotatoes_exercise_results': |
966 | 966 | $course = api_get_course_info(); |
967 | - $documentPath = api_get_path(SYS_COURSE_PATH) . $course['path'] . "/document"; |
|
967 | + $documentPath = api_get_path(SYS_COURSE_PATH).$course['path']."/document"; |
|
968 | 968 | |
969 | 969 | if (api_is_allowed_to_edit(null, true) || api_is_drh()) { |
970 | - $columns = array('firstname', 'lastname', 'username', 'group_name', 'exe_date', 'score', 'actions'); |
|
970 | + $columns = array('firstname', 'lastname', 'username', 'group_name', 'exe_date', 'score', 'actions'); |
|
971 | 971 | } else { |
972 | - $columns = array('exe_date', 'score', 'actions'); |
|
972 | + $columns = array('exe_date', 'score', 'actions'); |
|
973 | 973 | } |
974 | 974 | $result = ExerciseLib::get_exam_results_hotpotatoes_data( |
975 | 975 | $start, |
@@ -1005,7 +1005,7 @@ discard block |
||
1005 | 1005 | ); |
1006 | 1006 | } |
1007 | 1007 | |
1008 | - $columns = array( |
|
1008 | + $columns = array( |
|
1009 | 1009 | 'name', |
1010 | 1010 | 'date', |
1011 | 1011 | 'course_per_session', |
@@ -1041,17 +1041,17 @@ discard block |
||
1041 | 1041 | $detailButtons = []; |
1042 | 1042 | $detailButtons[] = Display::url( |
1043 | 1043 | Display::return_icon('works.png', get_lang('WorksReport')), |
1044 | - api_get_path(WEB_CODE_PATH) . 'mySpace/works_in_session_report.php?session=' . $session['id'] |
|
1044 | + api_get_path(WEB_CODE_PATH).'mySpace/works_in_session_report.php?session='.$session['id'] |
|
1045 | 1045 | ); |
1046 | 1046 | $detailButtons[] = Display::url( |
1047 | 1047 | Display::return_icon('2rightarrow.png'), |
1048 | - api_get_path(WEB_CODE_PATH) . 'mySpace/course.php?session_id=' . $session['id'] |
|
1048 | + api_get_path(WEB_CODE_PATH).'mySpace/course.php?session_id='.$session['id'] |
|
1049 | 1049 | ); |
1050 | 1050 | |
1051 | 1051 | $result[] = array( |
1052 | 1052 | 'name' => Display::url( |
1053 | 1053 | $session['name'], |
1054 | - api_get_path(WEB_CODE_PATH) . 'mySpace/course.php?session_id=' . $session['id'] |
|
1054 | + api_get_path(WEB_CODE_PATH).'mySpace/course.php?session_id='.$session['id'] |
|
1055 | 1055 | ), |
1056 | 1056 | 'date' => $session_date_string, |
1057 | 1057 | 'course_per_session' => $count_courses_in_session, |
@@ -1363,7 +1363,7 @@ discard block |
||
1363 | 1363 | $result = $new_result; |
1364 | 1364 | break; |
1365 | 1365 | case 'get_gradebooks': |
1366 | - $columns = array('name', 'certificates','skills', 'actions', 'has_certificates'); |
|
1366 | + $columns = array('name', 'certificates', 'skills', 'actions', 'has_certificates'); |
|
1367 | 1367 | if (!in_array($sidx, $columns)) { |
1368 | 1368 | $sidx = 'name'; |
1369 | 1369 | } |
@@ -1536,7 +1536,7 @@ discard block |
||
1536 | 1536 | if (!empty($exercises[$cnt - 4]['title'])) { |
1537 | 1537 | $title = ucwords(strtolower(trim($exercises[$cnt - 4]['title']))); |
1538 | 1538 | } |
1539 | - $columns[] = 'exer' . $i; |
|
1539 | + $columns[] = 'exer'.$i; |
|
1540 | 1540 | $column_names[] = $title; |
1541 | 1541 | $i++; |
1542 | 1542 | break; |
@@ -1569,7 +1569,7 @@ discard block |
||
1569 | 1569 | $sessionInfo = SessionManager::fetch($listUserSess[$user['user_id']]['id_session']); |
1570 | 1570 | $result[$i]['session'] = $sessionInfo['name']; |
1571 | 1571 | $result[$i]['username'] = $user['username']; |
1572 | - $result[$i]['name'] = $user['lastname'] . " " . $user['firstname']; |
|
1572 | + $result[$i]['name'] = $user['lastname']." ".$user['firstname']; |
|
1573 | 1573 | $j = 1; |
1574 | 1574 | $finalScore = 0; |
1575 | 1575 | foreach ($quizIds as $quizID) { |
@@ -1577,7 +1577,7 @@ discard block |
||
1577 | 1577 | if (!empty($arrGrade [$user['user_id']][$quizID]) || $arrGrade [$user['user_id']][$quizID] == 0) { |
1578 | 1578 | $finalScore += $grade = $arrGrade [$user['user_id']][$quizID]; |
1579 | 1579 | } |
1580 | - $result[$i]['exer' . $j] = $grade; |
|
1580 | + $result[$i]['exer'.$j] = $grade; |
|
1581 | 1581 | $j++; |
1582 | 1582 | } |
1583 | 1583 | |
@@ -1745,9 +1745,9 @@ discard block |
||
1745 | 1745 | foreach ($result as $row) { |
1746 | 1746 | // if results tab give not id, set id to $i otherwise id="null" for all <tr> of the jqgrid - ref #4235 |
1747 | 1747 | if (!isset($row['id']) || isset($row['id']) && $row['id'] == '') { |
1748 | - $response->rows[$i]['id']= $i; |
|
1748 | + $response->rows[$i]['id'] = $i; |
|
1749 | 1749 | } else { |
1750 | - $response->rows[$i]['id']= $row['id']; |
|
1750 | + $response->rows[$i]['id'] = $row['id']; |
|
1751 | 1751 | } |
1752 | 1752 | $array = array(); |
1753 | 1753 | foreach ($columns as $col) { |
@@ -1757,7 +1757,7 @@ discard block |
||
1757 | 1757 | $array[] = isset($row[$col]) ? Security::remove_XSS($row[$col]) : ''; |
1758 | 1758 | } |
1759 | 1759 | } |
1760 | - $response->rows[$i]['cell']=$array; |
|
1760 | + $response->rows[$i]['cell'] = $array; |
|
1761 | 1761 | $i++; |
1762 | 1762 | } |
1763 | 1763 | } |
@@ -758,7 +758,7 @@ |
||
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 |
@@ -216,7 +216,7 @@ discard block |
||
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; |
@@ -504,7 +504,7 @@ discard block |
||
504 | 504 | * Process external authentication |
505 | 505 | * on the basis of the given login name |
506 | 506 | */ |
507 | - $loginFailed = true; // Default initialisation. It could |
|
507 | + $loginFailed = true; // Default initialisation. It could |
|
508 | 508 | // change after the external authentication |
509 | 509 | $key = $uData['auth_source']; //'ldap','shibboleth'... |
510 | 510 | |
@@ -549,7 +549,7 @@ discard block |
||
549 | 549 | * Process external authentication |
550 | 550 | * on the basis of the given login name |
551 | 551 | */ |
552 | - $loginFailed = true; // Default initialisation. It could |
|
552 | + $loginFailed = true; // Default initialisation. It could |
|
553 | 553 | // change after the external authentication |
554 | 554 | $key = $uData['auth_source']; //'ldap','shibboleth'... |
555 | 555 | |
@@ -560,11 +560,11 @@ discard block |
||
560 | 560 | } else { |
561 | 561 | // change after the external authentication |
562 | 562 | // login failed, Database::num_rows($result) <= 0 |
563 | - $loginFailed = true; // Default initialisation. It could |
|
563 | + $loginFailed = true; // Default initialisation. It could |
|
564 | 564 | } |
565 | 565 | |
566 | 566 | // login failed, Database::num_rows($result) <= 0 |
567 | - $loginFailed = true; // Default initialisation. It could |
|
567 | + $loginFailed = true; // Default initialisation. It could |
|
568 | 568 | // change after the external authentication |
569 | 569 | |
570 | 570 | /* |
@@ -593,7 +593,7 @@ discard block |
||
593 | 593 | include_once($thisAuthSource['newUser']); |
594 | 594 | } else { |
595 | 595 | error_log( |
596 | - 'Chamilo Authentication external file' . |
|
596 | + 'Chamilo Authentication external file'. |
|
597 | 597 | ' could not be found - this might prevent your system from using'. |
598 | 598 | ' the authentication process in the user creation process', |
599 | 599 | 0 |
@@ -705,7 +705,7 @@ discard block |
||
705 | 705 | online_logout(null, false); |
706 | 706 | $osso->logout(); //redirects and exits |
707 | 707 | } |
708 | - } elseif (api_get_setting('openid_authentication')=='true') { |
|
708 | + } elseif (api_get_setting('openid_authentication') == 'true') { |
|
709 | 709 | if (!empty($_POST['openid_url'])) { |
710 | 710 | include api_get_path(SYS_CODE_PATH).'auth/openid/login.php'; |
711 | 711 | openid_begin(trim($_POST['openid_url']), api_get_path(WEB_PATH).'index.php'); |
@@ -718,7 +718,7 @@ discard block |
||
718 | 718 | if ($res['status'] == 'success') { |
719 | 719 | $id1 = Database::escape_string($res['openid.identity']); |
720 | 720 | //have another id with or without the final '/' |
721 | - $id2 = (substr($id1, -1, 1)=='/'?substr($id1, 0, -1):$id1.'/'); |
|
721 | + $id2 = (substr($id1, -1, 1) == '/' ? substr($id1, 0, -1) : $id1.'/'); |
|
722 | 722 | //lookup the user in the main database |
723 | 723 | $user_table = Database::get_main_table(TABLE_MAIN_USER); |
724 | 724 | $sql = "SELECT user_id, username, password, auth_source, active, expiration_date |
@@ -727,14 +727,14 @@ discard block |
||
727 | 727 | OR openid = '$id2' "; |
728 | 728 | $result = Database::query($sql); |
729 | 729 | if ($result !== false) { |
730 | - if (Database::num_rows($result)>0) { |
|
730 | + if (Database::num_rows($result) > 0) { |
|
731 | 731 | $uData = Database::fetch_array($result); |
732 | 732 | |
733 | 733 | if ($uData['auth_source'] == PLATFORM_AUTH_SOURCE) { |
734 | 734 | //the authentification of this user is managed by Chamilo itself |
735 | 735 | |
736 | 736 | // check if the account is active (not locked) |
737 | - if ($uData['active']=='1') { |
|
737 | + if ($uData['active'] == '1') { |
|
738 | 738 | // check if the expiration date has not been reached |
739 | 739 | if ($uData['expiration_date'] > date('Y-m-d H:i:s') |
740 | 740 | || empty($uData['expiration_date']) |
@@ -813,7 +813,7 @@ discard block |
||
813 | 813 | (isset($_SESSION['_cid']) && $cidReq != $_SESSION['_cid'])) |
814 | 814 | ) { |
815 | 815 | $cidReset = true; |
816 | - $gidReset = true; // As groups depend from courses, group id is reset |
|
816 | + $gidReset = true; // As groups depend from courses, group id is reset |
|
817 | 817 | } |
818 | 818 | |
819 | 819 | /* USER INIT */ |
@@ -957,8 +957,8 @@ discard block |
||
957 | 957 | $tbl_session_course_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER); |
958 | 958 | |
959 | 959 | if (!empty($_GET['id_session'])) { |
960 | - $sql = 'SELECT name FROM '.$tbl_session . ' |
|
961 | - WHERE id="'.intval($_GET['id_session']) . '"'; |
|
960 | + $sql = 'SELECT name FROM '.$tbl_session.' |
|
961 | + WHERE id="'.intval($_GET['id_session']).'"'; |
|
962 | 962 | $rs = Database::query($sql); |
963 | 963 | if (Database::num_rows($rs)) { |
964 | 964 | list($_SESSION['session_name']) = Database::fetch_array($rs); |
@@ -1045,7 +1045,7 @@ discard block |
||
1045 | 1045 | // Moreover, if we want to track a course with another session it can be usefull |
1046 | 1046 | if (!empty($_GET['id_session']) && is_numeric($_GET['id_session'])) { |
1047 | 1047 | $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION); |
1048 | - $sql = 'SELECT name FROM '.$tbl_session . ' WHERE id="'.intval($_GET['id_session']). '"'; |
|
1048 | + $sql = 'SELECT name FROM '.$tbl_session.' WHERE id="'.intval($_GET['id_session']).'"'; |
|
1049 | 1049 | $rs = Database::query($sql); |
1050 | 1050 | if (Database::num_rows($rs)) { |
1051 | 1051 | list($_SESSION['session_name']) = Database::fetch_array($rs); |
@@ -1169,7 +1169,7 @@ discard block |
||
1169 | 1169 | } |
1170 | 1170 | } |
1171 | 1171 | $url = api_get_path(WEB_CODE_PATH).'auth/inscription.php'; |
1172 | - header("Location:". $url); |
|
1172 | + header("Location:".$url); |
|
1173 | 1173 | exit; |
1174 | 1174 | } |
1175 | 1175 | } |
@@ -1189,8 +1189,8 @@ discard block |
||
1189 | 1189 | if (Database::num_rows($result) > 0) { // this user have a recorded state for this course |
1190 | 1190 | $cuData = Database::fetch_array($result, 'ASSOC'); |
1191 | 1191 | |
1192 | - $is_courseAdmin = (bool)($cuData['status'] == 1); |
|
1193 | - $is_courseTutor = (bool)($cuData['is_tutor'] == 1); |
|
1192 | + $is_courseAdmin = (bool) ($cuData['status'] == 1); |
|
1193 | + $is_courseTutor = (bool) ($cuData['is_tutor'] == 1); |
|
1194 | 1194 | $is_courseMember = true; |
1195 | 1195 | } |
1196 | 1196 | |
@@ -1201,7 +1201,7 @@ discard block |
||
1201 | 1201 | // This user has no status related to this course |
1202 | 1202 | // The user is subscribed in a session? The user is a Session coach a Session admin ? |
1203 | 1203 | |
1204 | - $tbl_session = Database :: get_main_table(TABLE_MAIN_SESSION); |
|
1204 | + $tbl_session = Database :: get_main_table(TABLE_MAIN_SESSION); |
|
1205 | 1205 | $tbl_session_course = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE); |
1206 | 1206 | $tbl_session_course_user = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER); |
1207 | 1207 | |
@@ -1506,12 +1506,12 @@ discard block |
||
1506 | 1506 | ($logging_in && exist_firstpage_parameter()) |
1507 | 1507 | ) { |
1508 | 1508 | $redirectCourseDir = api_get_firstpage_parameter(); |
1509 | - api_delete_firstpage_parameter(); // delete the cookie |
|
1509 | + api_delete_firstpage_parameter(); // delete the cookie |
|
1510 | 1510 | |
1511 | 1511 | if (!isset($_SESSION['request_uri'])) { |
1512 | 1512 | if (CourseManager::get_course_id_from_path($redirectCourseDir)) { |
1513 | 1513 | $_SESSION['noredirection'] = false; |
1514 | - $_SESSION['request_uri'] = api_get_path(WEB_COURSE_PATH) . $redirectCourseDir . '/'; |
|
1514 | + $_SESSION['request_uri'] = api_get_path(WEB_COURSE_PATH).$redirectCourseDir.'/'; |
|
1515 | 1515 | } |
1516 | 1516 | } |
1517 | 1517 | } elseif (api_user_is_login() && exist_firstpage_parameter()) { |
@@ -1519,7 +1519,7 @@ discard block |
||
1519 | 1519 | api_delete_firstpage_parameter(); // delete the cookie |
1520 | 1520 | if (CourseManager::get_course_id_from_path($redirectCourseDir)) { |
1521 | 1521 | $_SESSION['noredirection'] = false; |
1522 | - $_SESSION['request_uri'] = api_get_path(WEB_COURSE_PATH) . $redirectCourseDir . '/'; |
|
1522 | + $_SESSION['request_uri'] = api_get_path(WEB_COURSE_PATH).$redirectCourseDir.'/'; |
|
1523 | 1523 | } |
1524 | 1524 | } |
1525 | 1525 |
@@ -196,7 +196,7 @@ |
||
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 |
@@ -35,7 +35,7 @@ discard block |
||
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 |
||
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 |
||
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 |
@@ -29,8 +29,9 @@ |
||
29 | 29 | while (($file = readdir($dh)) !== false) { |
30 | 30 | if ($file[0] <> '.' && substr($file, -4, strlen($file)) == '.php') { |
31 | 31 | if ($only_main_name) { |
32 | - if ($file != '' && strpos($file, '.inc.php')) |
|
33 | - $content_dir[] = substr($file, 0, strpos($file, '.inc.php')); |
|
32 | + if ($file != '' && strpos($file, '.inc.php')) { |
|
33 | + $content_dir[] = substr($file, 0, strpos($file, '.inc.php')); |
|
34 | + } |
|
34 | 35 | } else { |
35 | 36 | $content_dir[] = $file; |
36 | 37 | } |
@@ -41,6 +41,7 @@ discard block |
||
41 | 41 | * Get all files of lang folder (forum.inc.php,gradebook.inc.php,notebook.inc.php) |
42 | 42 | * @param string The lang path folder (/var/www/my_lms/main/lang/spanish) |
43 | 43 | * @param bool true if we only want the "subname" trad4all instead of trad4all.inc.php |
44 | + * @param string $path |
|
44 | 45 | * |
45 | 46 | * @return array All file of lang folder |
46 | 47 | */ |
@@ -91,6 +92,7 @@ discard block |
||
91 | 92 | /** |
92 | 93 | * Get all information of language |
93 | 94 | * @param Integer The parent id(Language father id) |
95 | + * @param integer $parent_id |
|
94 | 96 | * @return array All information about language |
95 | 97 | */ |
96 | 98 | public static function get_all_information_of_language($parent_id) |
@@ -109,6 +111,7 @@ discard block |
||
109 | 111 | /** |
110 | 112 | * Get all information of chamilo file |
111 | 113 | * @param string The chamilo path file (/var/www/chamilo/main/lang/spanish/gradebook.inc.php) |
114 | + * @param string $system_path_file |
|
112 | 115 | * @patam Bool Whether we want to remove the '$' prefix in the results or not |
113 | 116 | * @return array Contains all information of chamilo file |
114 | 117 | */ |
@@ -369,7 +372,7 @@ discard block |
||
369 | 372 | /** |
370 | 373 | * Make available the language |
371 | 374 | * @param int The language id |
372 | - * @return void |
|
375 | + * @return boolean |
|
373 | 376 | */ |
374 | 377 | public static function make_available_language($language_id) |
375 | 378 | { |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | public static function getAllLanguages($onlyActive = false) |
24 | 24 | { |
25 | 25 | $table = Database :: get_main_table(TABLE_MAIN_LANGUAGE); |
26 | - $sql = 'SELECT * FROM ' . $table; |
|
26 | + $sql = 'SELECT * FROM '.$table; |
|
27 | 27 | if ($onlyActive) { |
28 | 28 | $sql .= ' WHERE available = 1'; |
29 | 29 | } |
@@ -75,10 +75,10 @@ discard block |
||
75 | 75 | public static function get_all_information_of_sub_language($parent_id, $sub_language_id) |
76 | 76 | { |
77 | 77 | $table = Database :: get_main_table(TABLE_MAIN_LANGUAGE); |
78 | - $sql = 'SELECT * FROM ' . $table . ' |
|
78 | + $sql = 'SELECT * FROM '.$table.' |
|
79 | 79 | WHERE |
80 | 80 | parent_id= ' . intval($parent_id).' AND |
81 | - id= ' . intval($sub_language_id) . ''; |
|
81 | + id= ' . intval($sub_language_id).''; |
|
82 | 82 | $rs = Database::query($sql); |
83 | 83 | $all_information = array(); |
84 | 84 | while ($row = Database::fetch_array($rs, 'ASSOC')) { |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | public static function get_all_information_of_language($parent_id) |
97 | 97 | { |
98 | 98 | $table = Database :: get_main_table(TABLE_MAIN_LANGUAGE); |
99 | - $sql = 'SELECT * FROM ' . $table . ' WHERE id = "' . intval($parent_id) . '"'; |
|
99 | + $sql = 'SELECT * FROM '.$table.' WHERE id = "'.intval($parent_id).'"'; |
|
100 | 100 | $rs = Database::query($sql); |
101 | 101 | $all_information = array(); |
102 | 102 | while ($row = Database::fetch_array($rs, 'ASSOC')) { |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | */ |
144 | 144 | public static function add_file_in_language_directory($system_path_file) |
145 | 145 | { |
146 | - $return_value = @file_put_contents($system_path_file, '<?php' . PHP_EOL); |
|
146 | + $return_value = @file_put_contents($system_path_file, '<?php'.PHP_EOL); |
|
147 | 147 | |
148 | 148 | return $return_value; |
149 | 149 | } |
@@ -158,10 +158,10 @@ discard block |
||
158 | 158 | public static function write_data_in_file($path_file, $new_term, $new_variable) |
159 | 159 | { |
160 | 160 | $return_value = false; |
161 | - $new_data = $new_variable . '=' . $new_term; |
|
161 | + $new_data = $new_variable.'='.$new_term; |
|
162 | 162 | $resource = @fopen($path_file, "a"); |
163 | 163 | if (file_exists($path_file) && $resource) { |
164 | - if (fwrite($resource, $new_data . PHP_EOL) === false) { |
|
164 | + if (fwrite($resource, $new_data.PHP_EOL) === false) { |
|
165 | 165 | //not allow to write |
166 | 166 | $return_value = false; |
167 | 167 | } else { |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | if (empty($sub_language_dir)) { |
184 | 184 | return false; |
185 | 185 | } |
186 | - $dir = api_get_path(SYS_LANG_PATH) . $sub_language_dir; |
|
186 | + $dir = api_get_path(SYS_LANG_PATH).$sub_language_dir; |
|
187 | 187 | if (is_dir($dir)) { |
188 | 188 | return true; |
189 | 189 | } //even if the dir already exists, we reach the objective of having the directory there |
@@ -207,8 +207,8 @@ discard block |
||
207 | 207 | return false; |
208 | 208 | } |
209 | 209 | $table = Database :: get_main_table(TABLE_MAIN_LANGUAGE); |
210 | - $sql = 'SELECT dokeos_folder FROM ' . $table . ' |
|
211 | - WHERE parent_id = ' . $parent_id . ' and id = ' . $sub_language_id; |
|
210 | + $sql = 'SELECT dokeos_folder FROM '.$table.' |
|
211 | + WHERE parent_id = ' . $parent_id.' and id = '.$sub_language_id; |
|
212 | 212 | $res = Database::query($sql); |
213 | 213 | if ($res === false or Database::num_rows($res) < 1) { |
214 | 214 | return false; |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | if ($res === false) { |
219 | 219 | return false; |
220 | 220 | } //can't delete dir, so do not delete language record |
221 | - $sql = 'DELETE FROM ' . $table . ' |
|
221 | + $sql = 'DELETE FROM '.$table.' |
|
222 | 222 | WHERE id= ' . intval($sub_language_id); |
223 | 223 | $res = Database::query($sql); |
224 | 224 | |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | if (empty($sub_language_dir)) { |
236 | 236 | return false; |
237 | 237 | } |
238 | - $dir = api_get_path(SYS_LANG_PATH) . $sub_language_dir; |
|
238 | + $dir = api_get_path(SYS_LANG_PATH).$sub_language_dir; |
|
239 | 239 | if (!is_dir($dir)) { |
240 | 240 | return true; |
241 | 241 | } //even if the dir does not exist, we reach the objective of not having the directory there |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | |
244 | 244 | if (count($content) > 0) { |
245 | 245 | foreach ($content as $value_content) { |
246 | - $path_file = $dir . '/' . $value_content; |
|
246 | + $path_file = $dir.'/'.$value_content; |
|
247 | 247 | unlink($path_file); |
248 | 248 | } |
249 | 249 | return @rmdir($dir); |
@@ -261,8 +261,8 @@ discard block |
||
261 | 261 | { |
262 | 262 | $table = Database :: get_main_table(TABLE_MAIN_LANGUAGE); |
263 | 263 | $sql = 'SELECT count(*) as count |
264 | - FROM ' . $table . ' |
|
265 | - WHERE id="' . intval($language_id) . '"'; |
|
264 | + FROM ' . $table.' |
|
265 | + WHERE id="' . intval($language_id).'"'; |
|
266 | 266 | $rs = Database::query($sql); |
267 | 267 | if (Database::num_rows($rs) > 0) { |
268 | 268 | if (Database::result($rs, 0, 'count') == 1) { |
@@ -284,8 +284,8 @@ discard block |
||
284 | 284 | { |
285 | 285 | $table = Database :: get_main_table(TABLE_MAIN_LANGUAGE); |
286 | 286 | $sql = 'SELECT original_name |
287 | - FROM ' . $table . ' |
|
288 | - WHERE id= ' . intval($language_id) . ''; |
|
287 | + FROM ' . $table.' |
|
288 | + WHERE id= ' . intval($language_id).''; |
|
289 | 289 | $rs = Database::query($sql); |
290 | 290 | if (Database::num_rows($rs) > 0) { |
291 | 291 | return Database::result($rs, 0, 'original_name'); |
@@ -303,8 +303,8 @@ discard block |
||
303 | 303 | public static function check_if_language_is_sub_language($language_id) |
304 | 304 | { |
305 | 305 | $table = Database :: get_main_table(TABLE_MAIN_LANGUAGE); |
306 | - $sql = 'SELECT count(*) AS count FROM ' . $table . ' |
|
307 | - WHERE id = ' . intval($language_id) . ' AND NOT ISNULL(parent_id)'; |
|
306 | + $sql = 'SELECT count(*) AS count FROM '.$table.' |
|
307 | + WHERE id = ' . intval($language_id).' AND NOT ISNULL(parent_id)'; |
|
308 | 308 | $rs = Database::query($sql); |
309 | 309 | |
310 | 310 | if (Database::num_rows($rs) > 0 && Database::result($rs, '0', 'count') == 1) { |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | { |
323 | 323 | $language_info = self::get_all_information_of_language($language_id); |
324 | 324 | $table = Database :: get_main_table(TABLE_MAIN_USER); |
325 | - $sql = 'SELECT count(*) AS count FROM ' . $table . ' |
|
325 | + $sql = 'SELECT count(*) AS count FROM '.$table.' |
|
326 | 326 | WHERE language ="' . Database::escape_string($language_info['english_name']).'"'; |
327 | 327 | $rs = Database::query($sql); |
328 | 328 | if (Database::num_rows($rs) > 0 && Database::result($rs, '0', 'count') >= 1) { |
@@ -340,8 +340,8 @@ discard block |
||
340 | 340 | public static function check_if_language_is_father($language_id) |
341 | 341 | { |
342 | 342 | $table = Database :: get_main_table(TABLE_MAIN_LANGUAGE); |
343 | - $sql = 'SELECT count(*) AS count FROM ' . $table . ' |
|
344 | - WHERE parent_id= ' . intval($language_id) . ' AND NOT ISNULL(parent_id);'; |
|
343 | + $sql = 'SELECT count(*) AS count FROM '.$table.' |
|
344 | + WHERE parent_id= ' . intval($language_id).' AND NOT ISNULL(parent_id);'; |
|
345 | 345 | $rs = Database::query($sql); |
346 | 346 | |
347 | 347 | if (Database::num_rows($rs) > 0 && Database::result($rs, '0', 'count') == 1) { |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | { |
361 | 361 | $tbl_admin_languages = Database :: get_main_table(TABLE_MAIN_LANGUAGE); |
362 | 362 | $sql = "UPDATE $tbl_admin_languages SET available='0' |
363 | - WHERE id = " . intval($language_id) . ""; |
|
363 | + WHERE id = ".intval($language_id).""; |
|
364 | 364 | $result = Database::query($sql); |
365 | 365 | |
366 | 366 | return $result !== false; //only return false on sql error |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | { |
376 | 376 | $tbl_admin_languages = Database :: get_main_table(TABLE_MAIN_LANGUAGE); |
377 | 377 | $sql = "UPDATE $tbl_admin_languages SET available='1' |
378 | - WHERE id = " . intval($language_id) . ""; |
|
378 | + WHERE id = ".intval($language_id).""; |
|
379 | 379 | $result = Database::query($sql); |
380 | 380 | |
381 | 381 | return $result !== false; //only return false on sql error |
@@ -393,11 +393,11 @@ discard block |
||
393 | 393 | } |
394 | 394 | $tbl_admin_languages = Database :: get_main_table(TABLE_MAIN_LANGUAGE); |
395 | 395 | $tbl_settings_current = Database :: get_main_table(TABLE_MAIN_SETTINGS_CURRENT); |
396 | - $sql = "SELECT english_name FROM " . $tbl_admin_languages . " |
|
397 | - WHERE id= " . intval($language_id) . ""; |
|
396 | + $sql = "SELECT english_name FROM ".$tbl_admin_languages." |
|
397 | + WHERE id= " . intval($language_id).""; |
|
398 | 398 | $result = Database::query($sql); |
399 | 399 | $lang = Database::fetch_array($result); |
400 | - $sql_update_2 = "UPDATE " . $tbl_settings_current . " SET selected_value='" . $lang['english_name'] . "' |
|
400 | + $sql_update_2 = "UPDATE ".$tbl_settings_current." SET selected_value='".$lang['english_name']."' |
|
401 | 401 | WHERE variable='platformLanguage'"; |
402 | 402 | $result_2 = Database::query($sql_update_2); |
403 | 403 | Event::addEvent( |
@@ -417,7 +417,7 @@ discard block |
||
417 | 417 | { |
418 | 418 | $name = api_get_setting('platformLanguage'); |
419 | 419 | $tbl_admin_languages = Database :: get_main_table(TABLE_MAIN_LANGUAGE); |
420 | - $sql = "SELECT id FROM " . $tbl_admin_languages . " WHERE english_name ='$name'"; |
|
420 | + $sql = "SELECT id FROM ".$tbl_admin_languages." WHERE english_name ='$name'"; |
|
421 | 421 | $res = Database::query($sql); |
422 | 422 | if (Database::num_rows($res) < 1) { |
423 | 423 | return false; |
@@ -436,10 +436,10 @@ discard block |
||
436 | 436 | { |
437 | 437 | $tbl_admin_languages = Database :: get_main_table(TABLE_MAIN_LANGUAGE); |
438 | 438 | $sql = "SELECT dokeos_folder |
439 | - FROM " . $tbl_admin_languages . " |
|
439 | + FROM " . $tbl_admin_languages." |
|
440 | 440 | WHERE id = ( |
441 | - SELECT parent_id FROM " . $tbl_admin_languages . " |
|
442 | - WHERE dokeos_folder = '" . Database::escape_string($language_path) . "' |
|
441 | + SELECT parent_id FROM " . $tbl_admin_languages." |
|
442 | + WHERE dokeos_folder = '" . Database::escape_string($language_path)."' |
|
443 | 443 | ) |
444 | 444 | "; |
445 | 445 | $result = Database::query($sql); |
@@ -461,7 +461,7 @@ discard block |
||
461 | 461 | $adminLanguagesTable = Database :: get_main_table(TABLE_MAIN_LANGUAGE); |
462 | 462 | // select language - if case several languages match, get the last (more recent) one |
463 | 463 | $sql = "SELECT english_name |
464 | - FROM " . $adminLanguagesTable . " |
|
464 | + FROM " . $adminLanguagesTable." |
|
465 | 465 | WHERE |
466 | 466 | isocode ='$isocode' AND |
467 | 467 | available = 1 |