1<?php 2/** 3 * Created by IntelliJ IDEA. 4 * User: andi 5 * Date: 2/10/17 6 * Time: 12:08 PM 7 */ 8 9namespace dokuwiki\Action; 10 11use dokuwiki\Action\Exception\ActionException; 12use dokuwiki\Action\Exception\ActionUserRequiredException; 13 14class Logout extends AbstractAclAction { 15 16 /** @inheritdoc */ 17 function minimumPermission() { 18 return AUTH_NONE; 19 } 20 21 /** @inheritdoc */ 22 public function checkPermissions() { 23 global $INPUT; 24 parent::checkPermissions(); 25 if(!$INPUT->server->has('REMOTE_USER')) { 26 throw new ActionUserRequiredException('login'); 27 } 28 } 29 30 /** @inheritdoc */ 31 public function preProcess() { 32 global $ID; 33 global $INPUT; 34 35 // when logging out during an edit session, unlock the page 36 $lockedby = checklock($ID); 37 if($lockedby == $INPUT->server->str('REMOTE_USER')) { 38 unlock($ID); 39 } 40 41 // do the logout stuff and redirect to login 42 auth_logoff(); 43 send_redirect(wl($ID, array('do' => 'login'))); 44 45 // should never be reached 46 throw new ActionException('login'); 47 } 48 49} 50