Subversion Repositories web.creative

Rev

Blame | Last modification | View Log | Download

<?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 2016 by Ryan Cramer
 * https://processwire.com
 *
 *
 */

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() {
    $input = $this->wire('input');
    $vars = array();
    if($input->get('login')) $vars['login'] = (int) $input->get('login');
    if($input->get('layout')) $vars['layout'] = $this->wire('sanitizer')->name($input->get('layout'));
    $url = "page/"; 
    if(count($vars)) {
      $url .= '?';
      foreach($vars as $key => $value) {
        $url .= "$key=" . $this->wire('sanitizer')->entities($value) . "&";
      }
      $url = rtrim($url, '&');
    }
    $this->session->redirect($url); 
  } 

}