@@ -156,7 +156,7 @@ private function display_pb()
156156 $ snippet_id = $ this ->request ->variable ('s ' , 0 );
157157 $ submit = $ this ->request ->is_set_post ('submit ' );
158158
159- if (in_array ($ mode , array ('view ' , 'download ' , 'moderate ' )))
159+ if (in_array ($ mode , array ('view ' , 'download ' , 'moderate ' , ' edit_snippet ' )))
160160 {
161161 // for all of these we have to check if the entry exists
162162
@@ -232,6 +232,34 @@ private function display_pb()
232232 // Now let's decide what to do
233233 switch ($ mode )
234234 {
235+ case 'edit_snippet ' :
236+ if (!check_form_key ('pastebinform ' ))
237+ {
238+ trigger_error ('PASTEBIN_FORM_INVALID ' );
239+ }
240+ else
241+ {
242+ $ data = [
243+ 'snippet_id ' => $ snippet_id ,
244+ 'snippet_text ' => $ this ->request ->raw_variable ('edit_snippet ' , '' ),
245+ ];
246+
247+ $ snippet ->load_from_array ($ data );
248+ $ snippet ->submit ();
249+
250+ $ redirect_append = array ("mode " =>"view " ,"s " =>$ snippet_id );
251+ $ redirect_url = $ this ->helper ->route ('phpbbde_pastebin_main_controller ' , $ redirect_append );
252+
253+ $ message = $ this ->language ->lang ('PASTEBIN_SNIPPET_MODERATED ' );
254+ $ message .= '<br /><br /> ' ;
255+ $ message .= $ this ->language ->lang ('PASTEBIN_RETURN_SNIPPET ' , '<a href=" ' . $ redirect_url . '"> ' , '</a> ' );
256+
257+ meta_refresh (3 , $ redirect_url );
258+ trigger_error ($ message );
259+ }
260+
261+ break ;
262+
235263 case 'post ' :
236264 // process submitted data from the posting form
237265 if (!$ this ->auth ->acl_get ('u_pastebin_post ' ))
@@ -247,7 +275,7 @@ private function display_pb()
247275 $ data = array (
248276 'snippet_title ' => str_replace ("\n" , '' , $ this ->request ->variable ('snippet_title ' , '' , true )),
249277 'snippet_desc ' => str_replace ("\n" , '' , $ this ->request ->variable ('snippet_desc ' , '' , true )),
250- 'snippet_text ' => $ this ->request ->variable ('snippet_text ' , '' , true ),
278+ 'snippet_text ' => $ this ->request ->raw_variable ('snippet_text ' , '' ),
251279 'snippet_prunable ' => 1 ,
252280 'snippet_highlight ' => $ this ->request ->variable ('snippet_highlight ' , '' ),
253281 'snippet_prune_on ' => max (1 , min (6 , $ this ->request ->variable ('pruning_months ' , 0 ))),
@@ -392,7 +420,7 @@ private function display_pb()
392420 $ highlight = 'php ' ;
393421 }
394422
395- $ code = htmlspecialchars_decode ( $ snippet_text) ;
423+ $ code = $ snippet_text ;
396424
397425 $ geshi = new \GeSHi ($ code , $ highlight , $ this ->util ->geshi_dir );
398426 $ geshi ->set_header_type (GESHI_HEADER_NONE );
@@ -442,9 +470,9 @@ private function display_pb()
442470 }
443471
444472 // Thanks download.php
445- $ snippet_text = htmlspecialchars_decode ( utf8_decode ( $ data ['snippet_text ' ])) ;
473+ $ snippet_text = $ data ['snippet_text ' ];
446474
447- $ filename = htmlspecialchars_decode ( $ data ['snippet_title ' ]) . '. ' . $ this ->pastebin ->file_ext ();
475+ $ filename = $ data ['snippet_title ' ] . '. ' . $ this ->pastebin ->file_ext ();
448476
449477 $ user_agent = $ this ->request ->server ('HTTP_USER_AGENT ' , '' );
450478 if (strpos ($ user_agent , 'MSIE ' ) !== false || strpos ($ user_agent , 'Safari ' ) !== false || strpos ($ user_agent , 'Konqueror ' ) !== false )
0 commit comments