@@ 15-23 (lines=9) @@ | ||
12 | ||
13 | class m2_initial_data extends \phpbb\db\migration\migration |
|
14 | { |
|
15 | public function effectively_installed() |
|
16 | { |
|
17 | $sql = 'SELECT * FROM ' . $this->table_prefix . 'ideas_statuses'; |
|
18 | $result = $this->db->sql_query_limit($sql, 1); |
|
19 | $row = $this->db->sql_fetchrow($result); |
|
20 | $this->db->sql_freeresult($result); |
|
21 | ||
22 | return $row !== false; |
|
23 | } |
|
24 | ||
25 | static public function depends_on() |
|
26 | { |
@@ 15-25 (lines=11) @@ | ||
12 | ||
13 | class m4_update_statuses extends \phpbb\db\migration\migration |
|
14 | { |
|
15 | public function effectively_installed() |
|
16 | { |
|
17 | $sql = 'SELECT status_id |
|
18 | FROM ' . $this->table_prefix . "ideas_statuses |
|
19 | WHERE status_name='New'"; |
|
20 | $result = $this->db->sql_query($sql); |
|
21 | $row = $this->db->sql_fetchrow($result); |
|
22 | $this->db->sql_freeresult($result); |
|
23 | ||
24 | return $row === false; |
|
25 | } |
|
26 | ||
27 | static public function depends_on() |
|
28 | { |
@@ 300-310 (lines=11) @@ | ||
297 | * |
|
298 | * @return array|false The idea row set, or false if not found. |
|
299 | */ |
|
300 | public function get_idea($id) |
|
301 | { |
|
302 | $sql = 'SELECT * |
|
303 | FROM ' . $this->table_ideas . ' |
|
304 | WHERE idea_id = ' . (int) $id; |
|
305 | $result = $this->db->sql_query_limit($sql, 1); |
|
306 | $row = $this->db->sql_fetchrow($result); |
|
307 | $this->db->sql_freeresult($result); |
|
308 | ||
309 | return $row; |
|
310 | } |
|
311 | ||
312 | /** |
|
313 | * Returns an idea specified by its topic ID. |
|
@@ 319-329 (lines=11) @@ | ||
316 | * |
|
317 | * @return array|false The idea row set, or false if not found. |
|
318 | */ |
|
319 | public function get_idea_by_topic_id($id) |
|
320 | { |
|
321 | $sql = 'SELECT idea_id |
|
322 | FROM ' . $this->table_ideas . ' |
|
323 | WHERE topic_id = ' . (int) $id; |
|
324 | $result = $this->db->sql_query_limit($sql, 1); |
|
325 | $idea_id = (int) $this->db->sql_fetchfield('idea_id'); |
|
326 | $this->db->sql_freeresult($result); |
|
327 | ||
328 | return $this->get_idea($idea_id); |
|
329 | } |
|
330 | ||
331 | /** |
|
332 | * Do a live search on idea titles. Return any matches based on a given search query. |
|
@@ 517-527 (lines=11) @@ | ||
514 | * |
|
515 | * @return string The idea's title |
|
516 | */ |
|
517 | public function get_title($id) |
|
518 | { |
|
519 | $sql = 'SELECT idea_title |
|
520 | FROM ' . $this->table_ideas . ' |
|
521 | WHERE idea_id = ' . (int) $id; |
|
522 | $result = $this->db->sql_query_limit($sql, 1); |
|
523 | $idea_title = $this->db->sql_fetchfield('idea_title'); |
|
524 | $this->db->sql_freeresult($result); |
|
525 | ||
526 | return $idea_title; |
|
527 | } |
|
528 | ||
529 | /** |
|
530 | * Submits a vote on an idea. |