2022-03-08 15:55:41 +01:00
|
|
|
<?php namespace ProcessWire;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ProcessWire Home Process
|
|
|
|
*
|
|
|
|
* Placeholder Process for the admin root. May add version and update checks to this in the future,
|
|
|
|
* or dashboard type functionality for those that want it.
|
|
|
|
*
|
|
|
|
* For more details about how Process modules work, please see:
|
|
|
|
* /wire/core/Process.php
|
|
|
|
*
|
2023-03-10 19:41:40 +01:00
|
|
|
* ProcessWire 3.x, Copyright 2022 by Ryan Cramer
|
2022-03-08 15:55:41 +01:00
|
|
|
* https://processwire.com
|
2023-03-10 19:41:40 +01:00
|
|
|
*
|
|
|
|
* @method string execute()
|
|
|
|
* @method string ajax()
|
2022-03-08 15:55:41 +01:00
|
|
|
*
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
class ProcessHome extends Process {
|
|
|
|
|
|
|
|
static public function getModuleInfo() {
|
|
|
|
return array(
|
|
|
|
'title' => __('Admin Home', __FILE__), // getModuleInfo title
|
|
|
|
'summary' => __('Acts as a placeholder Process for the admin root. Ensures proper flow control after login.', __FILE__), // getModuleInfo summary
|
|
|
|
'version' => 101,
|
|
|
|
'permission' => 'page-view',
|
|
|
|
'permanent' => true,
|
2023-03-10 19:41:40 +01:00
|
|
|
);
|
2022-03-08 15:55:41 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public function ___execute() {
|
2023-03-10 19:41:40 +01:00
|
|
|
|
|
|
|
if($this->wire()->config->ajax) return '';
|
|
|
|
|
|
|
|
$input = $this->wire()->input;
|
|
|
|
$sanitizer = $this->wire()->sanitizer;
|
2022-03-08 15:55:41 +01:00
|
|
|
$vars = array();
|
2023-03-10 19:41:40 +01:00
|
|
|
|
|
|
|
$login = $input->get('login');
|
|
|
|
$layout = $input->get('layout');
|
|
|
|
if($login) $vars['login'] = (int) $login;
|
|
|
|
if($layout) $vars['layout'] = $sanitizer->name($layout);
|
|
|
|
unset($login, $layout);
|
|
|
|
|
|
|
|
$url = 'page/';
|
|
|
|
if(count($vars)) $url .= '?' . http_build_query($vars);
|
|
|
|
|
|
|
|
$this->wire()->session->location($url);
|
|
|
|
}
|
2022-03-08 15:55:41 +01:00
|
|
|
|
|
|
|
}
|
|
|
|
|