@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | |
16 | 16 | public function get_announcements_id($username, $password, $course_code) |
17 | 17 | { |
18 | - if($this->verifyUserPass($username, $password) == "valid") |
|
18 | + if ($this->verifyUserPass($username, $password) == "valid") |
|
19 | 19 | { |
20 | 20 | |
21 | 21 | $result = self::get_announcements($username, $course_code); |
@@ -33,13 +33,13 @@ discard block |
||
33 | 33 | |
34 | 34 | public function get_announcement_data($username, $password, $course_code, $announcement_id, $field) |
35 | 35 | { |
36 | - if($this->verifyUserPass($username, $password) == "valid") |
|
36 | + if ($this->verifyUserPass($username, $password) == "valid") |
|
37 | 37 | { |
38 | 38 | $htmlcode = false; |
39 | 39 | $user_id = UserManager::get_user_id_from_username($username); |
40 | 40 | |
41 | 41 | $result = self::get_announcements($username, $course_code, $announcement_id); |
42 | - while($announcement = Database::fetch_array($result)) |
|
42 | + while ($announcement = Database::fetch_array($result)) |
|
43 | 43 | { |
44 | 44 | $announcements[] = $announcement; |
45 | 45 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | |
70 | 70 | return (htmlcode) ? html_entity_decode($announcements[0][$field_table]) : $announcements[0][$field_table]; |
71 | 71 | |
72 | - }else |
|
72 | + } else |
|
73 | 73 | return get_lang('InvalidId'); |
74 | 74 | } |
75 | 75 | |
@@ -82,11 +82,11 @@ discard block |
||
82 | 82 | $announcement_id = ($announcement_id == 0) ? "" : "AND announcement.id=".$announcement_id; |
83 | 83 | $user_id = UserManager::get_user_id_from_username($username); |
84 | 84 | $course_info = CourseManager::get_course_information($course_code); |
85 | - $tbl_item_property = Database::get_course_table(TABLE_ITEM_PROPERTY); |
|
86 | - $tbl_announcement = Database::get_course_table(TABLE_ANNOUNCEMENT); |
|
87 | - $maximum = '12'; |
|
85 | + $tbl_item_property = Database::get_course_table(TABLE_ITEM_PROPERTY); |
|
86 | + $tbl_announcement = Database::get_course_table(TABLE_ANNOUNCEMENT); |
|
87 | + $maximum = '12'; |
|
88 | 88 | |
89 | - $group_memberships=GroupManager::get_group_ids($course_info['real_id'], $user_id); |
|
89 | + $group_memberships = GroupManager::get_group_ids($course_info['real_id'], $user_id); |
|
90 | 90 | |
91 | 91 | if (api_get_group_id() == 0) { |
92 | 92 | $cond_user_id = " AND ( |
@@ -104,8 +104,8 @@ discard block |
||
104 | 104 | |
105 | 105 | // the user is member of several groups => display personal |
106 | 106 | // announcements AND his group announcements AND the general announcements |
107 | - if (is_array($group_memberships) && count($group_memberships)>0) { |
|
108 | - $sql="SELECT |
|
107 | + if (is_array($group_memberships) && count($group_memberships) > 0) { |
|
108 | + $sql = "SELECT |
|
109 | 109 | announcement.*, ip.visibility, ip.to_group_id, ip.insert_user_id |
110 | 110 | FROM $tbl_announcement announcement, $tbl_item_property ip |
111 | 111 | WHERE |
@@ -51,10 +51,10 @@ |
||
51 | 51 | 'WSCourse.DeleteCourse', |
52 | 52 | array('secret_key' => 'xsd:string', 'course_id_field_name' => 'xsd:string', 'course_id_value' => 'xsd:string'), |
53 | 53 | array(), |
54 | - 'urn:WSService', // namespace |
|
55 | - 'urn:WSService#WSCourse.DeleteCourse', // soapaction |
|
56 | - 'rpc', // style |
|
57 | - 'encoded', // use |
|
54 | + 'urn:WSService', // namespace |
|
55 | + 'urn:WSService#WSCourse.DeleteCourse', // soapaction |
|
56 | + 'rpc', // style |
|
57 | + 'encoded', // use |
|
58 | 58 | 'Delete a course in chamilo' // documentation |
59 | 59 | |
60 | 60 | ); |
@@ -60,11 +60,11 @@ |
||
60 | 60 | $courses_list = courses_list($_POST['security-key'], $_POST['visibility']); |
61 | 61 | foreach ($courses_list as $code => $cd) { |
62 | 62 | echo '<course>'; |
63 | - echo '<code>' , $code , '</code>'; |
|
64 | - echo '<title>' , $cd['title'] , '</title>'; |
|
65 | - echo '<url>' , $cd['url'] , '</url>'; |
|
66 | - echo '<teacher>' , $cd['teacher'] , '</teacher>'; |
|
67 | - echo '<language>' , $cd['language'] , '</language>'; |
|
63 | + echo '<code>', $code, '</code>'; |
|
64 | + echo '<title>', $cd['title'], '</title>'; |
|
65 | + echo '<url>', $cd['url'], '</url>'; |
|
66 | + echo '<teacher>', $cd['teacher'], '</teacher>'; |
|
67 | + echo '<language>', $cd['language'], '</language>'; |
|
68 | 68 | echo '</course>'; |
69 | 69 | } |
70 | 70 | } |
@@ -40,7 +40,7 @@ |
||
40 | 40 | * Singleton method |
41 | 41 | */ |
42 | 42 | public static function singleton() { |
43 | - if(!isset(self::$_instance)) { |
|
43 | + if (!isset(self::$_instance)) { |
|
44 | 44 | self::$_instance = new soap_server(); |
45 | 45 | // Set the error handler |
46 | 46 | WSCMError::setErrorHandler(new WSCMSoapErrorHandler()); |
@@ -15,12 +15,12 @@ discard block |
||
15 | 15 | { |
16 | 16 | |
17 | 17 | public function get_courses_code($username, $password) { |
18 | - if($this->verifyUserPass($username, $password) == "valid") { |
|
18 | + if ($this->verifyUserPass($username, $password) == "valid") { |
|
19 | 19 | $user_id = UserManager::get_user_id_from_username($username); |
20 | 20 | $listOfCourses = UserManager::get_personal_session_course_list($user_id); |
21 | 21 | |
22 | 22 | $courses_id = "#"; |
23 | - foreach ($listOfCourses as $course){ |
|
23 | + foreach ($listOfCourses as $course) { |
|
24 | 24 | $courses_id .= $course['code']."#"; |
25 | 25 | } |
26 | 26 | return $courses_id; |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | |
32 | 32 | public function get_course_title($username, $password, $course_code) |
33 | 33 | { |
34 | - if($this->verifyUserPass($username, $password) == "valid") |
|
34 | + if ($this->verifyUserPass($username, $password) == "valid") |
|
35 | 35 | { |
36 | 36 | $course_info = CourseManager::get_course_information($course_code); |
37 | 37 | return $course_info['title']; |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | $digest = getDigest(); |
13 | 13 | |
14 | 14 | // If there was no digest, show login |
15 | -if (is_null($digest)) requireLogin($realm,$nonce); |
|
15 | +if (is_null($digest)) requireLogin($realm, $nonce); |
|
16 | 16 | |
17 | 17 | $digestParts = digestParse($digest); |
18 | 18 | |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | $validResponse = md5("{$A1}:{$digestParts['nonce']}:{$digestParts['nc']}:{$digestParts['cnonce']}:{$digestParts['qop']}:{$A2}"); |
27 | 27 | |
28 | 28 | if ($digestParts['response'] != $validResponse) |
29 | - requireLogin($realm,$nonce); |
|
29 | + requireLogin($realm, $nonce); |
|
30 | 30 | else { |
31 | 31 | // We're in! |
32 | 32 | echo 'a7532ae474e5e66a0c16eddab02e02a7'; |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | // most other servers |
43 | 43 | } |
44 | 44 | elseif (isset($_SERVER['HTTP_AUTHENTICATION'])) { |
45 | - if (strpos(strtolower($_SERVER['HTTP_AUTHENTICATION']),'digest')===0) |
|
45 | + if (strpos(strtolower($_SERVER['HTTP_AUTHENTICATION']), 'digest') === 0) |
|
46 | 46 | $digest = substr($_SERVER['HTTP_AUTHORIZATION'], 7); |
47 | 47 | } |
48 | 48 | elseif (isset($_SERVER['HTTP_WWW_AUTHENTICATE'])) { |
@@ -53,8 +53,8 @@ discard block |
||
53 | 53 | } |
54 | 54 | |
55 | 55 | // This function forces a login prompt |
56 | -function requireLogin($realm,$nonce) { |
|
57 | - header('WWW-Authenticate: Digest realm="' . $realm . '",qop="auth",nonce="' . $nonce . '",opaque="' . md5($realm) . '"'); |
|
56 | +function requireLogin($realm, $nonce) { |
|
57 | + header('WWW-Authenticate: Digest realm="'.$realm.'",qop="auth",nonce="'.$nonce.'",opaque="'.md5($realm).'"'); |
|
58 | 58 | header('HTTP/1.1 401'); |
59 | 59 | echo 'Authentication Canceled'; |
60 | 60 | die(); |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | { |
13 | 13 | public function unreadMessage($username, $password) |
14 | 14 | { |
15 | - if($this->verifyUserPass($username, $password) == "valid") |
|
15 | + if ($this->verifyUserPass($username, $password) == "valid") |
|
16 | 16 | { |
17 | 17 | $table_message = Database::get_main_table(TABLE_MESSAGE); |
18 | 18 | $user_id = UserManager::get_user_id_from_username($username); |
@@ -30,14 +30,14 @@ discard block |
||
30 | 30 | |
31 | 31 | public function get_message_id($username, $password, $from, $number_of_items) |
32 | 32 | { |
33 | - if($this->verifyUserPass($username, $password) == "valid") |
|
33 | + if ($this->verifyUserPass($username, $password) == "valid") |
|
34 | 34 | { |
35 | 35 | $user_id = UserManager::get_user_id_from_username($username); |
36 | 36 | |
37 | 37 | $table_message = Database::get_main_table(TABLE_MESSAGE); |
38 | 38 | |
39 | - $sql_query = "SELECT id FROM $table_message " . |
|
40 | - " WHERE user_receiver_id=".$user_id." AND msg_status IN (0,1)" . |
|
39 | + $sql_query = "SELECT id FROM $table_message ". |
|
40 | + " WHERE user_receiver_id=".$user_id." AND msg_status IN (0,1)". |
|
41 | 41 | " ORDER BY send_date LIMIT $from,$number_of_items"; |
42 | 42 | |
43 | 43 | $sql_result = Database::query($sql_query); |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | |
56 | 56 | public function get_message_data($username, $password, $message_id, $field) |
57 | 57 | { |
58 | - if($this->verifyUserPass($username, $password) == "valid") |
|
58 | + if ($this->verifyUserPass($username, $password) == "valid") |
|
59 | 59 | { |
60 | 60 | $htmlcode = false; |
61 | 61 | $user_id = UserManager::get_user_id_from_username($username); |
@@ -85,14 +85,14 @@ discard block |
||
85 | 85 | |
86 | 86 | $table_message = Database::get_main_table(TABLE_MESSAGE); |
87 | 87 | |
88 | - $sql_query = "SELECT ".$field_table." FROM $table_message " . |
|
88 | + $sql_query = "SELECT ".$field_table." FROM $table_message ". |
|
89 | 89 | " WHERE user_receiver_id=".$user_id." AND id=".$message_id; |
90 | 90 | |
91 | 91 | $sql_result = Database::query($sql_query); |
92 | 92 | $result = Database::fetch_row($sql_result); |
93 | 93 | return (htmlcode) ? html_entity_decode($result[0]) : $result[0]; |
94 | 94 | |
95 | - }else |
|
95 | + } else |
|
96 | 96 | return get_lang('InvalidId'); |
97 | 97 | |
98 | 98 | |
@@ -100,14 +100,14 @@ discard block |
||
100 | 100 | |
101 | 101 | public function get_message_id_sent($username, $password, $from, $number_of_items) |
102 | 102 | { |
103 | - if($this->verifyUserPass($username, $password) == "valid") |
|
103 | + if ($this->verifyUserPass($username, $password) == "valid") |
|
104 | 104 | { |
105 | 105 | $user_id = UserManager::get_user_id_from_username($username); |
106 | 106 | |
107 | 107 | $table_message = Database::get_main_table(TABLE_MESSAGE); |
108 | 108 | |
109 | - $sql_query = "SELECT id FROM $table_message " . |
|
110 | - "WHERE user_sender_id=".$user_id." AND msg_status=".MESSAGE_STATUS_OUTBOX." " . |
|
109 | + $sql_query = "SELECT id FROM $table_message ". |
|
110 | + "WHERE user_sender_id=".$user_id." AND msg_status=".MESSAGE_STATUS_OUTBOX." ". |
|
111 | 111 | "ORDER BY send_date LIMIT $from,$number_of_items"; |
112 | 112 | |
113 | 113 | $sql_result = Database::query($sql_query); |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | |
127 | 127 | public function get_message_data_sent($username, $password, $id, $field) |
128 | 128 | { |
129 | - if($this->verifyUserPass($username, $password) == "valid") |
|
129 | + if ($this->verifyUserPass($username, $password) == "valid") |
|
130 | 130 | { |
131 | 131 | $htmlcode = false; |
132 | 132 | switch ($field) |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | |
157 | 157 | $table_message = Database::get_main_table(TABLE_MESSAGE); |
158 | 158 | |
159 | - $sql_query = "SELECT ".$field_table." FROM $table_message " . |
|
159 | + $sql_query = "SELECT ".$field_table." FROM $table_message ". |
|
160 | 160 | " WHERE user_sender_id=".$user_id." AND id=".$id; |
161 | 161 | |
162 | 162 | $sql_result = Database::query($sql_query); |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | |
165 | 165 | return (htmlcode) ? html_entity_decode($result[0]) : $result[0]; |
166 | 166 | |
167 | - }else |
|
167 | + } else |
|
168 | 168 | return get_lang('InvalidId'); |
169 | 169 | |
170 | 170 | |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | public function message_send($username, $password, $receiver_user_id, $subject, $content) |
174 | 174 | { |
175 | 175 | //TODO: verificar data de envio. Esta divergindo de data! |
176 | - if($this->verifyUserPass($username, $password) == "valid") |
|
176 | + if ($this->verifyUserPass($username, $password) == "valid") |
|
177 | 177 | { |
178 | 178 | $group_id = intval(0); |
179 | 179 | $parent_id = intval(0); |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | |
205 | 205 | } |
206 | 206 | |
207 | - protected function set_message_as_read($user_id, $message_id){ |
|
207 | + protected function set_message_as_read($user_id, $message_id) { |
|
208 | 208 | $table_message = Database::get_main_table(TABLE_MESSAGE); |
209 | 209 | $query = "UPDATE $table_message SET msg_status = '".MESSAGE_STATUS_NEW."' WHERE user_receiver_id=".$user_id." AND id='".$message_id."';"; |
210 | 210 | $result = Database::query($query); |
@@ -21,7 +21,7 @@ |
||
21 | 21 | $tuserfv = Database::get_main_table(TABLE_EXTRA_FIELD_VALUES); |
22 | 22 | $sql = "SELECT user_id, username FROM $tuser ORDER BY user_id"; |
23 | 23 | $res = Database::query($sql); |
24 | -while($row = Database::fetch_array($res)) { |
|
24 | +while ($row = Database::fetch_array($res)) { |
|
25 | 25 | $sql2 = "INSERT INTO $tuserfv (item_id, field_id, value) |
26 | 26 | VALUES (".$row['user_id'].", 11,'".$row['username']."')"; |
27 | 27 | $res2 = Database::query($sql2); |
@@ -36,7 +36,7 @@ |
||
36 | 36 | if (isset($_REQUEST['cidReq']) && !empty($_REQUEST['cidReq'])) { |
37 | 37 | if ($_REQUEST['cidReq'] == -1) { |
38 | 38 | // When is out of the course tool (e.g My agenda) |
39 | - header('Location: ' . api_get_self()); |
|
39 | + header('Location: '.api_get_self()); |
|
40 | 40 | exit; |
41 | 41 | } else { |
42 | 42 | $type = 'course'; |