@@ -66,9 +66,6 @@ class main
6666 /** @var \phpbb\captcha\factory */
6767 protected $ captcha_factory ;
6868
69- /** @var string */
70- protected $ geshi_path ;
71-
7269 /** @var string */
7370 protected $ geshi_lang ;
7471
@@ -108,7 +105,6 @@ public function __construct(
108105 \phpbbde \pastebin \functions \pastebin $ pastebin ,
109106 $ root_path ,
110107 $ php_ext ,
111- $ geshi_path ,
112108 $ geshi_lang ,
113109 $ pastebin_table )
114110 {
@@ -128,16 +124,11 @@ public function __construct(
128124 $ this ->util = $ util ;
129125 $ this ->captcha_factory = $ captcha_factory ;
130126
131- $ this ->geshi_path = $ geshi_path ;
132127 $ this ->pastebin_table = $ pastebin_table ;
133128 $ this ->geshi_lang = $ geshi_lang ;
134129 }
135130
136- /**
137- * Handle all calls
138- * @param string $name
139- */
140- public function handle ($ name = '' )
131+ public function handle ()
141132 {
142133 $ this ->language ->add_lang ('pastebin ' , 'phpbbde/pastebin ' );
143134
@@ -152,20 +143,7 @@ public function handle($name = '')
152143 return $ response ;
153144 }
154145
155- return $ this ->helper ->render ('pastebin_body.html ' , $ this ->language ->lang ('PASTEBIN ' ));
156- }
157-
158- /**
159- * Adjust table naming correctly
160- * @param string $name
161- * @return string
162- */
163- private function table ($ name )
164- {
165- if ($ name == 'pastebin ' )
166- {
167- return $ this ->pastebin_table ;
168- }
146+ return $ this ->helper ->render ('@phpbbde_pastebin/pastebin_body.html ' , $ this ->language ->lang ('PASTEBIN ' ));
169147 }
170148
171149 /**
@@ -175,8 +153,6 @@ private function display_pb()
175153 {
176154 // Request variables
177155 $ mode = $ this ->request ->variable ('mode ' , '' );
178- $ confirm_id = $ this ->request ->variable ('confirm_id ' , '' );
179- $ confirm_code = $ this ->request ->variable ('confirm_code ' , '' );
180156 $ snippet_id = $ this ->request ->variable ('s ' , 0 );
181157 $ submit = $ this ->request ->is_set_post ('submit ' );
182158
@@ -187,7 +163,7 @@ private function display_pb()
187163 $ sql = $ this ->db ->sql_build_query ('SELECT ' , array (
188164 'SELECT ' => 'pb.*, u.user_id, u.username, u.user_colour ' ,
189165 'FROM ' => array (
190- $ this ->table ( ' pastebin ' ) => 'pb ' ,
166+ $ this ->pastebin_table => 'pb ' ,
191167 USERS_TABLE => 'u ' ,
192168 ),
193169 'WHERE ' => "pb.snippet_author = u.user_id AND pb.snippet_id = $ snippet_id " ,
@@ -198,9 +174,9 @@ private function display_pb()
198174
199175 if (!$ data )
200176 {
201- $ message = $ this ->language ->lang ('NO_VALID_SNIPPET ' );
177+ $ message = $ this ->language ->lang ('PASTEBIN_NO_VALID_SNIPPET ' );
202178 $ message .= '<br /><br /> ' ;
203- $ message .= sprintf ( $ this ->language ->lang ('RETURN_PASTEBIN ' ) , '<a href=" ' . $ this ->helper ->route ('phpbbde_pastebin_main_controller ' ) . '"> ' , '</a> ' );
179+ $ message .= $ this ->language ->lang ('PASTEBIN_RETURN_PASTEBIN ' , '<a href=" ' . $ this ->helper ->route ('phpbbde_pastebin_main_controller ' ) . '"> ' , '</a> ' );
204180
205181 trigger_error ($ message );
206182 }
@@ -221,7 +197,7 @@ private function display_pb()
221197 $ sql = $ this ->db ->sql_build_query ('SELECT ' , array (
222198 'SELECT ' => 'pb.snippet_id, pb.snippet_time, pb.snippet_title, pb.snippet_desc, u.user_id, u.username, u.user_colour ' ,
223199 'FROM ' => array (
224- $ this ->table ( ' pastebin ' ) => 'pb ' ,
200+ $ this ->pastebin_table => 'pb ' ,
225201 USERS_TABLE => 'u ' ,
226202 ),
227203 'WHERE ' => 'pb.snippet_author = u.user_id ' ,
@@ -236,7 +212,7 @@ private function display_pb()
236212 'DESC ' => $ row ['snippet_desc ' ],
237213 'TITLE ' => $ row ['snippet_title ' ],
238214 'SNIPPET_TIME ' => $ this ->user ->format_date ($ row ['snippet_time ' ]),
239- 'TITLE_SHORT ' => (utf8_strlen ($ row ['snippet_title ' ]) > 50 ) ? utf8_substr ($ row ['snippet_title ' ], 0 , 50 ) . ' ... ' : $ row ['snippet_title ' ],
215+ 'TITLE_SHORT ' => (utf8_strlen ($ row ['snippet_title ' ]) > 25 ) ? utf8_substr ($ row ['snippet_title ' ], 0 , 25 ) . $ this -> language -> lang ( ' PASTEBIN_ELLIPSIS ' ) : $ row ['snippet_title ' ],
240216 'AUTHOR_FULL ' => get_username_string ('full ' , $ row ['user_id ' ], $ row ['username ' ], $ row ['user_colour ' ]),
241217 ));
242218 }
@@ -269,9 +245,9 @@ private function display_pb()
269245 }
270246
271247 $ data = array (
272- 'snippet_title ' => utf8_normalize_nfc ( str_replace ("\n" , '' , $ this ->request ->variable ('snippet_title ' , '' , true ) )),
273- 'snippet_desc ' => utf8_normalize_nfc ( str_replace ("\n" , '' , $ this ->request ->variable ('snippet_desc ' , '' , true ) )),
274- 'snippet_text ' => utf8_normalize_nfc ( $ this ->request ->variable ('snippet_text ' , '' , true ) ),
248+ 'snippet_title ' => str_replace ("\n" , '' , $ this ->request ->variable ('snippet_title ' , '' , true )),
249+ 'snippet_desc ' => str_replace ("\n" , '' , $ this ->request ->variable ('snippet_desc ' , '' , true )),
250+ 'snippet_text ' => $ this ->request ->variable ('snippet_text ' , '' , true ),
275251 'snippet_prunable ' => 1 ,
276252 'snippet_highlight ' => $ this ->request ->variable ('snippet_highlight ' , '' ),
277253 'snippet_prune_on ' => max (1 , min (6 , $ this ->request ->variable ('pruning_months ' , 0 ))),
@@ -287,7 +263,7 @@ private function display_pb()
287263
288264 if (empty ($ data ['snippet_title ' ]))
289265 {
290- $ error [] = $ this ->language ->lang ('ERR_NO_TITLE ' );
266+ $ error [] = $ this ->language ->lang ('PASTEBIN_ERR_NO_TITLE ' );
291267 }
292268
293269 if (!$ this ->util ->geshi_check ($ data ['snippet_highlight ' ]))
@@ -332,12 +308,12 @@ private function display_pb()
332308
333309 if (empty ($ snippet_contents ))
334310 {
335- $ error [] = $ this ->language ->lang ('ERR_NO_BODY ' );
311+ $ error [] = $ this ->language ->lang ('PASTEBIN_ERR_NO_BODY ' );
336312 }
337313
338314 if (!check_form_key ('pastebinform ' ))
339315 {
340- $ error [] = $ this ->language ->lang ('FORM_INVALID ' );
316+ $ error [] = $ this ->language ->lang ('PASTEBIN_FORM_INVALID ' );
341317 }
342318
343319 // Visual Confirmation handling (borrowed from includes/ucp/ucp_register.php)
@@ -350,7 +326,7 @@ private function display_pb()
350326
351327 if (!$ captcha ->is_solved ())
352328 {
353- $ error [] = $ this ->language ->lang ('CONFIRM_CODE_WRONG ' );
329+ $ error [] = $ this ->language ->lang ('PASTEBIN_CONFIRM_CODE_WRONG ' );
354330 }
355331 else if (!empty ($ error ))
356332 {
@@ -383,15 +359,15 @@ private function display_pb()
383359 'snippet_prune_on ' => time () + $ this ::SECONDS_MONTH * $ data ['snippet_prune_on ' ],
384360 );
385361
386- $ sql = 'INSERT INTO ' . $ this ->table ( ' pastebin ' ) . ' ' . $ this ->db ->sql_build_array ('INSERT ' , $ sql_ary );
362+ $ sql = 'INSERT INTO ' . $ this ->pastebin_table . ' ' . $ this ->db ->sql_build_array ('INSERT ' , $ sql_ary );
387363 $ this ->db ->sql_query ($ sql );
388364
389365 $ snippet_id = $ this ->db ->sql_nextid ();
390366
391367 $ redirect_url = $ this ->helper ->route ('phpbbde_pastebin_main_controller ' , array ('mode ' => "view " , 's ' => $ snippet_id ));
392368
393369 meta_refresh (3 , $ redirect_url );
394- trigger_error ($ this ->language ->lang ('SNIPPET_SUBMITTED ' ) . '<br /><br /> ' . sprintf ( $ this ->language ->lang ('RETURN_SNIPPET ' ) , '<a href=" ' . $ redirect_url . '"> ' , '</a> ' ));
370+ trigger_error ($ this ->language ->lang ('PASTEBIN_SNIPPET_SUBMITTED ' ) . '<br /><br /> ' . $ this ->language ->lang ('PASTEBIN_RETURN_SNIPPET ' , '<a href=" ' . $ redirect_url . '"> ' , '</a> ' ));
395371 }
396372
397373 break ;
@@ -406,7 +382,7 @@ private function display_pb()
406382 trigger_error ('PASTEBIN_AUTH_NO_VIEW ' );
407383 }
408384
409- page_header (sprintf ( $ this ->language ->lang ('PASTEBIN_VIEW ' ) , $ data ['snippet_title ' ]));
385+ page_header ($ this ->language ->lang ('PASTEBIN_VIEW ' , $ data ['snippet_title ' ]));
410386
411387 $ snippet_text = $ data ['snippet_text ' ];
412388
@@ -417,9 +393,6 @@ private function display_pb()
417393 $ highlight = 'php ' ;
418394 }
419395
420- // highlight using geshi (http://qbnz.com/highlighter/)
421- require ($ this ->geshi_path . 'geshi. ' . $ this ->php_ext );
422-
423396 $ code = htmlspecialchars_decode ($ snippet_text );
424397
425398 $ geshi = new \GeSHi ($ code , $ highlight , $ this ->util ->geshi_dir );
@@ -441,7 +414,7 @@ private function display_pb()
441414 'SNIPPET_TEXT_DISPLAY ' => $ snippet_text_display ,
442415
443416 'SNIPPET_TIME ' => $ this ->user ->format_date ($ data ['snippet_time ' ]),
444- 'SNIPPET_PRUNE_ON ' => $ data ['snippet_prunable ' ] ? $ this ->user ->format_date ($ data ['snippet_prune_on ' ]) : $ this ->language ->lang ('NEVER ' ),
417+ 'SNIPPET_PRUNE_ON ' => $ data ['snippet_prunable ' ] ? $ this ->user ->format_date ($ data ['snippet_prune_on ' ]) : $ this ->language ->lang ('PASTEBIN_NEVER ' ),
445418 'SNIPPET_DESC_V ' => $ data ['snippet_desc ' ],
446419 'SNIPPET_TITLE_V ' => $ data ['snippet_title ' ],
447420 'SNIPPET_AUTHOR ' => $ data ['username ' ],
@@ -451,7 +424,7 @@ private function display_pb()
451424 'SNIPPET_DATE ' => $ this ->user ->format_date ($ data ['snippet_time ' ]),
452425
453426 'HIGHLIGHT_SELECT_MOD ' => $ this ->util ->highlight_select ($ data ['snippet_highlight ' ]),
454- 'DOWNLOAD_SNIPPET_EXPLAIN ' => sprintf ( $ this ->language ->lang ('DOWNLOAD_SNIPPET_EXPLAIN ' ) , '<a href=" ' . $ snippet_download_url . '"> ' , '</a> ' ),
427+ 'DOWNLOAD_SNIPPET_EXPLAIN ' => $ this ->language ->lang ('PASTEBIN_DOWNLOAD_SNIPPET_EXPLAIN ' , '<a href=" ' . $ snippet_download_url . '"> ' , '</a> ' ),
455428
456429 'U_SNIPPET ' => $ this ->helper ->route ('phpbbde_pastebin_main_controller ' , array ("mode " => "view " , "s " => $ data ['snippet_id ' ])),
457430 'U_SNIPPET_DOWNLOAD ' => $ snippet_download_url ,
@@ -518,7 +491,6 @@ private function display_pb()
518491
519492 if ($ this ->request ->is_set_post ('cancel ' ))
520493 {
521- //redirect(append_sid("{$root_path}support/pastebin.$phpEx", "mode=view&s=$snippet_id"));
522494 redirect ($ this ->helper ->route ('phpbbde_pastebin_main_controller ' , array ("mode " =>"view " ,"s " =>$ snippet_id )));
523495 }
524496
@@ -528,7 +500,7 @@ private function display_pb()
528500 if (!confirm_box (true ))
529501 {
530502 $ hidden = build_hidden_fields (array ('mode ' => 'moderate ' , 's ' => $ snippet_id , 'delete_snippet ' => 1 ));
531- confirm_box (false , sprintf ( $ this ->language ->lang ('DELETE_SNIPPET_CONFIRM ' ) , $ data ['snippet_title ' ]), $ hidden );
503+ confirm_box (false , $ this ->language ->lang ('PASTEBIN_DELETE_SNIPPET_CONFIRM ' , $ data ['snippet_title ' ]), $ hidden );
532504 }
533505 else
534506 {
@@ -554,9 +526,9 @@ private function display_pb()
554526
555527 $ redirect_url = $ this ->helper ->route ('phpbbde_pastebin_main_controller ' , $ redirect_append );
556528
557- $ message = $ this ->language ->lang ('SNIPPET_MODERATED ' );
529+ $ message = $ this ->language ->lang ('PASTEBIN_SNIPPET_MODERATED ' );
558530 $ message .= '<br /><br /> ' ;
559- $ message .= sprintf ( $ this ->language ->lang ('RETURN_ ' . ((!$ delete ) ? 'SNIPPET ' : 'PASTEBIN ' ) ), '<a href=" ' . $ redirect_url . '"> ' , '</a> ' );
531+ $ message .= $ this ->language ->lang ('PASTEBIN_RETURN_ ' . ((!$ delete ) ? 'SNIPPET ' : 'PASTEBIN ' ), '<a href=" ' . $ redirect_url . '"> ' , '</a> ' );
560532
561533 meta_refresh (3 , $ redirect_url );
562534 trigger_error ($ message );
@@ -614,7 +586,7 @@ private function display_pb()
614586 {
615587 $ selected = '' ;
616588 }
617- $ pruning_months_select .= '<option ' . $ selected . ' value="-1"> ' . $ this ->language ->lang ('INFINITE ' ) . '</option> ' ;
589+ $ pruning_months_select .= '<option ' . $ selected . ' value="-1"> ' . $ this ->language ->lang ('PASTEBIN_INFINITE ' ) . '</option> ' ;
618590 }
619591
620592 if (!isset ($ highlight ))
0 commit comments