Fix remaining missing $INPUT uses FS#2577

This adds $INPUT in all places where it was still missing and available.
$INPUT is now also used in places where using $_REQUEST/... was okay in
order to make the code consistent.
This commit is contained in:
Michael Hamann 2013-02-20 20:26:05 +01:00
parent 5737a81e37
commit 00d5892726
6 changed files with 27 additions and 23 deletions

View File

@ -29,7 +29,7 @@ if(isset($_SERVER['HTTP_X_DOKUWIKI_DO'])) {
require_once(DOKU_INC.'inc/init.php');
//import variables
$_REQUEST['id'] = str_replace("\xC2\xAD", '', $INPUT->str('id')); //soft-hyphen
$INPUT->set('id', str_replace("\xC2\xAD", '', $INPUT->str('id'))); //soft-hyphen
$QUERY = trim($INPUT->str('id'));
$ID = getID();

View File

@ -92,7 +92,7 @@ function auth_setup() {
// apply cleaning
if (true === $auth->success) {
$_REQUEST['u'] = $auth->cleanUser($_REQUEST['u']);
$INPUT->set('u', $auth->cleanUser($INPUT->str('u')));
}
if($INPUT->str('authtok')) {

View File

@ -71,6 +71,7 @@ class auth_plugin_authad extends DokuWiki_Auth_Plugin {
* Constructor
*/
public function __construct() {
global $INPUT;
parent::__construct();
// we load the config early to modify it a bit here
@ -99,8 +100,8 @@ class auth_plugin_authad extends DokuWiki_Auth_Plugin {
// we need to simulate a login
if(empty($_COOKIE[DOKU_COOKIE])) {
$_REQUEST['u'] = $_SERVER['REMOTE_USER'];
$_REQUEST['p'] = 'sso_only';
$INPUT->set('u', $_SERVER['REMOTE_USER']);
$INPUT->set('p', 'sso_only');
}
}

View File

@ -61,11 +61,12 @@ class admin_plugin_plugin extends DokuWiki_Admin_Plugin {
* handle user request
*/
function handle() {
global $INPUT;
// enable direct access to language strings
$this->setupLocale();
$fn = $_REQUEST['fn'];
$fn = $INPUT->param('fn');
if (is_array($fn)) {
$this->cmd = key($fn);
$this->plugin = is_array($fn[$this->cmd]) ? key($fn[$this->cmd]) : null;

View File

@ -44,15 +44,16 @@ class admin_plugin_revert extends DokuWiki_Admin_Plugin {
* output appropriate html
*/
function html() {
global $INPUT;
echo $this->plugin_locale_xhtml('intro');
$this->_searchform();
if(is_array($_REQUEST['revert']) && checkSecurityToken()){
$this->_revert($_REQUEST['revert'],$_REQUEST['filter']);
}elseif(isset($_REQUEST['filter'])){
$this->_list($_REQUEST['filter']);
if(is_array($INPUT->param('revert')) && checkSecurityToken()){
$this->_revert($INPUT->arr('revert'),$INPUT->str('filter'));
}elseif($INPUT->has('filter')){
$this->_list($INPUT->str('filter'));
}
}
@ -60,10 +61,10 @@ class admin_plugin_revert extends DokuWiki_Admin_Plugin {
* Display the form for searching spam pages
*/
function _searchform(){
global $lang;
global $lang, $INPUT;
echo '<form action="" method="post"><div class="no">';
echo '<label>'.$this->getLang('filter').': </label>';
echo '<input type="text" name="filter" class="edit" value="'.hsc($_REQUEST['filter']).'" />';
echo '<input type="text" name="filter" class="edit" value="'.hsc($INPUT->str('filter')).'" />';
echo ' <input type="submit" class="button" value="'.$lang['btn_search'].'" />';
echo ' <span>'.$this->getLang('note1').'</span>';
echo '</div></form><br /><br />';

View File

@ -73,11 +73,12 @@ class admin_plugin_usermanager extends DokuWiki_Admin_Plugin {
* handle user request
*/
function handle() {
global $INPUT;
if (is_null($this->_auth)) return false;
// extract the command and any specific parameters
// submit button name is of the form - fn[cmd][param(s)]
$fn = $_REQUEST['fn'];
$fn = $INPUT->param('fn');
if (is_array($fn)) {
$cmd = key($fn);
@ -88,8 +89,7 @@ class admin_plugin_usermanager extends DokuWiki_Admin_Plugin {
}
if ($cmd != "search") {
if (!empty($_REQUEST['start']))
$this->_start = $_REQUEST['start'];
$this->_start = $INPUT->int('start', 0);
$this->_filter = $this->_retrieveFilter();
}
@ -345,6 +345,7 @@ class admin_plugin_usermanager extends DokuWiki_Admin_Plugin {
}
function _addUser(){
global $INPUT;
if (!checkSecurityToken()) return false;
if (!$this->_auth->canDo('addUser')) return false;
@ -353,7 +354,7 @@ class admin_plugin_usermanager extends DokuWiki_Admin_Plugin {
if ($this->_auth->canDo('modPass')){
if (empty($pass)){
if(!empty($_REQUEST['usernotify'])){
if($INPUT->has('usernotify')){
$pass = auth_pwgen();
} else {
msg($this->lang['add_fail'], -1);
@ -393,7 +394,7 @@ class admin_plugin_usermanager extends DokuWiki_Admin_Plugin {
msg($this->lang['add_ok'], 1);
if (!empty($_REQUEST['usernotify']) && $pass) {
if ($INPUT->has('usernotify') && $pass) {
$this->_notifyUser($user,$pass);
}
} else {
@ -407,13 +408,13 @@ class admin_plugin_usermanager extends DokuWiki_Admin_Plugin {
* Delete user
*/
function _deleteUser(){
global $conf;
global $conf, $INPUT;
if (!checkSecurityToken()) return false;
if (!$this->_auth->canDo('delUser')) return false;
$selected = $_REQUEST['delete'];
if (!is_array($selected) || empty($selected)) return false;
$selected = $INPUT->arr('delete');
if (empty($selected)) return false;
$selected = array_keys($selected);
if(in_array($_SERVER['REMOTE_USER'], $selected)) {
@ -463,13 +464,13 @@ class admin_plugin_usermanager extends DokuWiki_Admin_Plugin {
* Modify user (modified user data has been recieved)
*/
function _modifyUser(){
global $conf;
global $conf, $INPUT;
if (!checkSecurityToken()) return false;
if (!$this->_auth->canDo('UserMod')) return false;
// get currently valid user data
$olduser = cleanID(preg_replace('/.*:/','',$_REQUEST['userid_old']));
$olduser = cleanID(preg_replace('/.*:/','',$INPUT->str('userid_old')));
$oldinfo = $this->_auth->getUserData($olduser);
// get new user data subject to change
@ -494,7 +495,7 @@ class admin_plugin_usermanager extends DokuWiki_Admin_Plugin {
}
// generate password if left empty and notification is on
if(!empty($_REQUEST['usernotify']) && empty($newpass)){
if($INPUT->has('usernotify') && empty($newpass)){
$newpass = auth_pwgen();
}
@ -510,7 +511,7 @@ class admin_plugin_usermanager extends DokuWiki_Admin_Plugin {
if ($ok = $this->_auth->triggerUserMod('modify', array($olduser, $changes))) {
msg($this->lang['update_ok'],1);
if (!empty($_REQUEST['usernotify']) && $newpass) {
if ($INPUT->has('usernotify') && $newpass) {
$notify = empty($changes['user']) ? $olduser : $newuser;
$this->_notifyUser($notify,$newpass);
}