mirror of
https://github.com/myvesta/vesta
synced 2025-08-14 02:28:05 -07:00
Deleted tmp php files
This commit is contained in:
parent
82fcd3c90b
commit
e92b5909a0
2 changed files with 0 additions and 307 deletions
|
@ -1,86 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Request
|
||||
*
|
||||
* Holds parameters, decorating them and providing easy access
|
||||
*
|
||||
* @author vesta, http://vestacp.com/
|
||||
* @copyright vesta 2010
|
||||
*/
|
||||
class Request {
|
||||
|
||||
protected $server = array();
|
||||
protected $post = array();
|
||||
protected $get = array();
|
||||
protected $global = array();
|
||||
protected $_merged = array();
|
||||
protected $_spell = array();
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->post = $_POST;
|
||||
$this->get = $_GET;
|
||||
$this->server = $_SERVER;
|
||||
|
||||
$this->mergeContainers();
|
||||
}
|
||||
|
||||
/**
|
||||
* Merge holders into single holder
|
||||
*/
|
||||
function mergeContainers() {
|
||||
$this->_merged = array_merge($this->server, $this->post, $this->get, $this->global);
|
||||
$this->_spell = json_decode($this->_merged['spell'], true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get parameter
|
||||
*
|
||||
* @param <string> $key
|
||||
* @param <mixed> $default
|
||||
* @return <mixed>
|
||||
*
|
||||
*/
|
||||
function getParameter($key, $default=false) {
|
||||
return isset($this->_merged[$key]) ? $this->_merged[$key] : $default;
|
||||
// return isset($this->_spell[$key]) ? $this->_spell[$key] : $default;
|
||||
}
|
||||
|
||||
function getSpell() {
|
||||
return $this->_spell;
|
||||
}
|
||||
|
||||
function hasParameter($key, $default=false) {
|
||||
return isset($this->_merged[$key]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if request is post
|
||||
*
|
||||
* TODO: write the method
|
||||
*
|
||||
* @return <boolean>
|
||||
*/
|
||||
function isPost() {
|
||||
return true;
|
||||
}
|
||||
|
||||
static function parseAjaxMethod($request) {
|
||||
if (!$request->hasParameter('jedi_method')) {
|
||||
throw new ProtectionException(Message::INVALID_METHOD);
|
||||
}
|
||||
|
||||
$method = explode('.', $request->getParameter('jedi_method'));
|
||||
|
||||
if (count($method) != 2) {
|
||||
throw new ProtectionException(Message::INVALID_METHOD);
|
||||
}
|
||||
|
||||
return array('namespace' => ucfirst($method[0]), 'function' => strtolower($method[1]));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,221 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
*
|
||||
* @author vesta, http://vestacp.com/
|
||||
* @copyright vesta 2010
|
||||
*/
|
||||
class Vesta {
|
||||
// ====================== IP ===========================
|
||||
const V_LIST_SYS_IPS = 'v_list_sys_ips';
|
||||
|
||||
// adding
|
||||
const V_ADD_SYS_IP = 'v_add_sys_ip';
|
||||
const V_ADD_SYS_USER_IP = 'v_add_sys_user_ip';
|
||||
|
||||
// changing
|
||||
const V_CHANGE_SYS_IP_OWNER = 'v_change_sys_ip_owner';
|
||||
const V_CHANGE_SYS_IP_NAME = 'v_change_sys_ip_name';
|
||||
|
||||
// deleting
|
||||
const V_DEL_SYS_IP = 'v_del_sys_ip';
|
||||
|
||||
// service
|
||||
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';
|
||||
|
||||
// adding
|
||||
const V_ADD_DNS_DOMAIN = 'v_add_dns_domain';
|
||||
const V_ADD_DNS_DOMAIN_RECORD = 'v_add_dns_domain_record';
|
||||
|
||||
// changing
|
||||
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';
|
||||
|
||||
// deleting
|
||||
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';
|
||||
|
||||
// adding
|
||||
const V_ADD_CRON_JOB = 'v_add_sys_cron';
|
||||
const V_ADD_SYS_USER_REPORTS = 'v_add_sys_user_reports';
|
||||
|
||||
// changing
|
||||
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';
|
||||
|
||||
// deleting
|
||||
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';
|
||||
|
||||
// adding
|
||||
const V_ADD_SYS_USER = 'v_add_sys_user';
|
||||
|
||||
// changing
|
||||
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';
|
||||
|
||||
// deleting
|
||||
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';
|
||||
|
||||
// adding
|
||||
const V_ADD_WEB_DOMAIN = 'v_add_web_domain';
|
||||
const V_ADD_WEB_DOMAIN_ALIAS = 'v_add_web_domain_alias';
|
||||
|
||||
// changing
|
||||
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';
|
||||
|
||||
// deleting
|
||||
const V_DEL_WEB_DOMAIN = 'v_del_web_domain';
|
||||
|
||||
|
||||
// ======================= DB =========================
|
||||
// list
|
||||
const V_LIST_DB_BASES = 'v_list_db_bases';
|
||||
const V_LIST_DB_HOSTS = 'v_list_db_hosts';
|
||||
|
||||
// adding
|
||||
const V_ADD_DB_BASE = 'v_add_db_base';
|
||||
const V_ADD_DB_HOST = 'v_add_db_host';
|
||||
|
||||
// changing
|
||||
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';
|
||||
|
||||
// deleting
|
||||
const V_DEL_DB_BASE = 'v_del_db_base';
|
||||
const V_DEL_DB_HOST = 'v_del_db_host';
|
||||
|
||||
// service
|
||||
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 = ' ';
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
static function execute($cmd_command, $parameters=array()) {
|
||||
$r = new Request();
|
||||
$debug = $r->getParameter("debug", FALSE);
|
||||
|
||||
if (!isset($cmd_command)) {
|
||||
throw new ProtectionException('No function name passed into Vesta::execute'); // TODO: move msg to Messages::
|
||||
}
|
||||
|
||||
$params = array(
|
||||
'sudo' => Config::get('sudo_path'),
|
||||
'functions' => Config::get('vesta_functions_path'),
|
||||
'parameters' => implode("' '", $parameters),
|
||||
// 'reply' => Config::get('response_type')
|
||||
);
|
||||
|
||||
|
||||
$cmd = "{$params['sudo']} {$params['functions']}{$cmd_command} '{$params['parameters']}' {$params['reply']}";
|
||||
// /usr/bin/sudo /usr/local/vesta/bin/v_list_sys_users vesta json
|
||||
exec($cmd, $output, $return);
|
||||
|
||||
$result = 0;
|
||||
$result = array('status' => TRUE,
|
||||
'data' => '',
|
||||
'error_code' => '',
|
||||
'error_message' => ''
|
||||
);
|
||||
|
||||
if($debug)
|
||||
{
|
||||
$result['debug'] = array(
|
||||
"cmd" => $cmd,
|
||||
"output" => $output,
|
||||
"return" => $return
|
||||
);
|
||||
if($debug == 2)
|
||||
{
|
||||
echo '<p>'.$cmd;
|
||||
echo '<br> output: '; print_r($output);
|
||||
echo '<br> return: '.$return;
|
||||
echo '</p>';
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue