@@ -19,14 +19,14 @@ discard block |
||
19 | 19 | |
20 | 20 | public function get_foruns_id($username, $password, $course_code) |
21 | 21 | { |
22 | - if($this->verifyUserPass($username, $password) == "valid") |
|
22 | + if ($this->verifyUserPass($username, $password) == "valid") |
|
23 | 23 | { |
24 | 24 | $course_db = CourseManager::get_course_information($course_code); |
25 | - $foruns_info = get_forums($id='', $course_db['code']); |
|
25 | + $foruns_info = get_forums($id = '', $course_db['code']); |
|
26 | 26 | $foruns_id = '#'; |
27 | 27 | foreach ($foruns_info as $forum) |
28 | 28 | { |
29 | - if( isset($forum['forum_id'])) |
|
29 | + if (isset($forum['forum_id'])) |
|
30 | 30 | { |
31 | 31 | $foruns_id .= $forum['forum_id']."#"; |
32 | 32 | } |
@@ -38,18 +38,18 @@ discard block |
||
38 | 38 | |
39 | 39 | public function get_forum_title($username, $password, $course_code, $forum_id) |
40 | 40 | { |
41 | - if($this->verifyUserPass($username, $password) == "valid") |
|
41 | + if ($this->verifyUserPass($username, $password) == "valid") |
|
42 | 42 | { |
43 | 43 | $course_db = CourseManager::get_course_information($course_code); |
44 | 44 | $table_forums = Database :: get_course_table(TABLE_FORUM, $course_db['db_name']); |
45 | 45 | $table_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY, $course_db['db_name']); |
46 | 46 | |
47 | - $sql="SELECT * FROM ".$table_forums." forums, ".$table_item_property." item_properties |
|
47 | + $sql = "SELECT * FROM ".$table_forums." forums, ".$table_item_property." item_properties |
|
48 | 48 | WHERE item_properties.tool='".TOOL_FORUM."' |
49 | 49 | AND item_properties.ref='".Database::escape_string($forum_id)."' |
50 | 50 | AND forums.forum_id='".Database::escape_string($forum_id)."'"; |
51 | - $result=Database::query($sql); |
|
52 | - $forum_info=Database::fetch_array($result); |
|
51 | + $result = Database::query($sql); |
|
52 | + $forum_info = Database::fetch_array($result); |
|
53 | 53 | $forum_info['approval_direct_post'] = 0; // we can't anymore change this option, so it should always be activated |
54 | 54 | |
55 | 55 | $forum_title = utf8_decode($forum_info['forum_title']); |
@@ -60,12 +60,12 @@ discard block |
||
60 | 60 | |
61 | 61 | public function get_forum_threads_id($username, $password, $course_code, $forum_id) |
62 | 62 | { |
63 | - if($this->verifyUserPass($username, $password) == "valid") { |
|
63 | + if ($this->verifyUserPass($username, $password) == "valid") { |
|
64 | 64 | $threads_info = get_threads($forum_id, $course_code); |
65 | 65 | $threads_id = '#'; |
66 | 66 | foreach ($threads_info as $thread) |
67 | 67 | { |
68 | - if( isset($thread['thread_id'])) |
|
68 | + if (isset($thread['thread_id'])) |
|
69 | 69 | { |
70 | 70 | $threads_id .= $thread['thread_id']."#"; |
71 | 71 | } |
@@ -79,18 +79,18 @@ discard block |
||
79 | 79 | |
80 | 80 | public function get_forum_thread_data($username, $password, $course_code, $thread_id, $field) |
81 | 81 | { |
82 | - if($this->verifyUserPass($username, $password) == "valid") |
|
82 | + if ($this->verifyUserPass($username, $password) == "valid") |
|
83 | 83 | { |
84 | 84 | $course_db = CourseManager::get_course_information($course_code); |
85 | 85 | $table_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY, $course_db['db_name']); |
86 | 86 | $table_threads = Database :: get_course_table(TABLE_FORUM_THREAD, $course_db['db_name']); |
87 | 87 | |
88 | - $sql="SELECT * FROM ".$table_threads." threads, ".$table_item_property." item_properties |
|
88 | + $sql = "SELECT * FROM ".$table_threads." threads, ".$table_item_property." item_properties |
|
89 | 89 | WHERE item_properties.tool='".TOOL_FORUM_THREAD."' |
90 | 90 | AND item_properties.ref='".Database::escape_string($thread_id)."' |
91 | 91 | AND threads.thread_id='".Database::escape_string($thread_id)."'"; |
92 | - $result=Database::query($sql); |
|
93 | - $thread_info=Database::fetch_array($result); |
|
92 | + $result = Database::query($sql); |
|
93 | + $thread_info = Database::fetch_array($result); |
|
94 | 94 | |
95 | 95 | switch ($field) |
96 | 96 | { |
@@ -121,18 +121,18 @@ discard block |
||
121 | 121 | |
122 | 122 | public function get_forum_thread_title($username, $password, $course_code, $thread_id) |
123 | 123 | { |
124 | - if($this->verifyUserPass($username, $password) == "valid") |
|
124 | + if ($this->verifyUserPass($username, $password) == "valid") |
|
125 | 125 | { |
126 | 126 | $course_db = CourseManager::get_course_information($course_code); |
127 | 127 | $table_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY, $course_db['db_name']); |
128 | 128 | $table_threads = Database :: get_course_table(TABLE_FORUM_THREAD, $course_db['db_name']); |
129 | 129 | |
130 | - $sql="SELECT * FROM ".$table_threads." threads, ".$table_item_property." item_properties |
|
130 | + $sql = "SELECT * FROM ".$table_threads." threads, ".$table_item_property." item_properties |
|
131 | 131 | WHERE item_properties.tool='".TOOL_FORUM_THREAD."' |
132 | 132 | AND item_properties.ref='".Database::escape_string($thread_id)."' |
133 | 133 | AND threads.thread_id='".Database::escape_string($thread_id)."'"; |
134 | - $result=Database::query($sql); |
|
135 | - $thread_info=Database::fetch_array($result); |
|
134 | + $result = Database::query($sql); |
|
135 | + $thread_info = Database::fetch_array($result); |
|
136 | 136 | |
137 | 137 | $htmlcode = true; |
138 | 138 | $field_table = "thread_title"; |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | |
147 | 147 | public function get_posts_id($username, $password, $course_code, $thread_id) |
148 | 148 | { |
149 | - if($this->verifyUserPass($username, $password) == "valid") |
|
149 | + if ($this->verifyUserPass($username, $password) == "valid") |
|
150 | 150 | { |
151 | 151 | $course_db = CourseManager::get_course_information($course_code); |
152 | 152 | |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | $table_posts = Database :: get_course_table(TABLE_FORUM_POST, $course_db['db_name']); |
155 | 155 | |
156 | 156 | // note: change these SQL so that only the relevant fields of the user table are used |
157 | - if (api_is_allowed_to_edit(null,true)) { |
|
157 | + if (api_is_allowed_to_edit(null, true)) { |
|
158 | 158 | $sql = "SELECT * FROM $table_posts posts |
159 | 159 | LEFT JOIN $table_users users |
160 | 160 | ON posts.poster_id=users.user_id |
@@ -169,16 +169,16 @@ discard block |
||
169 | 169 | AND posts.visible='1' |
170 | 170 | ORDER BY posts.post_id ASC"; |
171 | 171 | } |
172 | - $result=Database::query($sql); |
|
173 | - while ($row=Database::fetch_array($result)) { |
|
174 | - $posts_info[]=$row; |
|
172 | + $result = Database::query($sql); |
|
173 | + while ($row = Database::fetch_array($result)) { |
|
174 | + $posts_info[] = $row; |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | $posts_id = '#'; |
178 | 178 | |
179 | 179 | foreach ($posts_info as $post) |
180 | 180 | { |
181 | - if( isset($post['post_id'])) |
|
181 | + if (isset($post['post_id'])) |
|
182 | 182 | { |
183 | 183 | $posts_id .= $post['post_id']."#"; |
184 | 184 | } |
@@ -190,16 +190,16 @@ discard block |
||
190 | 190 | |
191 | 191 | public function get_post_data($username, $password, $course_code, $post_id, $field) |
192 | 192 | { |
193 | - if($this->verifyUserPass($username, $password) == "valid") |
|
193 | + if ($this->verifyUserPass($username, $password) == "valid") |
|
194 | 194 | { |
195 | 195 | $course_db = CourseManager::get_course_information($course_code); |
196 | 196 | |
197 | 197 | $table_posts = Database :: get_course_table(TABLE_FORUM_POST, $course_db['db_name']); |
198 | 198 | $table_users = Database :: get_main_table(TABLE_MAIN_USER); |
199 | 199 | |
200 | - $sql="SELECT * FROM ".$table_posts."posts, ".$table_users." users WHERE posts.poster_id=users.user_id AND posts.post_id='".Database::escape_string($post_id)."'"; |
|
201 | - $result=Database::query($sql); |
|
202 | - $post_info =Database::fetch_array($result); |
|
200 | + $sql = "SELECT * FROM ".$table_posts."posts, ".$table_users." users WHERE posts.poster_id=users.user_id AND posts.post_id='".Database::escape_string($post_id)."'"; |
|
201 | + $result = Database::query($sql); |
|
202 | + $post_info = Database::fetch_array($result); |
|
203 | 203 | |
204 | 204 | $htmlcode = false; |
205 | 205 | switch ($field) |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | |
233 | 233 | public function send_post($username, $password, $course_code, $forum_id, $thread_id, $title, $content) |
234 | 234 | { |
235 | - if($this->verifyUserPass($username, $password) == "valid") |
|
235 | + if ($this->verifyUserPass($username, $password) == "valid") |
|
236 | 236 | { |
237 | 237 | $em = Database::getManager(); |
238 | 238 | $course_db = CourseManager::get_course_information($course_code); |
@@ -241,9 +241,9 @@ discard block |
||
241 | 241 | $table_threads = Database :: get_course_table(TABLE_FORUM_THREAD, $course_db['db_name']); |
242 | 242 | $forum_table_attachment = Database :: get_course_table(TABLE_FORUM_ATTACHMENT, $course_db['db_name']); |
243 | 243 | $table_posts = Database :: get_course_table(TABLE_FORUM_POST, $course_db['db_name']); |
244 | - $post_date=date('Y-m-d H:i:s'); |
|
245 | - $visible=1; |
|
246 | - $has_attachment=false; |
|
244 | + $post_date = date('Y-m-d H:i:s'); |
|
245 | + $visible = 1; |
|
246 | + $has_attachment = false; |
|
247 | 247 | $my_post = ''; |
248 | 248 | $post_notification = ''; |
249 | 249 |