@@ -181,30 +181,29 @@ function handlePluginUpload()
181181 'required '
182182 );
183183 $ form ->addButtonUpload (get_lang ('Upload ' ), 'plugin_upload ' );
184+ $ form ->protect ();
184185
185186 // Plugin upload.
186- if (isset ($ _POST ['plugin_upload ' ])) {
187- if ($ form ->validate ()) {
188- $ fileElement = $ form ->getElement ('new_plugin ' );
189- $ file = $ fileElement ->getValue ();
190- $ result = uploadPlugin ($ file );
187+ if ($ form ->validate ()) {
188+ $ fileElement = $ form ->getElement ('new_plugin ' );
189+ $ file = $ fileElement ->getValue ();
190+ $ result = uploadPlugin ($ file );
191191
192- // Add event to the system log.
193- $ user_id = api_get_user_id ();
194- $ category = $ _GET ['category ' ];
195- Event::addEvent (
196- LOG_PLUGIN_CHANGE ,
197- LOG_PLUGIN_UPLOAD ,
198- $ file ['name ' ],
199- api_get_utc_datetime (),
200- $ user_id
201- );
192+ // Add event to the system log.
193+ $ user_id = api_get_user_id ();
194+ $ category = $ _GET ['category ' ];
195+ Event::addEvent (
196+ LOG_PLUGIN_CHANGE ,
197+ LOG_PLUGIN_UPLOAD ,
198+ $ file ['name ' ],
199+ api_get_utc_datetime (),
200+ $ user_id
201+ );
202202
203- if ($ result ) {
204- Display::addFlash (Display::return_message (get_lang ('PluginUploaded ' ), 'success ' , false ));
205- header ('Location: ?category=Plugins# ' );
206- exit ;
207- }
203+ if ($ result ) {
204+ Display::addFlash (Display::return_message (get_lang ('PluginUploaded ' ), 'success ' , false ));
205+ header ('Location: ?category=Plugins# ' );
206+ exit ;
208207 }
209208 }
210209 echo $ form ->returnForm ();
0 commit comments