@@ -15,7 +15,8 @@ public static function get_request()
1515 $ request = !empty ($ _POST ) ? $ _POST : array ();
1616 $ request = empty ($ _POST ) && !empty ($ _GET ) ? $ _GET : $ request ;
1717
18- return isset ($ _SERVER ['CONTENT_TYPE ' ]) && $ _SERVER ['CONTENT_TYPE ' ] == 'application/json '
18+ return isset ($ _SERVER ['CONTENT_TYPE ' ])
19+ && $ _SERVER ['CONTENT_TYPE ' ] == 'application/json '
1920 ? json_decode (file_get_contents ('php://input ' ), true )
2021 : $ request ;
2122 }
@@ -31,7 +32,8 @@ public static function send_json($payload, $status_code = 200)
3132
3233 public static function send_template ($ template , $ data = array ())
3334 {
34- $ filename = strpos ($ template , '.php ' ) == false ? $ template . '.php ' : $ template ;
35+ $ filename = strpos ($ template , '.php ' ) == false ? $ template . '.php '
36+ : $ template ;
3537 extract ($ data );
3638
3739 include (__DIR__ . '/../templates/ ' . $ filename );
@@ -63,9 +65,11 @@ public static function set_csrf()
6365 {
6466 session_start ();
6567
66- if (!isset ($ _SESSION ["csrf " ])) $ _SESSION ["csrf " ] = bin2hex (random_bytes (50 ));
68+ if (!isset ($ _SESSION ["csrf " ]))
69+ $ _SESSION ["csrf " ] = bin2hex (random_bytes (50 ));
6770
68- return '<input type="hidden" name="csrf" value=" ' . $ _SESSION ["csrf " ].'"> ' ;
71+ return '<input type="hidden" name="csrf" value=" '
72+ . $ _SESSION ["csrf " ] . '"> ' ;
6973 }
7074
7175 public static function is_csrf_valid ()
0 commit comments