Skip to content

Panel APIs

Terry L edited this page Aug 24, 2020 · 1 revision
  • entry
  • ::getRoutes
  • demo
  • csrf

entry()

  • return void

The entry point of the control panel.

Example:

$panel->entry();

csrf(...$csrfparams)

  • param array $csrfparams - The CSRF field data.
  • return void

Create the CSRF form data for control panel. This is required for submitting data if the framework you're using has the CSRF protection.

Example:

In Laravel 6 -

Route::any('/firewall/panel/{path?}', function() {

    $panel = new \Shieldon\Firewall\Panel();
    $panel->csrf(['_token' => csrf_token()]);
    $panel->entry();

})->where('path', '(.*)');

::getRoutes()

  • return array

Get the list of all routes of the control panel pages.

Example:

$list = $panel::getRoutes();

var_dump($list);

/*
array(27) {
  [0]=>
  string(17) "ajax/changeLocale"
  [1]=>
  string(17) "ajax/tryMessenger"
  [2]=>
  string(13) "circle/filter"
  [3]=>
  string(11) "circle/rule"
  [4]=>
  string(14) "circle/session"
  [5]=>
  string(10) "home/index"
  [6]=>
  string(13) "home/overview"
  [7]=>
  string(12) "iptables/ip4"
  [8]=>
  string(18) "iptables/ip4status"
  [9]=>
  string(12) "iptables/ip6"
  [10]=>
  string(18) "iptables/ip6status"
  [11]=>
  string(16) "report/actionLog"
  [12]=>
  string(16) "report/operation"
  [13]=>
  string(23) "security/authentication"
  [14]=>
  string(22) "security/xssProtection"
  [15]=>
  string(13) "setting/basic"
  [16]=>
  string(17) "setting/exclusion"
  [17]=>
  string(14) "setting/export"
  [18]=>
  string(14) "setting/import"
  [19]=>
  string(17) "setting/ipManager"
  [20]=>
  string(17) "setting/messenger"
  [21]=>
  string(10) "user/login"
  [22]=>
  string(11) "user/logout"
  [23]=>
  string(9) "asset/css"
  [24]=>
  string(8) "asset/js"
  [25]=>
  string(13) "asset/favicon"
  [26]=>
  string(10) "asset/logo"
}
*/

demo()

  • param string $user - The user name.
  • param string $pass - The user password.
  • return string

In demo mode, user's submit will not take effect.

Example:

echo $panel->demo();
Clone this wiki locally