Browse Source

php - remove the worker from the api username for people who can't read :)

master
kanoi 8 years ago
parent
commit
217c233889
  1. 6
      pool/base.php
  2. 3
      pool/page_api.php

6
pool/base.php

@ -335,6 +335,12 @@ function loginStr($str)
return preg_replace($all, '', $str); return preg_replace($all, '', $str);
} }
# #
function deworker($str)
{
$work = '/[\._].*$/';
return preg_replace($work, '', $str);
}
#
function trn($str) function trn($str)
{ {
$rep = str_replace(array('<', '>'), array('&lt;', '&gt;'), $str); $rep = str_replace(array('<', '>'), array('&lt;', '&gt;'), $str);

3
pool/page_api.php

@ -13,6 +13,9 @@ function show_api($info, $page, $menu, $name, $user)
{ {
global $fld_sep; global $fld_sep;
$u = getparam('username', true); $u = getparam('username', true);
if (nutem($u))
no_api();
$u = deworker($u);
if (nutem($u)) if (nutem($u))
no_api(); no_api();
$api = getparam('api', true); $api = getparam('api', true);

Loading…
Cancel
Save