method __call documentation in bbn\Api\Cloudmin
function($name, $arguments)
{
if ($this->checked) {
$cmdName = str_replace('_', '-', $name);
if (\is_array($this->commands) && isset($this->commands[$cmdName])) {
//Setting the last action performed
$this->lastAction = $cmdName;
//Defining the $url_part and the command to be executed
$url_part = $cmdName;
$cmd = $this->commands[$cmdName];
if (!empty($arguments[0])) {
//Prepping, processing and validating the create user parameters
$args = $this->processParameters($arguments[0]);
if (!empty($cmd['args'])) {
foreach ($cmd['args'] as $k => $v) {
// We can't use this system to check the mandatory properties:
// Virtualmin also marks properties that are actually a choice between
// several "mandatory" properties as "mandatory"
/*
if (!empty($v['mandatory']) && !isset($args[$k])) {
if (
(strpos($k, 'pass') === false)
&& (!isset($args['pass']) && !isset($args['encpass'])
&& !isset($args['passfile']))
) {
var_dump("Parameter $k mandatory for $name!");
return false;
}
}
*/
if (isset($args[$k])) {
if ($v['binary'] && ($args[$k] || $v['mandatory'])) {
$url_part .= "&$k=";
}
elseif (\is_array($v) && $v['multiple'] && \is_array($args[$k])) {
foreach ($args[$k] as $w) {
$url_part .= "&$k=$w";
}
}
else {
$url_part .= "&$k=" . $args[$k];
}
}
}
}
}
//Concatenating the header url and $url_part to create the full url to be executed
$url_part = $this->getHeaderUrl() . $url_part . "'";
//Calling shell_exec and returning the result array
return $this->callShellExec($url_part);
}
// We force even if we don't have the command in the list
else {
if (!empty($arguments)) {
$args = $this->processParameters($arguments[0]);
}
$url_part = $cmdName;
if (!empty($args)) {
foreach ($args as $k => $v) {
if (\is_array($v)) {
foreach ($v as $w) {
$url_part .= "&$k=$w";
}
}
elseif ($v == 1) {
$url_part .= "&$k=";
}
else {
$url_part .= "&$k=$v";
}
}
}
//Concatenating the header url and $url_part to create the full url to be executed
$url_part = $this->getHeaderUrl() . $url_part . "'";
//Calling shell_exec and returning the result array
return $this->callShellExec($url_part);
}
}
return false;
}
BBN is a suite of PHP and JS libraries and VueJS components - all open-source! bbn.io, build applications, the quick way
This website uses cookies to ensure you get the best experience on our website.
© 2011-2023
BBN Solutions