mirror of
https://github.com/myvesta/vesta
synced 2025-08-21 05:44:08 -07:00
php api update set
This commit is contained in:
parent
7aa157db2b
commit
994b0cfa14
5 changed files with 41 additions and 6 deletions
|
@ -366,4 +366,12 @@ class DNS extends AjaxHandler
|
||||||
|
|
||||||
return $this->reply($this->status, '');
|
return $this->reply($this->status, '');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getTemplateInfoExecute($request)
|
||||||
|
{
|
||||||
|
$spell = $request->getParameter('spell');
|
||||||
|
$result = Vesta::execute('v_list_sys_user_packages', null, self::TEXT);
|
||||||
|
return $this->reply(true, $result['data']);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -152,6 +152,10 @@ class MAIN extends AjaxHandler
|
||||||
$ips[$sys_ip] = $sys_ip;
|
$ips[$sys_ip] = $sys_ip;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (empty($ips)) {
|
||||||
|
$ips['No available IP'] = 'No available IP';
|
||||||
|
}
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
'TPL' => array('default' => 'default'),
|
'TPL' => array('default' => 'default'),
|
||||||
'ALIAS' => array(),
|
'ALIAS' => array(),
|
||||||
|
@ -260,10 +264,16 @@ class MAIN extends AjaxHandler
|
||||||
*/
|
*/
|
||||||
public function getUsersParams($data = array())
|
public function getUsersParams($data = array())
|
||||||
{
|
{
|
||||||
|
$pckg = array();
|
||||||
|
// json
|
||||||
|
$result = Vesta::execute('v_list_sys_user_packages', null, self::JSON);
|
||||||
|
foreach ($result['data'] as $pckg_name => $pckg_data) {
|
||||||
|
$pckg[$pckg_name] = $pckg_name;
|
||||||
|
}
|
||||||
return array(
|
return array(
|
||||||
'ROLE' => array('user' => 'user'),
|
'ROLE' => array('user' => 'user'),
|
||||||
'OWNER' => $data['user_names'],
|
'OWNER' => $data['user_names'],
|
||||||
'PACKAGE' => array('default' => 'default'),
|
'PACKAGE' => $pckg,
|
||||||
'SHELL' => array(
|
'SHELL' => array(
|
||||||
'sh' => 'sh',
|
'sh' => 'sh',
|
||||||
'bash' => 'bash',
|
'bash' => 'bash',
|
||||||
|
|
|
@ -71,7 +71,8 @@ class USER extends AjaxHandler
|
||||||
"DATE" => $details['DATE'],
|
"DATE" => $details['DATE'],
|
||||||
"U_MAIL_BOXES" => rand(1, 10), // TODO: skid
|
"U_MAIL_BOXES" => rand(1, 10), // TODO: skid
|
||||||
"U_MAIL_FORWARDERS" => rand(1, 10), // TODO: skid
|
"U_MAIL_FORWARDERS" => rand(1, 10), // TODO: skid
|
||||||
"REPORTS_ENABLED" => $report
|
"REPORTS_ENABLED" => $report,
|
||||||
|
"U_WEB_DOMAINS" => $details['U_WEB_DOMAINS']
|
||||||
);
|
);
|
||||||
$reply[$user] = array_merge($user_details, $nses);
|
$reply[$user] = array_merge($user_details, $nses);
|
||||||
}
|
}
|
||||||
|
@ -105,7 +106,7 @@ class USER extends AjaxHandler
|
||||||
$enable_reports = Utils::getCheckboxBooleanValue($spell['REPORTS_ENABLED']);
|
$enable_reports = Utils::getCheckboxBooleanValue($spell['REPORTS_ENABLED']);
|
||||||
$reports_result = $this->setUserReports($spell['LOGIN_NAME'], $spell['REPORTS_ENABLED']);
|
$reports_result = $this->setUserReports($spell['LOGIN_NAME'], $spell['REPORTS_ENABLED']);
|
||||||
// NS
|
// NS
|
||||||
$ns_result = $this->setNSentries($spell['LOGIN_NAME'], $spell);
|
//$ns_result = $this->setNSentries($spell['LOGIN_NAME'], $spell);
|
||||||
// Set SHELL
|
// Set SHELL
|
||||||
$this->setShell($spell['LOGIN_NAME'], $spell['SHELL']);
|
$this->setShell($spell['LOGIN_NAME'], $spell['SHELL']);
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,17 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
$url = "http://dev.vestacp.com:8083/dispatch.php";
|
||||||
|
$useragent = "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)";
|
||||||
|
$ch = curl_init();
|
||||||
|
curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
|
||||||
|
curl_setopt($ch, CURLOPT_POST, 1);
|
||||||
|
curl_setopt($ch, CURLOPT_URL,$url);
|
||||||
|
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($_POST));
|
||||||
|
$result= curl_exec ($ch);
|
||||||
|
curl_close ($ch);
|
||||||
|
die();
|
||||||
|
|
||||||
|
|
||||||
define('V_ROOT_DIR', dirname(__FILE__) . DIRECTORY_SEPARATOR);
|
define('V_ROOT_DIR', dirname(__FILE__) . DIRECTORY_SEPARATOR);
|
||||||
|
|
||||||
require_once V_ROOT_DIR . 'config/Config.class.php';
|
require_once V_ROOT_DIR . 'config/Config.class.php';
|
||||||
|
|
|
@ -127,6 +127,11 @@ class Vesta
|
||||||
throw new ProtectionException('No function name passed into Vesta::execute'); // TODO: move msg to Messages::
|
throw new ProtectionException('No function name passed into Vesta::execute'); // TODO: move msg to Messages::
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$reply_type = $reply;
|
||||||
|
if ($reply != AjaxHandler::JSON) {
|
||||||
|
$reply = '';
|
||||||
|
}
|
||||||
|
|
||||||
$params = array(
|
$params = array(
|
||||||
'sudo' => Config::get('sudo_path'),
|
'sudo' => Config::get('sudo_path'),
|
||||||
'functions' => Config::get('vesta_functions_path'),
|
'functions' => Config::get('vesta_functions_path'),
|
||||||
|
@ -137,7 +142,6 @@ class Vesta
|
||||||
// e.g.: /usr/bin/sudo /usr/local/vesta/bin/v_list_sys_users vesta json
|
// e.g.: /usr/bin/sudo /usr/local/vesta/bin/v_list_sys_users vesta json
|
||||||
$cmd = "{$params['sudo']} {$params['functions']}{$cmd_command} {$params['parameters']} {$params['reply']}";
|
$cmd = "{$params['sudo']} {$params['functions']}{$cmd_command} {$params['parameters']} {$params['reply']}";
|
||||||
exec($cmd, $output, $return);
|
exec($cmd, $output, $return);
|
||||||
|
|
||||||
$result = 0;
|
$result = 0;
|
||||||
$result = array(
|
$result = array(
|
||||||
'status' => TRUE,
|
'status' => TRUE,
|
||||||
|
@ -169,7 +173,7 @@ class Vesta
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($reply == 'text') {
|
if ($reply_type == 'text') {
|
||||||
$result['data'] = implode('', $output);
|
$result['data'] = implode('', $output);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue