54 lines
1.3 KiB
Text
54 lines
1.3 KiB
Text
<?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
|
|
*
|
|
* ProcessWire 3.x, Copyright 2022 by Ryan Cramer
|
|
* https://processwire.com
|
|
*
|
|
* @method string execute()
|
|
* @method string ajax()
|
|
*
|
|
*
|
|
*/
|
|
|
|
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,
|
|
);
|
|
}
|
|
|
|
public function ___execute() {
|
|
|
|
if($this->wire()->config->ajax) return '';
|
|
|
|
$input = $this->wire()->input;
|
|
$sanitizer = $this->wire()->sanitizer;
|
|
$vars = array();
|
|
|
|
$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);
|
|
}
|
|
|
|
}
|
|
|