@@ -27,7 +27,7 @@ public function ajaxProcessVfTurnOff()
2727 )
2828 ));
2929 }
30- $ content = file_get_contents (_PS_ROOT_DIR_ . '/modules/vuefront/.htaccess.txt ' );
30+ $ content = Tools:: file_get_contents (_PS_ROOT_DIR_ . '/modules/vuefront/.htaccess.txt ' );
3131 file_put_contents (_PS_ROOT_DIR_ . '/.htaccess ' , $ content );
3232 unlink (_PS_ROOT_DIR_ . '/modules/vuefront/.htaccess.txt ' );
3333 }
@@ -46,7 +46,7 @@ public function ajaxProcessVfAppsRemove() {
4646 } catch (Exception $ e ) {
4747
4848 }
49- unset($ setting [$ _POST [ 'key ' ] ]);
49+ unset($ setting [Tools:: getValue ( 'key ' ) ]);
5050 Configuration::updateValue ('vuefront-apps ' , Tools::jsonEncode ($ setting ), null ,0 ,0 );
5151 }
5252
@@ -65,8 +65,8 @@ public function ajaxProcessVfAppsCreate() {
6565 $ d = new DateTime ();
6666
6767 $ setting [] = array (
68- 'codename ' => $ _POST [ 'codename ' ] ,
69- 'jwt ' => $ _POST [ 'jwt ' ] ,
68+ 'codename ' => Tools:: getValue ( 'codename ' ) ,
69+ 'jwt ' => Tools:: getValue ( 'jwt ' ) ,
7070 'dateAdded ' => $ d ->format ('Y-m-d\TH:i:s.u ' )
7171 );
7272
@@ -91,10 +91,10 @@ public function ajaxProcessVfAppsEdit()
9191 } catch (Exception $ e ) {
9292
9393 }
94- $ app = Tools::jsonDecode (html_entity_decode ($ _POST [ 'app ' ] , ENT_QUOTES , 'UTF-8 ' ), true );
94+ $ app = Tools::jsonDecode (html_entity_decode (Tools:: getValue ( 'app ' ) , ENT_QUOTES , 'UTF-8 ' ), true );
9595
9696 foreach ($ app as $ key => $ value ) {
97- $ setting [$ _POST [ 'key ' ] ][$ key ] = $ value ;
97+ $ setting [Tools:: getValue ( 'key ' ) ][$ key ] = $ value ;
9898 }
9999
100100 Configuration::updateValue ('vuefront-apps ' , Tools::jsonEncode ($ setting ), null ,0 ,0 );
@@ -211,7 +211,7 @@ public function ajaxProcessVfTurnOn() {
211211RewriteCond %{DOCUMENT_ROOT} " .$ document_path ."vuefront/$1.html !-f
212212RewriteRule ^([^?]*) vuefront/200.html [L,QSA] " ;
213213
214- $ content = file_get_contents (_PS_ROOT_DIR_ . '/.htaccess ' );
214+ $ content = Tools:: file_get_contents (_PS_ROOT_DIR_ . '/.htaccess ' );
215215
216216 file_put_contents (_PS_ROOT_DIR_ . '/modules/vuefront/.htaccess.txt ' , $ content );
217217
@@ -237,7 +237,7 @@ public function ajaxProcessVfUpdate() {
237237 try {
238238 $ tmpFile = tempnam (sys_get_temp_dir (), 'TMP_ ' );
239239 rename ($ tmpFile , $ tmpFile .= '.tar ' );
240- file_put_contents ($ tmpFile , file_get_contents ($ _POST ['url ' ]));
240+ file_put_contents ($ tmpFile , Tools:: file_get_contents ($ _POST ['url ' ]));
241241 $ this ->removeDir (_PS_ROOT_DIR_ . '/vuefront ' );
242242 $ phar = new PharData ($ tmpFile );
243243 $ phar ->extractTo (_PS_ROOT_DIR_ . '/vuefront ' );
@@ -278,7 +278,7 @@ public function ajaxProcessVfSettings()
278278
279279 public function ajaxProcessVfSettingsEdit ()
280280 {
281- $ vfSetting = Tools::jsonDecode (html_entity_decode ($ _POST [ 'setting ' ] , ENT_QUOTES , 'UTF-8 ' ), true );
281+ $ vfSetting = Tools::jsonDecode (html_entity_decode (Tools:: getValue ( 'setting ' ) , ENT_QUOTES , 'UTF-8 ' ), true );
282282
283283 Configuration::updateValue ('vuefront-settings ' , Tools::jsonEncode ($ vfSetting ), null ,0 ,0 );
284284
@@ -330,22 +330,22 @@ public function ajaxProcessVfInformation() {
330330 );
331331 }
332332
333- public function ajaxProcessProxy ()
334- {
335- $ body = Tools::file_get_contents ('php://input ' );;
336- if (!function_exists ('getallheaders ' )) {
337- function getallheaders ()
333+ public function getallheaders ()
338334 {
339335 $ headers = [];
340336 foreach ($ _SERVER as $ name => $ value ) {
341- if (substr ($ name , 0 , 5 ) == 'HTTP_ ' ) {
342- $ headers [str_replace (' ' , '- ' , ucwords (strtolower (str_replace ('_ ' , ' ' , substr ($ name , 5 )))))] = $ value ;
337+ if (Tools:: substr ($ name , 0 , 5 ) == 'HTTP_ ' ) {
338+ $ headers [str_replace (' ' , '- ' , ucwords (Tools:: strtolower (str_replace ('_ ' , ' ' , substr ($ name , 5 )))))] = $ value ;
343339 }
344340 }
345341 return $ headers ;
346342 }
347- }
348- $ headers = getallheaders ();
343+
344+ public function ajaxProcessProxy ()
345+ {
346+ $ body = Tools::file_get_contents ('php://input ' );;
347+
348+ $ headers = $ this ->getallheaders ();
349349
350350 $ cHeaders = array ('Content-Type: application/json ' );
351351
0 commit comments