- * @author vesta, http://vestacp.com/
+ * @author vesta, http://vestacp.com
* @copyright vesta 2010-2011
*/
class Request
@@ -37,10 +37,10 @@ class Request
public function mergeContainers()
{
$this->_merged = array_merge($this->server,
- $this->post,
- $this->get,
- $this->global);
- $this->_spell = json_decode($this->_merged['spell'], true);
+ $this->post,
+ $this->get,
+ $this->global);
+ $this->_spell = json_decode($this->_merged['spell'], true);
}
/**
@@ -55,7 +55,7 @@ class Request
return isset($this->_merged[$key]) ? $this->_merged[$key] : $default;
}
- /**
+ /**
* Get spell variable from parameters
*
* @return array
@@ -65,7 +65,7 @@ class Request
return $this->_spell;
}
- /**
+ /**
* Check if parameter is set
*
* @param string $key
@@ -90,7 +90,7 @@ class Request
return true;
}
- /**
+ /**
* Dissassemble ajax method
* Breaks ajax requested method param into "ENTITY"."ACTION"
* for instance DNS.getList into "namespase" => DNS, "function" => "getList"
diff --git a/web/vesta/core/Vesta.class.php b/web/vesta/core/Vesta.class.php
index ac99cb990..8b0c50e29 100644
--- a/web/vesta/core/Vesta.class.php
+++ b/web/vesta/core/Vesta.class.php
@@ -12,98 +12,98 @@
class Vesta
{
// IP
- const V_LIST_SYS_IPS = 'v_list_sys_ips';
- const V_ADD_SYS_IP = 'v_add_sys_ip';
- const V_ADD_SYS_USER_IP = 'v_add_sys_user_ip';
- const V_CHANGE_SYS_IP_OWNER = 'v_change_sys_ip_owner';
- const V_CHANGE_SYS_IP_NAME = 'v_change_sys_ip_name';
- const V_CHANGE_SYS_IP_STATUS = 'v_change_sys_ip_status';
- const V_DEL_SYS_IP = 'v_del_sys_ip';
- const V_UPD_SYS_IP = 'v_upd_sys_ip';
- const V_LIST_SYS_INTERFACES = 'v_list_sys_interfaces';
+ const V_LIST_SYS_IPS = 'v_list_sys_ips';
+ const V_ADD_SYS_IP = 'v_add_sys_ip';
+ const V_ADD_SYS_USER_IP = 'v_add_sys_user_ip';
+ const V_CHANGE_SYS_IP_OWNER = 'v_change_sys_ip_owner';
+ const V_CHANGE_SYS_IP_NAME = 'v_change_sys_ip_name';
+ const V_CHANGE_SYS_IP_STATUS = 'v_change_sys_ip_status';
+ const V_DEL_SYS_IP = 'v_del_sys_ip';
+ const V_UPD_SYS_IP = 'v_upd_sys_ip';
+ const V_LIST_SYS_INTERFACES = 'v_list_sys_interfaces';
// DNS
- const V_LIST_DNS_DOMAINS = 'v_list_dns_domains';
- const V_LIST_DNS_DOMAIN_RECORDS = 'v_list_dns_domain';
- const V_ADD_DNS_DOMAIN = 'v_add_dns_domain';
- const V_ADD_DNS_DOMAIN_RECORD = 'v_add_dns_domain_record';
- const V_CHANGE_DNS_DOMAIN_IP = 'v_change_dns_domain_ip';
- const V_CHANGE_DNS_DOMAIN_SOA = 'v_change_dns_domain_soa';
- const V_CHANGE_DNS_DOMAIN_TPL = 'v_change_dns_domain_tpl';
- const V_CHANGE_DNS_DOMAIN_TTL = 'v_change_dns_domain_ttl';
- const V_CHANGE_DNS_DOMAIN_EXP = 'v_change_dns_domain_exp';
- const V_CHANGE_DNS_DOMAIN_RECORD = 'v_change_dns_domain_record';
- const V_DEL_DNS_DOMAIN = 'v_del_dns_domain';
- const V_DEL_DNS_DOMAIN_RECORD = 'v_del_dns_domain_record';
+ const V_LIST_DNS_DOMAINS = 'v_list_dns_domains';
+ const V_LIST_DNS_DOMAIN_RECORDS = 'v_list_dns_domain';
+ const V_ADD_DNS_DOMAIN = 'v_add_dns_domain';
+ const V_ADD_DNS_DOMAIN_RECORD = 'v_add_dns_domain_record';
+ const V_CHANGE_DNS_DOMAIN_IP = 'v_change_dns_domain_ip';
+ const V_CHANGE_DNS_DOMAIN_SOA = 'v_change_dns_domain_soa';
+ const V_CHANGE_DNS_DOMAIN_TPL = 'v_change_dns_domain_tpl';
+ const V_CHANGE_DNS_DOMAIN_TTL = 'v_change_dns_domain_ttl';
+ const V_CHANGE_DNS_DOMAIN_EXP = 'v_change_dns_domain_exp';
+ const V_CHANGE_DNS_DOMAIN_RECORD = 'v_change_dns_domain_record';
+ const V_DEL_DNS_DOMAIN = 'v_del_dns_domain';
+ const V_DEL_DNS_DOMAIN_RECORD = 'v_del_dns_domain_record';
// CRON
- const V_LIST_CRON_JOBS = 'v_list_sys_cron';
- const V_ADD_CRON_JOB = 'v_add_sys_cron';
- const V_ADD_SYS_USER_REPORTS = 'v_add_sys_user_reports';
- const V_CHANGE_CRON_JOB = 'v_change_sys_cron_job';
- const V_SUSPEND_CRON_JOB = 'v_suspend_sys_cron_job';
- const V_SUSPEND_CRON_JOBS = 'v_suspend_sys_cron_jobs';
- const V_UNSUSPEND_CRON_JOB = 'v_unsuspend_sys_cron_job';
- const V_UNSUSPEND_CRON_JOBS = 'v_unsuspend_sys_cron_jobs';
- const V_DEL_CRON_JOB = 'v_del_sys_cron';
- const V_DEL_SYS_USER_REPORTS = 'v_del_sys_user_reports';
- // USER
- const V_LIST_SYS_USERS = 'v_list_sys_users';
- const V_ADD_SYS_USER = 'v_add_sys_user';
- const V_CHANGE_SYS_USER_CONTACT = 'v_change_sys_user_contact';
- const V_CHANGE_SYS_USER_NS = 'v_change_sys_user_ns';
- const V_CHANGE_SYS_USER_PACKAGE = 'v_change_sys_user_package';
- const V_CHANGE_SYS_USER_PASSWORD = 'v_change_sys_user_password';
- const V_CHANGE_SYS_USER_SHELL = 'v_change_sys_user_shell';
- const V_CHANGE_SYS_USER_ROLE = 'v_change_sys_user_role';
- const V_DEL_SYS_USER = 'v_del_sys_user';
+ const V_LIST_CRON_JOBS = 'v_list_sys_cron';
+ const V_ADD_CRON_JOB = 'v_add_sys_cron';
+ const V_ADD_SYS_USER_REPORTS = 'v_add_sys_user_reports';
+ const V_CHANGE_CRON_JOB = 'v_change_sys_cron_job';
+ const V_SUSPEND_CRON_JOB = 'v_suspend_sys_cron_job';
+ const V_SUSPEND_CRON_JOBS = 'v_suspend_sys_cron_jobs';
+ const V_UNSUSPEND_CRON_JOB = 'v_unsuspend_sys_cron_job';
+ const V_UNSUSPEND_CRON_JOBS = 'v_unsuspend_sys_cron_jobs';
+ const V_DEL_CRON_JOB = 'v_del_sys_cron';
+ const V_DEL_SYS_USER_REPORTS = 'v_del_sys_user_reports';
+ // USER
+ const V_LIST_SYS_USERS = 'v_list_sys_users';
+ const V_ADD_SYS_USER = 'v_add_sys_user';
+ const V_CHANGE_SYS_USER_CONTACT = 'v_change_sys_user_contact';
+ const V_CHANGE_SYS_USER_NS = 'v_change_sys_user_ns';
+ const V_CHANGE_SYS_USER_PACKAGE = 'v_change_sys_user_package';
+ const V_CHANGE_SYS_USER_PASSWORD = 'v_change_sys_user_password';
+ const V_CHANGE_SYS_USER_SHELL = 'v_change_sys_user_shell';
+ const V_CHANGE_SYS_USER_ROLE = 'v_change_sys_user_role';
+ const V_DEL_SYS_USER = 'v_del_sys_user';
// WEB_DOMAIN
- const V_LIST_WEB_DOMAINS = 'v_list_web_domains';
- const V_LIST_WEB_DOMAINS_ALIAS = 'v_list_web_domains_alias';
- const V_LIST_WEB_DOMAINS_ELOG = 'v_list_web_domains_elog';
- const V_LIST_WEB_DOMAINS_PROXY = 'v_list_web_domains_proxy';
- const V_LIST_WEB_DOMAINS_SSL = 'v_list_web_domains_ssl';
- const V_LIST_WEB_DOMAINS_STATS = 'v_list_web_domains_stats';
- const V_LIST_WEB_TEMPLATES = 'v_list_web_templates';
- const V_ADD_WEB_DOMAIN = 'v_add_web_domain';
- const V_ADD_WEB_DOMAIN_ALIAS = 'v_add_web_domain_alias';
- const V_ADD_WEB_DOMAIN_STAT = 'v_add_web_domain_stat';
- const V_ADD_WEB_DOMAIN_STAT_AUTH = 'v_add_web_domain_stat_auth';
- const V_ADD_WEB_DOMAIN_SSL = 'v_add_web_domain_ssl';
- const V_ADD_WEB_DOMAIN_ELOG = 'v_add_web_domain_elog';
- const V_ADD_WEB_DOMAIN_CGI = 'v_add_web_domain_cgi';
- const V_CHANGE_WEB_DOMAIN_IP = 'v_change_web_domain_ip';
- const V_CHANGE_WEB_DOMAIN_SSLCERT = 'v_change_web_domain_sslcert';
- const V_CHANGE_WEB_DOMAIN_SSLHOME = 'v_change_web_domain_sslhome';
- const V_CHANGE_WEB_DOMAIN_TPL = 'v_change_web_domain_tpl';
- const V_DEL_WEB_DOMAIN_CGI = 'v_del_web_domain_cgi';
- const V_DEL_WEB_DOMAIN_ELOG = 'v_del_web_domain_elog';
- const V_DEL_WEB_DOMAIN_SSL = 'v_del_web_domain_ssl';
- const V_DEL_WEB_DOMAIN_STAT = 'v_del_web_domain_stat';
- const V_DEL_WEB_DOMAIN_STAT_AUTH = 'v_del_web_domain_stat_auth';
- const V_DEL_WEB_DOMAIN_ALIAS = 'v_del_web_domain_alias';
- const V_SUSPEND_WEB_DOMAIN = 'v_suspend_web_domain';
- const V_SUSPEND_WEB_DOMAINS = 'v_suspend_web_domains';
- const V_UNSUSPEND_WEB_DOMAIN = 'v_unsuspend_web_domain';
- const V_UNSUSPEND_WEB_DOMAINS = 'v_unsuspend_web_domains';
- const V_UPD_WEB_DOMAIN_DISK = 'v_upd_web_domain_disk';
- const V_UPD_WEB_DOMAINS_DISK = 'v_upd_web_domains_disk';
- const V_UPD_WEB_DOMAIN_TRAFF = 'v_upd_web_domain_traff';
- const V_UPD_WEB_DOMAINS_TRAFF = 'v_upd_web_domains_traff';
- const V_DEL_WEB_DOMAIN = 'v_del_web_domain';
+ const V_LIST_WEB_DOMAINS = 'v_list_web_domains';
+ const V_LIST_WEB_DOMAINS_ALIAS = 'v_list_web_domains_alias';
+ const V_LIST_WEB_DOMAINS_ELOG = 'v_list_web_domains_elog';
+ const V_LIST_WEB_DOMAINS_PROXY = 'v_list_web_domains_proxy';
+ const V_LIST_WEB_DOMAINS_SSL = 'v_list_web_domains_ssl';
+ const V_LIST_WEB_DOMAINS_STATS = 'v_list_web_domains_stats';
+ const V_LIST_WEB_TEMPLATES = 'v_list_web_templates';
+ const V_ADD_WEB_DOMAIN = 'v_add_web_domain';
+ const V_ADD_WEB_DOMAIN_ALIAS = 'v_add_web_domain_alias';
+ const V_ADD_WEB_DOMAIN_STAT = 'v_add_web_domain_stat';
+ const V_ADD_WEB_DOMAIN_STAT_AUTH = 'v_add_web_domain_stat_auth';
+ const V_ADD_WEB_DOMAIN_SSL = 'v_add_web_domain_ssl';
+ const V_ADD_WEB_DOMAIN_ELOG = 'v_add_web_domain_elog';
+ const V_ADD_WEB_DOMAIN_CGI = 'v_add_web_domain_cgi';
+ const V_CHANGE_WEB_DOMAIN_IP = 'v_change_web_domain_ip';
+ const V_CHANGE_WEB_DOMAIN_SSLCERT = 'v_change_web_domain_sslcert';
+ const V_CHANGE_WEB_DOMAIN_SSLHOME = 'v_change_web_domain_sslhome';
+ const V_CHANGE_WEB_DOMAIN_TPL = 'v_change_web_domain_tpl';
+ const V_DEL_WEB_DOMAIN_CGI = 'v_del_web_domain_cgi';
+ const V_DEL_WEB_DOMAIN_ELOG = 'v_del_web_domain_elog';
+ const V_DEL_WEB_DOMAIN_SSL = 'v_del_web_domain_ssl';
+ const V_DEL_WEB_DOMAIN_STAT = 'v_del_web_domain_stat';
+ const V_DEL_WEB_DOMAIN_STAT_AUTH = 'v_del_web_domain_stat_auth';
+ const V_DEL_WEB_DOMAIN_ALIAS = 'v_del_web_domain_alias';
+ const V_SUSPEND_WEB_DOMAIN = 'v_suspend_web_domain';
+ const V_SUSPEND_WEB_DOMAINS = 'v_suspend_web_domains';
+ const V_UNSUSPEND_WEB_DOMAIN = 'v_unsuspend_web_domain';
+ const V_UNSUSPEND_WEB_DOMAINS = 'v_unsuspend_web_domains';
+ const V_UPD_WEB_DOMAIN_DISK = 'v_upd_web_domain_disk';
+ const V_UPD_WEB_DOMAINS_DISK = 'v_upd_web_domains_disk';
+ const V_UPD_WEB_DOMAIN_TRAFF = 'v_upd_web_domain_traff';
+ const V_UPD_WEB_DOMAINS_TRAFF = 'v_upd_web_domains_traff';
+ const V_DEL_WEB_DOMAIN = 'v_del_web_domain';
// DB
- const V_LIST_DB_BASES = 'v_list_db_bases';
- const V_LIST_DB_HOSTS = 'v_list_db_hosts';
- const V_ADD_DB_BASE = 'v_add_db_base';
- const V_ADD_DB_HOST = 'v_add_db_host';
- const V_SUSPEND_DB_BASE = 'v_suspend_db_base';
- const V_SUSPEND_DB_BASES = 'v_suspend_db_bases';
- const V_UNSUSPEND_DB_BASE = 'v_unsuspend_db_base';
- const V_UNSUSPEND_DB_BASES = 'v_unsuspend_db_bases';
- const V_CHANGE_DB_PASSWORD = 'v_change_db_password';
- const V_DEL_DB_BASE = 'v_del_db_base';
- const V_DEL_DB_HOST = 'v_del_db_host';
- const V_UPD_DB_BASE_DISK = 'v_upd_db_base_disk';
- const V_UPD_DB_BASES_DISK = 'v_upd_db_bases_disk';
- const PARAM_DELIMETER = ' ';
+ const V_LIST_DB_BASES = 'v_list_db_bases';
+ const V_LIST_DB_HOSTS = 'v_list_db_hosts';
+ const V_ADD_DB_BASE = 'v_add_db_base';
+ const V_ADD_DB_HOST = 'v_add_db_host';
+ const V_SUSPEND_DB_BASE = 'v_suspend_db_base';
+ const V_SUSPEND_DB_BASES = 'v_suspend_db_bases';
+ const V_UNSUSPEND_DB_BASE = 'v_unsuspend_db_base';
+ const V_UNSUSPEND_DB_BASES = 'v_unsuspend_db_bases';
+ const V_CHANGE_DB_PASSWORD = 'v_change_db_password';
+ const V_DEL_DB_BASE = 'v_del_db_base';
+ const V_DEL_DB_HOST = 'v_del_db_host';
+ const V_UPD_DB_BASE_DISK = 'v_upd_db_base_disk';
+ const V_UPD_DB_BASES_DISK = 'v_upd_db_bases_disk';
+ const PARAM_DELIMETER = ' ';
/**
* Execute vesta command
@@ -114,8 +114,8 @@ class Vesta
*/
static function execute($cmd_command, $parameters=array())
{
- $r = new Request();
- $_DEBUG = $r->getParameter("debug", FALSE);
+ $r = new Request();
+ $_DEBUG = $r->getParameter("debug", FALSE);
if (!isset($cmd_command))
{
@@ -123,51 +123,51 @@ class Vesta
}
$params = array(
- 'sudo' => Config::get('sudo_path'),
+ 'sudo' => Config::get('sudo_path'),
'functions' => Config::get('vesta_functions_path'),
- 'parameters' => implode("' '", $parameters),
+ 'parameters' => implode("' '", $parameters),
);
-
- // 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']}";
-
+
exec($cmd, $output, $return);
- $result = 0;
- $result = array('status' => TRUE,
- 'data' => '',
- 'error_code' => '',
- 'error_message' => ''
- );
+ $result = 0;
+ $result = array('status' => TRUE,
+ 'data' => '',
+ 'error_code' => '',
+ 'error_message' => ''
+ );
- // TODO: please remove this later :)
- if ($_DEBUG)
- {
- $result['debug'] = array(
- "cmd" => $cmd,
- "output" => $output,
- "return" => $return
- );
- if ($debug == 2)
- {
- echo ''.$cmd;
- echo '
output: '; print_r($output);
- echo '
return: '.$return;
- echo '
';
- }
- }
+ // TODO: please remove this later :)
+ if ($_DEBUG)
+ {
+ $result['debug'] = array(
+ "cmd" => $cmd,
+ "output" => $output,
+ "return" => $return
+ );
+ if ($debug == 2)
+ {
+ echo ''.$cmd;
+ echo '
output: '; print_r($output);
+ echo '
return: '.$return;
+ echo '
';
+ }
+ }
- if (!!(int)$return)
- {
- $result['status'] = FALSE;
- $result['error_code'] = (int)$return;
- $result['error_message'] = implode('', $output);
- }
- else
- {
- $result['data'] = json_decode(implode('', $output), true);
- }
-
- return $result;
+ if (!!(int)$return)
+ {
+ $result['status'] = FALSE;
+ $result['error_code'] = (int)$return;
+ $result['error_message'] = implode('', $output);
+ }
+ else
+ {
+ $result['data'] = json_decode(implode('', $output), true);
+ }
+
+ return $result;
}
}
diff --git a/web/vesta/core/exceptions/ProtectionException.class.php b/web/vesta/core/exceptions/ProtectionException.class.php
index cb4da129d..b8ea308cc 100644
--- a/web/vesta/core/exceptions/ProtectionException.class.php
+++ b/web/vesta/core/exceptions/ProtectionException.class.php
@@ -13,17 +13,17 @@ class ProtectionException extends Exception
{
const CODE_GENERAL = 0;
- /**
- * Protection exception
- */
+ /**
+ * Protection exception
+ */
public function __construct($message, $code=self::CODE_GENERAL, $previous=null)
{
parent::__construct($message, $code, $previous);
}
- /**
- * Renders error message
- */
+ /**
+ * Renders error message
+ */
public function __toString()
{
print $this->message;
diff --git a/web/vesta/core/utils/Message.class.php b/web/vesta/core/utils/Message.class.php
index 5695b4e26..e1a91daec 100644
--- a/web/vesta/core/utils/Message.class.php
+++ b/web/vesta/core/utils/Message.class.php
@@ -11,15 +11,15 @@
*/
class Message
{
-
- const ERROR = 'error';
- const REQUEST_INVALID = 'Malformed request';
- const REQUEST_IS_NOT_POST = 'Request is not POST';
- const GENERAL_ERROR = 'General protection fault';
- const METHOD_NOT_EXIST = 'Message not exist';
- const INVALID_METHOD = 'Method Invalid';
- const SYSTEM_ERROR = 'System Error';
- const PROTECTION_ERROR = 'Protection error';
+
+ const ERROR = 'error';
+ const REQUEST_INVALID = 'Malformed request';
+ const REQUEST_IS_NOT_POST = 'Request is not POST';
+ const GENERAL_ERROR = 'General protection fault';
+ const METHOD_NOT_EXIST = 'Message not exist';
+ const INVALID_METHOD = 'Method Invalid';
+ const SYSTEM_ERROR = 'System Error';
+ const PROTECTION_ERROR = 'Protection error';
}
diff --git a/web/vesta/core/utils/error_logger.php b/web/vesta/core/utils/error_logger.php
index 73234ef9a..d9f601f1a 100644
--- a/web/vesta/core/utils/error_logger.php
+++ b/web/vesta/core/utils/error_logger.php
@@ -14,28 +14,28 @@ function error_dumper($errno, $errstr, $errfile, $errline)
$o.= " Fatal error on line $errline in file $errfile";
$o.= ", PHP " . PHP_VERSION . " (" . PHP_OS . ")\n";
$o.= "Aborting...\n";
- fwrite($log, $o);
- fclose($log);
- exit(1);
+ fwrite($log, $o);
+ fclose($log);
+ exit(1);
break;
case E_USER_WARNING:
$o = "WARNING: [$errno] $errstr\n";
fwrite($log, $o);
- fclose($log);
- break;
+ fclose($log);
+ break;
case E_USER_NOTICE:
$o = "NOTICE: [$errno] $errstr\n";
fwrite($log, $o);
- fclose($log);
- break;
+ fclose($log);
+ break;
default:
$o = "Unknown error type: [$errno] $errstr\n";
fwrite($log, $o);
- fclose($log);
- break;
+ fclose($log);
+ break;
}
/* Don't execute PHP internal error handler */