@@ 190-220 (lines=31) @@ | ||
187 | * @param array $sectionData |
|
188 | * @return bool |
|
189 | */ |
|
190 | public function changeSection($sectionId, Array $sectionData) |
|
191 | { |
|
192 | $checkedData = $this->checkSectionData($sectionData); |
|
193 | $set = ''; |
|
194 | $comma = ''; |
|
195 | ||
196 | foreach ($sectionData as $key => $val) { |
|
197 | $set .= $comma.$key." = '".$this->config->getDb()->escape($checkedData[$key])."'"; |
|
198 | $comma = ",\n "; |
|
199 | } |
|
200 | ||
201 | $update = sprintf(' |
|
202 | UPDATE |
|
203 | %sfaqsections |
|
204 | SET |
|
205 | %s |
|
206 | WHERE |
|
207 | id = %d', |
|
208 | Db::getTablePrefix(), |
|
209 | $set, |
|
210 | $sectionId |
|
211 | ); |
|
212 | ||
213 | $res = $this->config->getDb()->query($update); |
|
214 | ||
215 | if (!$res) { |
|
216 | return false; |
|
217 | } |
|
218 | ||
219 | return true; |
|
220 | } |
|
221 | ||
222 | /** |
|
223 | * Checks the given associative array $sectionData. If a |
@@ 309-339 (lines=31) @@ | ||
306 | * |
|
307 | * @return bool |
|
308 | */ |
|
309 | public function changeGroup($groupId, Array $groupData) |
|
310 | { |
|
311 | $checkedData = $this->checkGroupData($groupData); |
|
312 | $set = ''; |
|
313 | $comma = ''; |
|
314 | ||
315 | foreach ($groupData as $key => $val) { |
|
316 | $set .= $comma.$key." = '".$this->config->getDb()->escape($checkedData[$key])."'"; |
|
317 | $comma = ",\n "; |
|
318 | } |
|
319 | ||
320 | $update = sprintf(' |
|
321 | UPDATE |
|
322 | %sfaqgroup |
|
323 | SET |
|
324 | %s |
|
325 | WHERE |
|
326 | group_id = %d', |
|
327 | Db::getTablePrefix(), |
|
328 | $set, |
|
329 | $groupId |
|
330 | ); |
|
331 | ||
332 | $res = $this->config->getDb()->query($update); |
|
333 | ||
334 | if (!$res) { |
|
335 | return false; |
|
336 | } |
|
337 | ||
338 | return true; |
|
339 | } |
|
340 | ||
341 | /** |
|
342 | * Removes the group given by $groupId from the database. |