1111namespace phpbb \ideas \controller ;
1212
1313use phpbb \exception \http_exception ;
14- use phpbb \ideas \factory \ ideas ;
14+ use phpbb \ideas \ext ;
1515use Symfony \Component \HttpFoundation \JsonResponse ;
1616use Symfony \Component \HttpFoundation \RedirectResponse ;
1717
@@ -20,6 +20,9 @@ class idea_controller extends base
2020 /** @var array of idea data */
2121 protected $ data ;
2222
23+ /* @var \phpbb\ideas\factory\idea */
24+ protected $ entity ;
25+
2326 /**
2427 * Controller for /idea/{idea_id}
2528 *
@@ -34,7 +37,7 @@ public function idea($idea_id)
3437 throw new http_exception (404 , 'IDEAS_NOT_AVAILABLE ' );
3538 }
3639
37- $ this ->data = $ this ->ideas ->get_idea ($ idea_id );
40+ $ this ->data = $ this ->entity ->get_idea ($ idea_id );
3841 if (!$ this ->data )
3942 {
4043 throw new http_exception (404 , 'IDEA_NOT_FOUND ' );
@@ -80,7 +83,7 @@ public function delete()
8083 if (confirm_box (true ))
8184 {
8285 include $ this ->root_path . 'includes/functions_admin. ' . $ this ->php_ext ;
83- $ this ->ideas ->delete ($ this ->data ['idea_id ' ], $ this ->data ['topic_id ' ]);
86+ $ this ->entity ->delete ($ this ->data ['idea_id ' ], $ this ->data ['topic_id ' ]);
8487
8588 $ redirect = $ this ->helper ->route ('phpbb_ideas_index_controller ' );
8689 $ message = $ this ->language ->lang ('IDEA_DELETED ' ) . '<br /><br /> ' . $ this ->language ->lang ('RETURN_IDEAS ' , '<a href=" ' . $ redirect . '"> ' , '</a> ' );
@@ -119,7 +122,7 @@ public function duplicate()
119122 if ($ this ->is_mod () && check_link_hash ($ this ->get_hash (), "duplicate_ {$ this ->data ['idea_id ' ]}" ))
120123 {
121124 $ duplicate = $ this ->request ->variable ('duplicate ' , 0 );
122- return $ this ->ideas ->set_duplicate ($ this ->data ['idea_id ' ], $ duplicate );
125+ return $ this ->entity ->set_duplicate ($ this ->data ['idea_id ' ], $ duplicate );
123126 }
124127
125128 return false ;
@@ -133,14 +136,14 @@ public function duplicate()
133136 */
134137 public function removevote ()
135138 {
136- if ($ this ->data ['idea_status ' ] === ideas ::$ statuses ['IMPLEMENTED ' ] || $ this ->data ['idea_status ' ] === ideas ::$ statuses ['DUPLICATE ' ] || !check_link_hash ($ this ->get_hash (), "removevote_ {$ this ->data ['idea_id ' ]}" ))
139+ if ($ this ->data ['idea_status ' ] === ext ::$ statuses ['IMPLEMENTED ' ] || $ this ->data ['idea_status ' ] === ext ::$ statuses ['DUPLICATE ' ] || !check_link_hash ($ this ->get_hash (), "removevote_ {$ this ->data ['idea_id ' ]}" ))
137140 {
138141 return false ;
139142 }
140143
141144 if ($ this ->auth ->acl_get ('f_vote ' , (int ) $ this ->config ['ideas_forum_id ' ]))
142145 {
143- $ result = $ this ->ideas ->remove_vote ($ this ->data , $ this ->user ->data ['user_id ' ]);
146+ $ result = $ this ->entity ->remove_vote ($ this ->data , $ this ->user ->data ['user_id ' ]);
144147 }
145148 else
146149 {
@@ -161,7 +164,7 @@ public function rfc()
161164 if (($ this ->is_own () || $ this ->is_mod ()) && check_link_hash ($ this ->get_hash (), "rfc_ {$ this ->data ['idea_id ' ]}" ))
162165 {
163166 $ rfc = $ this ->request ->variable ('rfc ' , '' );
164- return $ this ->ideas ->set_rfc ($ this ->data ['idea_id ' ], $ rfc );
167+ return $ this ->entity ->set_rfc ($ this ->data ['idea_id ' ], $ rfc );
165168 }
166169
167170 return false ;
@@ -179,7 +182,7 @@ public function status()
179182
180183 if ($ status && $ this ->is_mod () && check_link_hash ($ this ->get_hash (), "status_ {$ this ->data ['idea_id ' ]}" ))
181184 {
182- $ this ->ideas -> change_status ($ this ->data ['idea_id ' ], $ status );
185+ $ this ->entity -> set_status ($ this ->data ['idea_id ' ], $ status );
183186 return true ;
184187 }
185188
@@ -197,7 +200,7 @@ public function ticket()
197200 if (($ this ->is_own () || $ this ->is_mod ()) && check_link_hash ($ this ->get_hash (), "ticket_ {$ this ->data ['idea_id ' ]}" ))
198201 {
199202 $ ticket = $ this ->request ->variable ('ticket ' , 0 );
200- return $ this ->ideas ->set_ticket ($ this ->data ['idea_id ' ], $ ticket );
203+ return $ this ->entity ->set_ticket ($ this ->data ['idea_id ' ], $ ticket );
201204 }
202205
203206 return false ;
@@ -214,26 +217,7 @@ public function implemented()
214217 if ($ this ->is_mod () && check_link_hash ($ this ->get_hash (), "implemented_ {$ this ->data ['idea_id ' ]}" ))
215218 {
216219 $ version = $ this ->request ->variable ('implemented ' , '' );
217- return $ this ->ideas ->set_implemented ($ this ->data ['idea_id ' ], $ version );
218- }
219-
220- return false ;
221- }
222-
223- /**
224- * Title action (sets an idea's title)
225- *
226- * @return bool True if set, false if not
227- * @access public
228- *
229- * @deprecated 2.1.0 (No longer used, may be removed one day)
230- */
231- public function title ()
232- {
233- if (($ this ->is_own () || $ this ->is_mod ()) && check_link_hash ($ this ->get_hash (), "title_ {$ this ->data ['idea_id ' ]}" ))
234- {
235- $ title = $ this ->request ->variable ('title ' , '' , true );
236- return $ this ->ideas ->set_title ($ this ->data ['idea_id ' ], $ title );
220+ return $ this ->entity ->set_implemented ($ this ->data ['idea_id ' ], $ version );
237221 }
238222
239223 return false ;
@@ -249,14 +233,14 @@ public function vote()
249233 {
250234 $ vote = $ this ->request ->variable ('v ' , 1 );
251235
252- if ($ this ->data ['idea_status ' ] === ideas ::$ statuses ['IMPLEMENTED ' ] || $ this ->data ['idea_status ' ] === ideas ::$ statuses ['DUPLICATE ' ] || !check_link_hash ($ this ->get_hash (), "vote_ {$ this ->data ['idea_id ' ]}" ))
236+ if ($ this ->data ['idea_status ' ] === ext ::$ statuses ['IMPLEMENTED ' ] || $ this ->data ['idea_status ' ] === ext ::$ statuses ['DUPLICATE ' ] || !check_link_hash ($ this ->get_hash (), "vote_ {$ this ->data ['idea_id ' ]}" ))
253237 {
254238 return false ;
255239 }
256240
257241 if ($ this ->auth ->acl_get ('f_vote ' , (int ) $ this ->config ['ideas_forum_id ' ]))
258242 {
259- $ result = $ this ->ideas ->vote ($ this ->data , $ this ->user ->data ['user_id ' ], $ vote );
243+ $ result = $ this ->entity ->vote ($ this ->data , $ this ->user ->data ['user_id ' ], $ vote );
260244 }
261245 else
262246 {
0 commit comments