automatically trim() all parameters given

Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann (d00p)
2018-02-26 08:21:56 +01:00
parent 4a1decf359
commit 592c9ed0b9
6 changed files with 35 additions and 31 deletions

View File

@@ -63,7 +63,7 @@ class Admins extends ApiCommand implements ResourceEntity
{
$id = $this->getParam('id', true, 0);
$ln_optional = ($id <= 0 ? false : true);
$loginname = trim($this->getParam('loginname', $ln_optional, ''));
$loginname = $this->getParam('loginname', $ln_optional, '');
if ($this->isAdmin() && ($this->getUserDetail('change_serversettings') == 1 || ($this->getUserDetail('adminid') == $id || $this->getUserDetail('loginname') == $loginname))) {
$result_stmt = Database::prepare("
@@ -314,7 +314,7 @@ class Admins extends ApiCommand implements ResourceEntity
$id = $this->getParam('id', true, 0);
$ln_optional = ($id <= 0 ? false : true);
$loginname = trim($this->getParam('loginname', $ln_optional, ''));
$loginname = $this->getParam('loginname', $ln_optional, '');
$json_result = Admins::getLocal($this->getUserData(), array(
'id' => $id,
@@ -582,7 +582,7 @@ class Admins extends ApiCommand implements ResourceEntity
if ($this->isAdmin() && $this->getUserDetail('change_serversettings') == 1) {
$id = $this->getParam('id', true, 0);
$ln_optional = ($id <= 0 ? false : true);
$loginname = trim($this->getParam('loginname', $ln_optional, ''));
$loginname = $this->getParam('loginname', $ln_optional, '');
$json_result = Admins::getLocal($this->getUserData(), array(
'id' => $id,
@@ -659,7 +659,7 @@ class Admins extends ApiCommand implements ResourceEntity
if ($this->isAdmin() && $this->getUserDetail('change_serversettings') == 1) {
$id = $this->getParam('id', true, 0);
$ln_optional = ($id <= 0 ? false : true);
$loginname = trim($this->getParam('loginname', $ln_optional, ''));
$loginname = $this->getParam('loginname', $ln_optional, '');
$json_result = Admins::getLocal($this->getUserData(), array(
'id' => $id,

View File

@@ -70,7 +70,7 @@ class Customers extends ApiCommand implements ResourceEntity
{
$id = $this->getParam('id', true, 0);
$ln_optional = ($id <= 0 ? false : true);
$loginname = trim($this->getParam('loginname', $ln_optional, ''));
$loginname = $this->getParam('loginname', $ln_optional, '');
if ($this->isAdmin()) {
$result_stmt = Database::prepare("
@@ -208,18 +208,7 @@ class Customers extends ApiCommand implements ResourceEntity
standard_error('youcantallocatemorethanyouhave', '', true);
}
// Either $name and $firstname or the $company must be inserted
if ($name == '' && $company == '') {
standard_error(array(
'stringisempty',
'myname'
), '', true);
} elseif ($firstname == '' && $company == '') {
standard_error(array(
'stringisempty',
'myfirstname'
), '', true);
} elseif ($email == '') {
if ($email == '') {
standard_error(array(
'stringisempty',
'emailadd'
@@ -680,7 +669,7 @@ class Customers extends ApiCommand implements ResourceEntity
{
$id = $this->getParam('id', true, 0);
$ln_optional = ($id <= 0 ? false : true);
$loginname = trim($this->getParam('loginname', $ln_optional, ''));
$loginname = $this->getParam('loginname', $ln_optional, '');
$json_result = Customers::getLocal($this->getUserData(), array(
'id' => $id,
@@ -1212,7 +1201,7 @@ class Customers extends ApiCommand implements ResourceEntity
if ($this->isAdmin()) {
$id = $this->getParam('id', true, 0);
$ln_optional = ($id <= 0 ? false : true);
$loginname = trim($this->getParam('loginname', $ln_optional, ''));
$loginname = $this->getParam('loginname', $ln_optional, '');
$delete_userfiles = $this->getParam('delete_userfiles', true, 0);
$json_result = Customers::getLocal($this->getUserData(), array(
@@ -1454,7 +1443,7 @@ class Customers extends ApiCommand implements ResourceEntity
if ($this->isAdmin()) {
$id = $this->getParam('id', true, 0);
$ln_optional = ($id <= 0 ? false : true);
$loginname = trim($this->getParam('loginname', $ln_optional, ''));
$loginname = $this->getParam('loginname', $ln_optional, '');
$json_result = Customers::getLocal($this->getUserData(), array(
'id' => $id,

View File

@@ -73,7 +73,7 @@ class Domains extends ApiCommand implements ResourceEntity
if ($this->isAdmin()) {
$id = $this->getParam('id', true, 0);
$dn_optional = ($id <= 0 ? false : true);
$domainname = trim($this->getParam('domainname', $dn_optional, ''));
$domainname = $this->getParam('domainname', $dn_optional, '');
$no_std_subdomain = $this->getParam('no_std_subdomain', true, false);
// convert possible idn domain to punycode
@@ -131,8 +131,8 @@ class Domains extends ApiCommand implements ResourceEntity
$speciallogfile = $this->getParam('speciallogfile', true, 0);
$aliasdomain = intval($this->getParam('alias', true, 0));
$issubof = intval($this->getParam('issubof', true, 0));
$registration_date = trim($this->getParam('registration_date', true, ''));
$termination_date = trim($this->getParam('termination_date', true, ''));
$registration_date = $this->getParam('registration_date', true, '');
$termination_date = $this->getParam('termination_date', true, '');
$caneditdomain = $this->getParam('caneditdomain', true, 0);
$isbinddomain = $this->getParam('isbinddomain', true, 0);
$zonefile = $this->getParam('zonefile', true, '');
@@ -774,7 +774,7 @@ class Domains extends ApiCommand implements ResourceEntity
// parameters
$id = $this->getParam('id', true, 0);
$dn_optional = ($id <= 0 ? false : true);
$domainname = trim($this->getParam('domainname', $dn_optional, ''));
$domainname = $this->getParam('domainname', $dn_optional, '');
// get requested domain
$json_result = Domains::getLocal($this->getUserData(), array(
@@ -799,8 +799,8 @@ class Domains extends ApiCommand implements ResourceEntity
$speciallogverified = $this->getParam('speciallogverified', true, 0);
$aliasdomain = intval($this->getParam('alias', true, $result['aliasdomain']));
$issubof = intval($this->getParam('issubof', true, $result['ismainbutsubto']));
$registration_date = trim($this->getParam('registration_date', true, $result['registration_date']));
$termination_date = trim($this->getParam('termination_date', true, $result['termination_date']));
$registration_date = $this->getParam('registration_date', true, $result['registration_date']);
$termination_date = $this->getParam('termination_date', true, $result['termination_date']);
$caneditdomain = $this->getParam('caneditdomain', true, $result['caneditdomain']);
$isbinddomain = $this->getParam('isbinddomain', true, $result['isbinddomain']);
$zonefile = $this->getParam('zonefile', true, $result['zonefile']);
@@ -1587,7 +1587,7 @@ class Domains extends ApiCommand implements ResourceEntity
if ($this->isAdmin()) {
$id = $this->getParam('id', true, 0);
$dn_optional = ($id <= 0 ? false : true);
$domainname = trim($this->getParam('domainname', $dn_optional, ''));
$domainname = $this->getParam('domainname', $dn_optional, '');
$is_stdsubdomain = $this->getParam('is_stdsubdomain', true, 0);
$remove_subbutmain_domains = $this->getParam('delete_mainsubdomains', true, 0);

View File

@@ -37,7 +37,7 @@ class Ftps extends ApiCommand implements ResourceEntity
{
$id = $this->getParam('id', true, 0);
$un_optional = ($id <= 0 ? false : true);
$username = trim($this->getParam('username', $un_optional, ''));
$username = $this->getParam('username', $un_optional, '');
$params = array();
if ($this->isAdmin()) {

View File

@@ -238,7 +238,7 @@ class Mysqls extends ApiCommand implements ResourceEntity
{
$id = $this->getParam('id', true, 0);
$dn_optional = ($id <= 0 ? false : true);
$dbname = trim($this->getParam('dbname', $dn_optional, ''));
$dbname = $this->getParam('dbname', $dn_optional, '');
$dbserver = $this->getParam('mysql_server', true, - 1);
if ($this->isAdmin()) {
@@ -337,7 +337,7 @@ class Mysqls extends ApiCommand implements ResourceEntity
{
$id = $this->getParam('id', true, 0);
$dn_optional = ($id <= 0 ? false : true);
$dbname = trim($this->getParam('dbname', $dn_optional, ''));
$dbname = $this->getParam('dbname', $dn_optional, '');
$dbserver = $this->getParam('mysql_server', true, - 1);
if ($this->isAdmin() == false && Settings::IsInList('panel.customer_hide_options', 'mysql')) {
@@ -541,7 +541,7 @@ class Mysqls extends ApiCommand implements ResourceEntity
{
$id = $this->getParam('id', true, 0);
$dn_optional = ($id <= 0 ? false : true);
$dbname = trim($this->getParam('dbname', $dn_optional, ''));
$dbname = $this->getParam('dbname', $dn_optional, '');
$dbserver = $this->getParam('mysql_server', true, - 1);
if ($this->isAdmin() == false && Settings::IsInList('panel.customer_hide_options', 'mysql')) {