From 217c233889feacb13963916f20545fc947d2c64b Mon Sep 17 00:00:00 2001 From: kanoi Date: Sat, 23 Jul 2016 10:15:35 +1000 Subject: [PATCH] php - remove the worker from the api username for people who can't read :) --- pool/base.php | 6 ++++++ pool/page_api.php | 3 +++ 2 files changed, 9 insertions(+) diff --git a/pool/base.php b/pool/base.php index ee07306e..ec419c75 100644 --- a/pool/base.php +++ b/pool/base.php @@ -335,6 +335,12 @@ function loginStr($str) return preg_replace($all, '', $str); } # +function deworker($str) +{ + $work = '/[\._].*$/'; + return preg_replace($work, '', $str); +} +# function trn($str) { $rep = str_replace(array('<', '>'), array('<', '>'), $str); diff --git a/pool/page_api.php b/pool/page_api.php index 7a228201..bd92055b 100644 --- a/pool/page_api.php +++ b/pool/page_api.php @@ -13,6 +13,9 @@ function show_api($info, $page, $menu, $name, $user) { global $fld_sep; $u = getparam('username', true); + if (nutem($u)) + no_api(); + $u = deworker($u); if (nutem($u)) no_api(); $api = getparam('api', true);