mirror of
https://github.com/serghey-rodin/vesta.git
synced 2025-08-20 21:34:11 -07:00
Tabs into spaces converted
This commit is contained in:
parent
c11a9b3e01
commit
b908909e1a
16 changed files with 1527 additions and 1526 deletions
|
@ -209,6 +209,7 @@
|
||||||
<script type="text/javascript" src="js/lib/custom-form-elements.js"></script>
|
<script type="text/javascript" src="js/lib/custom-form-elements.js"></script>
|
||||||
<script type="text/javascript" src="js/lib/browser.js"></script>
|
<script type="text/javascript" src="js/lib/browser.js"></script>
|
||||||
<script type="text/javascript" src="js/lib/popup.js"></script>
|
<script type="text/javascript" src="js/lib/popup.js"></script>
|
||||||
|
<script type="text/javascript" src="js/tech.js"></script>
|
||||||
<script type="text/javascript" src="js/app.js"></script>
|
<script type="text/javascript" src="js/app.js"></script>
|
||||||
<script type="text/javascript" src="js/tech.js"></script>
|
<script type="text/javascript" src="js/tech.js"></script>
|
||||||
<script type="text/javascript" src="js/_settings.js"></script>
|
<script type="text/javascript" src="js/_settings.js"></script>
|
||||||
|
|
|
@ -52,28 +52,28 @@ class AjaxHandler
|
||||||
return $space->$method($request);
|
return $space->$method($request);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prepare the result of method execution into ajax-readable format
|
* Prepare the result of method execution into ajax-readable format
|
||||||
*
|
*
|
||||||
* @param boolean $result - result of method execution
|
* @param boolean $result - result of method execution
|
||||||
* @param array $data - data to be replied
|
* @param array $data - data to be replied
|
||||||
* @param string $message - replied message
|
* @param string $message - replied message
|
||||||
* @param array $extra - extra data
|
* @param array $extra - extra data
|
||||||
*/
|
*/
|
||||||
function reply($result, $data, $message = '', $extra = array())
|
function reply($result, $data, $message = '', $extra = array())
|
||||||
{
|
{
|
||||||
return json_encode(array('result' => $result,
|
return json_encode(array('result' => $result,
|
||||||
'data' => $data,
|
'data' => $data,
|
||||||
'message' => $message,
|
'message' => $message,
|
||||||
'extra' => $extra,
|
'extra' => $extra,
|
||||||
'errors' => $this->errors
|
'errors' => $this->errors
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO: delete this method
|
* TODO: delete this method
|
||||||
* @deprecated
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
static function makeReply($reply)
|
static function makeReply($reply)
|
||||||
{
|
{
|
||||||
print $reply;
|
print $reply;
|
||||||
|
@ -92,7 +92,7 @@ class AjaxHandler
|
||||||
self::renderGlobalError(Message::ERROR, Message::GENERAL_ERROR, $error);
|
self::renderGlobalError(Message::ERROR, Message::GENERAL_ERROR, $error);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate protection error
|
* Generate protection error
|
||||||
* @param Exception $error
|
* @param Exception $error
|
||||||
*/
|
*/
|
||||||
|
@ -101,7 +101,7 @@ class AjaxHandler
|
||||||
self::renderGlobalError(Message::ERROR, Message::PROTECTION_ERROR, $error);
|
self::renderGlobalError(Message::ERROR, Message::PROTECTION_ERROR, $error);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate system error
|
* Generate system error
|
||||||
* @param Exception $error
|
* @param Exception $error
|
||||||
*/
|
*/
|
||||||
|
@ -110,7 +110,7 @@ class AjaxHandler
|
||||||
self::renderGlobalError(Message::ERROR, Message::SYSTEM_ERROR, $error);
|
self::renderGlobalError(Message::ERROR, Message::SYSTEM_ERROR, $error);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prepare and render the error
|
* Prepare and render the error
|
||||||
* @param Exception $error
|
* @param Exception $error
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -11,261 +11,261 @@
|
||||||
class CRON extends AjaxHandler
|
class CRON extends AjaxHandler
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List cron entries
|
* List cron entries
|
||||||
*
|
*
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public function getListExecute($request)
|
public function getListExecute($request)
|
||||||
{
|
{
|
||||||
$_user = 'vesta';
|
$_user = 'vesta';
|
||||||
$reply = array();
|
$reply = array();
|
||||||
|
|
||||||
$result = Vesta::execute(Vesta::V_LIST_CRON_JOBS,
|
$result = Vesta::execute(Vesta::V_LIST_CRON_JOBS,
|
||||||
array($_user, Config::get('response_type')));
|
array($_user, Config::get('response_type')));
|
||||||
|
|
||||||
foreach ($result['data'] as $id => $record)
|
foreach ($result['data'] as $id => $record)
|
||||||
{
|
{
|
||||||
$reply[$id] = array(
|
$reply[$id] = array(
|
||||||
'CMD' => $record['CMD'],
|
'CMD' => $record['CMD'],
|
||||||
'MIN' => $record['MIN'],
|
'MIN' => $record['MIN'],
|
||||||
'HOUR' => $record['HOUR'],
|
'HOUR' => $record['HOUR'],
|
||||||
'DAY' => $record['DAY'],
|
'DAY' => $record['DAY'],
|
||||||
'MONTH' => $record['MONTH'],
|
'MONTH' => $record['MONTH'],
|
||||||
'WDAY' => $record['WDAY'],
|
'WDAY' => $record['WDAY'],
|
||||||
'SUSPEND' => $record['SUSPEND'],
|
'SUSPEND' => $record['SUSPEND'],
|
||||||
'DATE' => date(Config::get('ui_date_format', strtotime($record['DATE'])))
|
'DATE' => date(Config::get('ui_date_format', strtotime($record['DATE'])))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$result['status'])
|
if (!$result['status'])
|
||||||
{
|
{
|
||||||
$this->errors[] = array($result['error_code'] => $result['error_message']);
|
$this->errors[] = array($result['error_code'] => $result['error_message']);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->reply($result['status'], $reply);
|
return $this->reply($result['status'], $reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add cron entry
|
* Add cron entry
|
||||||
*
|
*
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public function addExecute($request)
|
public function addExecute($request)
|
||||||
{
|
{
|
||||||
$r = new Request();
|
$r = new Request();
|
||||||
$_s = $r->getSpell();
|
$_s = $r->getSpell();
|
||||||
$_user = 'vesta';
|
$_user = 'vesta';
|
||||||
|
|
||||||
$params = array(
|
$params = array(
|
||||||
'USER' => $_user,
|
'USER' => $_user,
|
||||||
'MIN' => $_s['MIN'],
|
'MIN' => $_s['MIN'],
|
||||||
'HOUR' => $_s['HOUR'],
|
'HOUR' => $_s['HOUR'],
|
||||||
'DAY' => $_s['DAY'],
|
'DAY' => $_s['DAY'],
|
||||||
'MONTH' => $_s['MONTH'],
|
'MONTH' => $_s['MONTH'],
|
||||||
'WDAY' => $_s['WDAY'],
|
'WDAY' => $_s['WDAY'],
|
||||||
'CMD' => $_s['CMD']
|
'CMD' => $_s['CMD']
|
||||||
);
|
);
|
||||||
|
|
||||||
$result = Vesta::execute(Vesta::V_ADD_CRON_JOB, $params);
|
$result = Vesta::execute(Vesta::V_ADD_CRON_JOB, $params);
|
||||||
|
|
||||||
if ($_s['REPORTS'])
|
if ($_s['REPORTS'])
|
||||||
{
|
{
|
||||||
$result = array();
|
$result = array();
|
||||||
$result = Vesta::execute(Vesta::V_ADD_SYS_USER_REPORTS,
|
$result = Vesta::execute(Vesta::V_ADD_SYS_USER_REPORTS,
|
||||||
array('USER' => $_user));
|
array('USER' => $_user));
|
||||||
if (!$result['status'])
|
if (!$result['status'])
|
||||||
{
|
{
|
||||||
$this->status = FALSE;
|
$this->status = FALSE;
|
||||||
$this->errors['REPORTS'] = array($result['error_code'] => $result['error_message']);
|
$this->errors['REPORTS'] = array($result['error_code'] => $result['error_message']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$result['status'])
|
if (!$result['status'])
|
||||||
{
|
{
|
||||||
$this->errors[] = array($result['error_code'] => $result['error_message']);
|
$this->errors[] = array($result['error_code'] => $result['error_message']);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->reply($result['status'], $result['data']);
|
return $this->reply($result['status'], $result['data']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete cron entry
|
* Delete cron entry
|
||||||
*
|
*
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
function delExecute($request)
|
function delExecute($request)
|
||||||
{
|
{
|
||||||
$r = new Request();
|
$r = new Request();
|
||||||
$_s = $r->getSpell();
|
$_s = $r->getSpell();
|
||||||
$_user = 'vesta';
|
$_user = 'vesta';
|
||||||
|
|
||||||
$params = array(
|
$params = array(
|
||||||
'USER' => $_user,
|
'USER' => $_user,
|
||||||
'JOB' => $_s['JOB']
|
'JOB' => $_s['JOB']
|
||||||
);
|
);
|
||||||
$result = Vesta::execute(Vesta::V_DEL_CRON_JOB, $params);
|
$result = Vesta::execute(Vesta::V_DEL_CRON_JOB, $params);
|
||||||
|
|
||||||
if (!$result['status'])
|
if (!$result['status'])
|
||||||
{
|
{
|
||||||
$this->errors[] = array($result['error_code'] => $result['error_message']);
|
$this->errors[] = array($result['error_code'] => $result['error_message']);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->reply($result['status'], $result['data']);
|
return $this->reply($result['status'], $result['data']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change cron entry
|
* Change cron entry
|
||||||
*
|
*
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
function changeExecute($request)
|
function changeExecute($request)
|
||||||
{
|
{
|
||||||
$r = new Request();
|
$r = new Request();
|
||||||
$_s = $r->getSpell();
|
$_s = $r->getSpell();
|
||||||
$_old = $_s['old'];
|
$_old = $_s['old'];
|
||||||
$_new = $_s['new'];
|
$_new = $_s['new'];
|
||||||
|
|
||||||
$_user = 'vesta';
|
$_user = 'vesta';
|
||||||
$_JOB = $_new['JOB'];
|
$_JOB = $_new['JOB'];
|
||||||
|
|
||||||
$result = array();
|
$result = array();
|
||||||
$params = array(
|
$params = array(
|
||||||
'USER' => $_user,
|
'USER' => $_user,
|
||||||
'JOB' => $_JOB,
|
'JOB' => $_JOB,
|
||||||
'MIN' => $_new['MIN'],
|
'MIN' => $_new['MIN'],
|
||||||
'HOUR' => $_new['HOUR'],
|
'HOUR' => $_new['HOUR'],
|
||||||
'DAY' => $_new['DAY'],
|
'DAY' => $_new['DAY'],
|
||||||
'MONTH' => $_new['MONTH'],
|
'MONTH' => $_new['MONTH'],
|
||||||
'WDAY' => $_new['WDAY'],
|
'WDAY' => $_new['WDAY'],
|
||||||
'CMD' => $_new['CMD']
|
'CMD' => $_new['CMD']
|
||||||
);
|
);
|
||||||
|
|
||||||
$result = Vesta::execute(Vesta::V_CHANGE_CRON_JOB, $params);
|
$result = Vesta::execute(Vesta::V_CHANGE_CRON_JOB, $params);
|
||||||
|
|
||||||
if (!$result['status'])
|
if (!$result['status'])
|
||||||
{
|
{
|
||||||
$this->errors[] = array($result['error_code'] => $result['error_message']);
|
$this->errors[] = array($result['error_code'] => $result['error_message']);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->reply($result['status'], $result['data']);
|
return $this->reply($result['status'], $result['data']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Suspend cron entry
|
* Suspend cron entry
|
||||||
*
|
*
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
function suspendExecute($request)
|
function suspendExecute($request)
|
||||||
{
|
{
|
||||||
$r = new Request();
|
$r = new Request();
|
||||||
$_s = $r->getSpell();
|
$_s = $r->getSpell();
|
||||||
|
|
||||||
$_user = 'vesta';
|
$_user = 'vesta';
|
||||||
$_JOB = $_s['JOB'];
|
$_JOB = $_s['JOB'];
|
||||||
|
|
||||||
$params = array(
|
$params = array(
|
||||||
'USER' => $_user,
|
'USER' => $_user,
|
||||||
'JOB' => $_JOB
|
'JOB' => $_JOB
|
||||||
);
|
);
|
||||||
|
|
||||||
$result = Vesta::execute(Vesta::V_SUSPEND_CRON_JOB, $params);
|
$result = Vesta::execute(Vesta::V_SUSPEND_CRON_JOB, $params);
|
||||||
if (!$result['status'])
|
if (!$result['status'])
|
||||||
{
|
{
|
||||||
$this->errors[] = array($result['error_code'] => $result['error_message']);
|
$this->errors[] = array($result['error_code'] => $result['error_message']);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->reply($result['status'], $result['data']);
|
return $this->reply($result['status'], $result['data']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unsuspend cron entry
|
* Unsuspend cron entry
|
||||||
*
|
*
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
function unsuspendExecute($request)
|
function unsuspendExecute($request)
|
||||||
{
|
{
|
||||||
$r = new Request();
|
$r = new Request();
|
||||||
$_s = $r->getSpell();
|
$_s = $r->getSpell();
|
||||||
|
|
||||||
$_user = 'vesta';
|
$_user = 'vesta';
|
||||||
$_JOB = $_s['JOB'];
|
$_JOB = $_s['JOB'];
|
||||||
|
|
||||||
$params = array(
|
$params = array(
|
||||||
'USER' => $_user,
|
'USER' => $_user,
|
||||||
'JOB' => $_JOB
|
'JOB' => $_JOB
|
||||||
);
|
);
|
||||||
|
|
||||||
$result = Vesta::execute(Vesta::V_UNSUSPEND_CRON_JOB, $params);
|
$result = Vesta::execute(Vesta::V_UNSUSPEND_CRON_JOB, $params);
|
||||||
|
|
||||||
if (!$result['status'])
|
if (!$result['status'])
|
||||||
{
|
{
|
||||||
$this->errors[] = array($result['error_code'] => $result['error_message']);
|
$this->errors[] = array($result['error_code'] => $result['error_message']);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->reply($result['status'], $result['data']);
|
return $this->reply($result['status'], $result['data']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Batch suspend cron entries
|
* Batch suspend cron entries
|
||||||
*
|
*
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
function suspendAllExecute($request)
|
function suspendAllExecute($request)
|
||||||
{
|
{
|
||||||
$r = new Request();
|
$r = new Request();
|
||||||
$_s = $r->getSpell();
|
$_s = $r->getSpell();
|
||||||
|
|
||||||
$_user = 'vesta';
|
$_user = 'vesta';
|
||||||
$_JOB = $_s['JOB'];
|
$_JOB = $_s['JOB'];
|
||||||
|
|
||||||
$params = array(
|
$params = array(
|
||||||
'USER' => $_user
|
'USER' => $_user
|
||||||
);
|
);
|
||||||
|
|
||||||
$result = Vesta::execute(Vesta::V_SUSPEND_CRON_JOBS, $params);
|
$result = Vesta::execute(Vesta::V_SUSPEND_CRON_JOBS, $params);
|
||||||
|
|
||||||
if (!$result['status'])
|
if (!$result['status'])
|
||||||
{
|
{
|
||||||
$this->errors[] = array($result['error_code'] => $result['error_message']);
|
$this->errors[] = array($result['error_code'] => $result['error_message']);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->reply($result['status'], $result['data']);
|
return $this->reply($result['status'], $result['data']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Batch suspend cron entry
|
* Batch suspend cron entry
|
||||||
*
|
*
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
function unsuspendAllExecute($request)
|
function unsuspendAllExecute($request)
|
||||||
{
|
{
|
||||||
$r = new Request();
|
$r = new Request();
|
||||||
$_s = $r->getSpell();
|
$_s = $r->getSpell();
|
||||||
|
|
||||||
$_user = 'vesta';
|
$_user = 'vesta';
|
||||||
|
|
||||||
$params = array(
|
$params = array(
|
||||||
'USER' => $_user
|
'USER' => $_user
|
||||||
);
|
);
|
||||||
|
|
||||||
$result = Vesta::execute(Vesta::V_UNSUSPEND_CRON_JOBS, $params);
|
$result = Vesta::execute(Vesta::V_UNSUSPEND_CRON_JOBS, $params);
|
||||||
|
|
||||||
if (!$result['status'])
|
if (!$result['status'])
|
||||||
{
|
{
|
||||||
$this->errors[] = array($result['error_code'] => $result['error_message']);
|
$this->errors[] = array($result['error_code'] => $result['error_message']);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->reply($result['status'], $result['data']);
|
return $this->reply($result['status'], $result['data']);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,240 +10,240 @@
|
||||||
*/
|
*/
|
||||||
class DB extends AjaxHandler
|
class DB extends AjaxHandler
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List entries
|
* List entries
|
||||||
*
|
*
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public function getListExecute($request)
|
public function getListExecute($request)
|
||||||
{
|
{
|
||||||
$_user = 'vesta';
|
$_user = 'vesta';
|
||||||
$reply = array();
|
$reply = array();
|
||||||
$result = Vesta::execute(Vesta::V_LIST_DB_BASES, array($_user, Config::get('response_type')));
|
$result = Vesta::execute(Vesta::V_LIST_DB_BASES, array($_user, Config::get('response_type')));
|
||||||
|
|
||||||
foreach ($result['data'] as $db => $record)
|
foreach ($result['data'] as $db => $record)
|
||||||
{
|
{
|
||||||
$reply[$db] = array(
|
$reply[$db] = array(
|
||||||
'DB' => $db,
|
'DB' => $db,
|
||||||
'USER' => $record['USER'],
|
'USER' => $record['USER'],
|
||||||
'HOST' => $record['HOST'],
|
'HOST' => $record['HOST'],
|
||||||
'TYPE' => $record['TYPE'],
|
'TYPE' => $record['TYPE'],
|
||||||
'U_DISK' => $record['U_DISK'],
|
'U_DISK' => $record['U_DISK'],
|
||||||
'SUSPEND' => $record['SUSPEND'],
|
'SUSPEND' => $record['SUSPEND'],
|
||||||
'DATE' => date(Config::get('ui_date_format', strtotime($record['DATE'])))
|
'DATE' => date(Config::get('ui_date_format', strtotime($record['DATE'])))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$result['status'])
|
if (!$result['status'])
|
||||||
{
|
{
|
||||||
$this->errors[] = array($result['error_code'] => $result['error_message']);
|
$this->errors[] = array($result['error_code'] => $result['error_message']);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->reply($result['status'], $reply);
|
return $this->reply($result['status'], $reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add entry
|
* Add entry
|
||||||
*
|
*
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public function addExecute($request)
|
public function addExecute($request)
|
||||||
{
|
{
|
||||||
$r = new Request();
|
$r = new Request();
|
||||||
$_s = $r->getSpell();
|
$_s = $r->getSpell();
|
||||||
$_user = 'vesta';
|
$_user = 'vesta';
|
||||||
|
|
||||||
$params = array(
|
$params = array(
|
||||||
'USER' => $_user,
|
'USER' => $_user,
|
||||||
'DB' => $_s['DB'],
|
'DB' => $_s['DB'],
|
||||||
'DB_USER' => $_s['DB_USER'],
|
'DB_USER' => $_s['DB_USER'],
|
||||||
'DB_PASSWORD' => $_s['DB_PASSWORD'],
|
'DB_PASSWORD' => $_s['DB_PASSWORD'],
|
||||||
'TYPE' => $_s['TYPE']
|
'TYPE' => $_s['TYPE']
|
||||||
);
|
);
|
||||||
if ($_s['HOST'])
|
if ($_s['HOST'])
|
||||||
{
|
{
|
||||||
$params['HOST'] = $_s['HOST'];
|
$params['HOST'] = $_s['HOST'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = Vesta::execute(Vesta::V_ADD_DB_BASE, $params);
|
$result = Vesta::execute(Vesta::V_ADD_DB_BASE, $params);
|
||||||
|
|
||||||
if (!$result['status'])
|
if (!$result['status'])
|
||||||
{
|
{
|
||||||
$this->errors[] = array($result['error_code'] => $result['error_message']);
|
$this->errors[] = array($result['error_code'] => $result['error_message']);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->reply($result['status'], $result['data']);
|
return $this->reply($result['status'], $result['data']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete entry
|
* Delete entry
|
||||||
*
|
*
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public function delExecute($request)
|
public function delExecute($request)
|
||||||
{
|
{
|
||||||
$r = new Request();
|
$r = new Request();
|
||||||
$_s = $r->getSpell();
|
$_s = $r->getSpell();
|
||||||
$_user = 'vesta';
|
$_user = 'vesta';
|
||||||
|
|
||||||
$params = array(
|
$params = array(
|
||||||
'USER' => $_user,
|
'USER' => $_user,
|
||||||
'DB' => $_user.'_'.$_s['DB']
|
'DB' => $_user.'_'.$_s['DB']
|
||||||
);
|
);
|
||||||
|
|
||||||
$result = Vesta::execute(Vesta::V_DEL_DB_BASE, $params);
|
$result = Vesta::execute(Vesta::V_DEL_DB_BASE, $params);
|
||||||
|
|
||||||
if (!$result['status'])
|
if (!$result['status'])
|
||||||
{
|
{
|
||||||
$this->errors[] = array($result['error_code'] => $result['error_message']);
|
$this->errors[] = array($result['error_code'] => $result['error_message']);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->reply($result['status'], $result['data']);
|
return $this->reply($result['status'], $result['data']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change password
|
* Change password
|
||||||
*
|
*
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public function changePasswordExecute($request)
|
public function changePasswordExecute($request)
|
||||||
{
|
{
|
||||||
$r = new Request();
|
$r = new Request();
|
||||||
$_s = $r->getSpell();
|
$_s = $r->getSpell();
|
||||||
|
|
||||||
$_user = 'vesta';
|
$_user = 'vesta';
|
||||||
|
|
||||||
$result = array();
|
$result = array();
|
||||||
$params = array(
|
$params = array(
|
||||||
'USER' => $_user,
|
'USER' => $_user,
|
||||||
'DB' => $_user.'_'.$_s['DB'],
|
'DB' => $_user.'_'.$_s['DB'],
|
||||||
'PASSWORD' => $_s['DB_PASSWORD']
|
'PASSWORD' => $_s['DB_PASSWORD']
|
||||||
);
|
);
|
||||||
|
|
||||||
$result = Vesta::execute(Vesta::V_CHANGE_DB_PASSWORD, $params);
|
$result = Vesta::execute(Vesta::V_CHANGE_DB_PASSWORD, $params);
|
||||||
|
|
||||||
if (!$result['status'])
|
if (!$result['status'])
|
||||||
{
|
{
|
||||||
$this->errors[] = array($result['error_code'] => $result['error_message']);
|
$this->errors[] = array($result['error_code'] => $result['error_message']);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->reply($result['status'], $result['data']);
|
return $this->reply($result['status'], $result['data']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* suspend user
|
* suspend user
|
||||||
*
|
*
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public function suspendExecute($request)
|
public function suspendExecute($request)
|
||||||
{
|
{
|
||||||
$r = new Request();
|
$r = new Request();
|
||||||
$_s = $r->getSpell();
|
$_s = $r->getSpell();
|
||||||
|
|
||||||
$_user = 'vesta';
|
$_user = 'vesta';
|
||||||
|
|
||||||
$params = array(
|
$params = array(
|
||||||
'USER' => $_user,
|
'USER' => $_user,
|
||||||
'DB' => $_user.'_'.$_s['DB']
|
'DB' => $_user.'_'.$_s['DB']
|
||||||
);
|
);
|
||||||
|
|
||||||
$result = Vesta::execute(Vesta::V_SUSPEND_DB_BASE, $params);
|
$result = Vesta::execute(Vesta::V_SUSPEND_DB_BASE, $params);
|
||||||
|
|
||||||
if (!$result['status'])
|
if (!$result['status'])
|
||||||
{
|
{
|
||||||
$this->errors[] = array($result['error_code'] => $result['error_message']);
|
$this->errors[] = array($result['error_code'] => $result['error_message']);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->reply($result['status'], $result['data']);
|
return $this->reply($result['status'], $result['data']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* unsuspend entry
|
* unsuspend entry
|
||||||
*
|
*
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public function unsuspendExecute($request)
|
public function unsuspendExecute($request)
|
||||||
{
|
{
|
||||||
$r = new Request();
|
$r = new Request();
|
||||||
$_s = $r->getSpell();
|
$_s = $r->getSpell();
|
||||||
|
|
||||||
$_user = 'vesta';
|
$_user = 'vesta';
|
||||||
|
|
||||||
$params = array(
|
$params = array(
|
||||||
'USER' => $_user,
|
'USER' => $_user,
|
||||||
'DB' => $_user.'_'.$_s['DB']
|
'DB' => $_user.'_'.$_s['DB']
|
||||||
);
|
);
|
||||||
|
|
||||||
$result = Vesta::execute(Vesta::V_UNSUSPEND_DB_BASE, $params);
|
$result = Vesta::execute(Vesta::V_UNSUSPEND_DB_BASE, $params);
|
||||||
|
|
||||||
if (!$result['status'])
|
if (!$result['status'])
|
||||||
{
|
{
|
||||||
$this->errors[] = array($result['error_code'] => $result['error_message']);
|
$this->errors[] = array($result['error_code'] => $result['error_message']);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->reply($result['status'], $result['data']);
|
return $this->reply($result['status'], $result['data']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Batch suspend entries
|
* Batch suspend entries
|
||||||
*
|
*
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public function suspendAllExecute($request)
|
public function suspendAllExecute($request)
|
||||||
{
|
{
|
||||||
$r = new Request();
|
$r = new Request();
|
||||||
$_s = $r->getSpell();
|
$_s = $r->getSpell();
|
||||||
|
|
||||||
$_user = 'vesta';
|
$_user = 'vesta';
|
||||||
$_JOB = $_s['JOB'];
|
$_JOB = $_s['JOB'];
|
||||||
|
|
||||||
$params = array(
|
$params = array(
|
||||||
'USER' => $_user
|
'USER' => $_user
|
||||||
);
|
);
|
||||||
|
|
||||||
$result = Vesta::execute(Vesta::V_SUSPEND_DB_BASES, $params);
|
$result = Vesta::execute(Vesta::V_SUSPEND_DB_BASES, $params);
|
||||||
|
|
||||||
if (!$result['status'])
|
if (!$result['status'])
|
||||||
{
|
{
|
||||||
$this->errors[] = array($result['error_code'] => $result['error_message']);
|
$this->errors[] = array($result['error_code'] => $result['error_message']);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->reply($result['status'], $result['data']);
|
return $this->reply($result['status'], $result['data']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Batch unsuspend entries
|
* Batch unsuspend entries
|
||||||
*
|
*
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public function unsuspendAllExecute($request)
|
public function unsuspendAllExecute($request)
|
||||||
{
|
{
|
||||||
$r = new Request();
|
$r = new Request();
|
||||||
$_s = $r->getSpell();
|
$_s = $r->getSpell();
|
||||||
|
|
||||||
$_user = 'vesta';
|
$_user = 'vesta';
|
||||||
|
|
||||||
$params = array(
|
$params = array(
|
||||||
'USER' => $_user
|
'USER' => $_user
|
||||||
);
|
);
|
||||||
|
|
||||||
$result = Vesta::execute(Vesta::V_UNSUSPEND_DB_BASES, $params);
|
$result = Vesta::execute(Vesta::V_UNSUSPEND_DB_BASES, $params);
|
||||||
|
|
||||||
if (!$result['status'])
|
if (!$result['status'])
|
||||||
{
|
{
|
||||||
$this->errors[] = array($result['error_code'] => $result['error_message']);
|
$this->errors[] = array($result['error_code'] => $result['error_message']);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->reply($result['status'], $result['data']);
|
return $this->reply($result['status'], $result['data']);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,349 +11,349 @@
|
||||||
class DNS extends AjaxHandler
|
class DNS extends AjaxHandler
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* list entries
|
* list entries
|
||||||
*
|
*
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public function getListExecute($request) {
|
public function getListExecute($request) {
|
||||||
$_user = 'vesta';
|
$_user = 'vesta';
|
||||||
$reply = array();
|
$reply = array();
|
||||||
|
|
||||||
$result = Vesta::execute(Vesta::V_LIST_DNS_DOMAINS, array($_user, Config::get('response_type')));
|
$result = Vesta::execute(Vesta::V_LIST_DNS_DOMAINS, array($_user, Config::get('response_type')));
|
||||||
foreach ($result['data'] as $dns_domain => $details)
|
foreach ($result['data'] as $dns_domain => $details)
|
||||||
{
|
{
|
||||||
$reply[] = array(
|
$reply[] = array(
|
||||||
'DNS_DOMAIN' => $dns_domain,
|
'DNS_DOMAIN' => $dns_domain,
|
||||||
'IP' => $details['IP'],
|
'IP' => $details['IP'],
|
||||||
'TPL' => $details['TPL'],
|
'TPL' => $details['TPL'],
|
||||||
'TTL' => $details['TTL'],
|
'TTL' => $details['TTL'],
|
||||||
'EXP' => $details['EXP'],
|
'EXP' => $details['EXP'],
|
||||||
'SOA' => $details['SOA'],
|
'SOA' => $details['SOA'],
|
||||||
'SUSPEND' => $details['SUSPEND'],
|
'SUSPEND' => $details['SUSPEND'],
|
||||||
'DATE' => date(Config::get('ui_date_format', strtotime($details['DATE'])))
|
'DATE' => date(Config::get('ui_date_format', strtotime($details['DATE'])))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (!$result['status'])
|
if (!$result['status'])
|
||||||
{
|
{
|
||||||
$this->errors[] = array($result['error_code'] => $result['error_message']);
|
$this->errors[] = array($result['error_code'] => $result['error_message']);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->reply($result['status'], $reply);
|
return $this->reply($result['status'], $reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List records of entries
|
* List records of entries
|
||||||
*
|
*
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public function getListRecordsExecute($request)
|
public function getListRecordsExecute($request)
|
||||||
{
|
{
|
||||||
$r = new Request();
|
$r = new Request();
|
||||||
$_s = $r->getSpell();
|
$_s = $r->getSpell();
|
||||||
$_user = 'vesta';
|
$_user = 'vesta';
|
||||||
|
|
||||||
$reply = array();
|
$reply = array();
|
||||||
|
|
||||||
$result = Vesta::execute(Vesta::V_LIST_DNS_DOMAIN_RECORDS, array($_user, $_s['DNS_DOMAIN'], Config::get('response_type')));
|
$result = Vesta::execute(Vesta::V_LIST_DNS_DOMAIN_RECORDS, array($_user, $_s['DNS_DOMAIN'], Config::get('response_type')));
|
||||||
foreach ($result['data'] as $record_id => $details)
|
foreach ($result['data'] as $record_id => $details)
|
||||||
{
|
{
|
||||||
$reply[$record_id] = array(
|
$reply[$record_id] = array(
|
||||||
'RECORD_ID' => $record_id,
|
'RECORD_ID' => $record_id,
|
||||||
'RECORD' => $details['RECORD'],
|
'RECORD' => $details['RECORD'],
|
||||||
'RECORD_TYPE' => $details['TYPE'],
|
'RECORD_TYPE' => $details['TYPE'],
|
||||||
'RECORD_VALUE' => $details['VALUE'],
|
'RECORD_VALUE' => $details['VALUE'],
|
||||||
'SUSPEND' => $details['SUSPEND'],
|
'SUSPEND' => $details['SUSPEND'],
|
||||||
'DATE' => date(Config::get('ui_date_format', strtotime($details['DATE'])))
|
'DATE' => date(Config::get('ui_date_format', strtotime($details['DATE'])))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$result['status'])
|
if (!$result['status'])
|
||||||
{
|
{
|
||||||
$this->errors[] = array($result['error_code'] => $result['error_message']);
|
$this->errors[] = array($result['error_code'] => $result['error_message']);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->reply($result['status'], $reply);
|
return $this->reply($result['status'], $reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add entry
|
* Add entry
|
||||||
*
|
*
|
||||||
* v_add_dns_domain user domain ip [template] [exp] [soa] [ttl]
|
* v_add_dns_domain user domain ip [template] [exp] [soa] [ttl]
|
||||||
* http://95.163.16.160:8083/dispatch.php?jedi_method=DNS.add&USER=vesta&DOMAIN=dev.vestacp.com&IP_ADDRESS=95.163.16.160&TEMPLATE=default&EXP=01-01-12&SOA=ns1.vestacp.com&TTL=3600
|
* http://95.163.16.160:8083/dispatch.php?jedi_method=DNS.add&USER=vesta&DOMAIN=dev.vestacp.com&IP_ADDRESS=95.163.16.160&TEMPLATE=default&EXP=01-01-12&SOA=ns1.vestacp.com&TTL=3600
|
||||||
*
|
*
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public function addExecute($_spell = false)
|
public function addExecute($_spell = false)
|
||||||
{
|
{
|
||||||
$r = new Request();
|
$r = new Request();
|
||||||
if ($_spell)
|
if ($_spell)
|
||||||
{
|
{
|
||||||
$_s = $_spell;
|
$_s = $_spell;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$_s = $r->getSpell();
|
$_s = $r->getSpell();
|
||||||
}
|
}
|
||||||
|
|
||||||
$_user = 'vesta';
|
$_user = 'vesta';
|
||||||
$params = array(
|
$params = array(
|
||||||
'USER' => $_user, // TODO: examine if OWNER ???
|
'USER' => $_user, // TODO: examine if OWNER ???
|
||||||
'DNS_DOMAIN' => $_s['DNS_DOMAIN'],
|
'DNS_DOMAIN' => $_s['DNS_DOMAIN'],
|
||||||
'IP' => $_s['IP']
|
'IP' => $_s['IP']
|
||||||
);
|
);
|
||||||
($_s['TPL']) ? $params['TPL'] = $_s['TPL'] : -1;
|
($_s['TPL']) ? $params['TPL'] = $_s['TPL'] : -1;
|
||||||
($_s['EXP']) ? $params['EXP'] = $_s['EXP'] : -1;
|
($_s['EXP']) ? $params['EXP'] = $_s['EXP'] : -1;
|
||||||
($_s['SOA']) ? $params['SOA'] = $_s['SOA'] : -1;
|
($_s['SOA']) ? $params['SOA'] = $_s['SOA'] : -1;
|
||||||
($_s['TTL']) ? $params['TTL'] = $_s['TTL'] : -1;
|
($_s['TTL']) ? $params['TTL'] = $_s['TTL'] : -1;
|
||||||
|
|
||||||
$result = Vesta::execute(Vesta::V_ADD_DNS_DOMAIN, $params);
|
$result = Vesta::execute(Vesta::V_ADD_DNS_DOMAIN, $params);
|
||||||
if (!$result['status'])
|
if (!$result['status'])
|
||||||
{
|
{
|
||||||
$this->errors[] = array($result['error_code'] => $result['error_message']);
|
$this->errors[] = array($result['error_code'] => $result['error_message']);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->reply($result['status'], $result['data']);
|
return $this->reply($result['status'], $result['data']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add record
|
* Add record
|
||||||
*
|
*
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public function addRecordExecute($request)
|
public function addRecordExecute($request)
|
||||||
{
|
{
|
||||||
$r = new Request();
|
$r = new Request();
|
||||||
$_s = $r->getSpell();
|
$_s = $r->getSpell();
|
||||||
$_user = 'vesta';
|
$_user = 'vesta';
|
||||||
|
|
||||||
$params = array(
|
$params = array(
|
||||||
'USER' => $_s['USER'], // TODO: find out if it's OWNER ???
|
'USER' => $_s['USER'], // TODO: find out if it's OWNER ???
|
||||||
'DOMAIN' => $_s['DOMAIN'],
|
'DOMAIN' => $_s['DOMAIN'],
|
||||||
'RECORD' => $_s['RECORD'],
|
'RECORD' => $_s['RECORD'],
|
||||||
'RECORD_TYPE' => $_s['TYPE'],
|
'RECORD_TYPE' => $_s['TYPE'],
|
||||||
'RECORD_VALUE' => $_s['VALUE'],
|
'RECORD_VALUE' => $_s['VALUE'],
|
||||||
'RECORD_ID' => $_s['RECORD_ID']
|
'RECORD_ID' => $_s['RECORD_ID']
|
||||||
);
|
);
|
||||||
|
|
||||||
$result = Vesta::execute(Vesta::V_ADD_DNS_DOMAIN_RECORD, $params);
|
$result = Vesta::execute(Vesta::V_ADD_DNS_DOMAIN_RECORD, $params);
|
||||||
|
|
||||||
if (!$result['status'])
|
if (!$result['status'])
|
||||||
{
|
{
|
||||||
$this->errors[] = array($result['error_code'] => $result['error_message']);
|
$this->errors[] = array($result['error_code'] => $result['error_message']);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->reply($result['status'], $result['data']);
|
return $this->reply($result['status'], $result['data']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete entry
|
* Delete entry
|
||||||
*
|
*
|
||||||
* @param mixed $_spell
|
* @param mixed $_spell
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public function delExecute($_spell = false)
|
public function delExecute($_spell = false)
|
||||||
{
|
{
|
||||||
$r = new Request();
|
$r = new Request();
|
||||||
if ($_spell)
|
if ($_spell)
|
||||||
{
|
{
|
||||||
$_s = $_spell;
|
$_s = $_spell;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$_s = $r->getSpell();
|
$_s = $r->getSpell();
|
||||||
}
|
}
|
||||||
|
|
||||||
$_user = 'vesta';
|
$_user = 'vesta';
|
||||||
$params = array(
|
$params = array(
|
||||||
'USER' => $_user, // TODO: find out -> OWNER ???
|
'USER' => $_user, // TODO: find out -> OWNER ???
|
||||||
'DOMAIN' => $_s['DNS_DOMAIN'],
|
'DOMAIN' => $_s['DNS_DOMAIN'],
|
||||||
);
|
);
|
||||||
|
|
||||||
$result = Vesta::execute(Vesta::V_DEL_DNS_DOMAIN, $params);
|
$result = Vesta::execute(Vesta::V_DEL_DNS_DOMAIN, $params);
|
||||||
|
|
||||||
if (!$result['status'])
|
if (!$result['status'])
|
||||||
{
|
{
|
||||||
$this->errors[] = array($result['error_code'] => $result['error_message']);
|
$this->errors[] = array($result['error_code'] => $result['error_message']);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->reply($result['status'], $result['data']);
|
return $this->reply($result['status'], $result['data']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete record
|
* Delete record
|
||||||
*
|
*
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
function delRecordExecute($request)
|
function delRecordExecute($request)
|
||||||
{
|
{
|
||||||
$r = new Request();
|
$r = new Request();
|
||||||
$_s = $r->getSpell();
|
$_s = $r->getSpell();
|
||||||
$_user = 'vesta';
|
$_user = 'vesta';
|
||||||
|
|
||||||
$params = array(
|
$params = array(
|
||||||
'USER' => $_user, // TODO: find out if -> OWNER ???
|
'USER' => $_user, // TODO: find out if -> OWNER ???
|
||||||
'DOMAIN' => $_s['DOMAIN'],
|
'DOMAIN' => $_s['DOMAIN'],
|
||||||
'RECORD_ID' => $_s['RECORD_ID']
|
'RECORD_ID' => $_s['RECORD_ID']
|
||||||
);
|
);
|
||||||
|
|
||||||
$result = Vesta::execute(Vesta::V_DEL_DNS_DOMAIN_RECORD, $params);
|
$result = Vesta::execute(Vesta::V_DEL_DNS_DOMAIN_RECORD, $params);
|
||||||
|
|
||||||
if (!$result['status'])
|
if (!$result['status'])
|
||||||
{
|
{
|
||||||
$this->errors[] = array($result['error_code'] => $result['error_message']);
|
$this->errors[] = array($result['error_code'] => $result['error_message']);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->reply($result['status'], $result['data']);
|
return $this->reply($result['status'], $result['data']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change entry
|
* Change entry
|
||||||
*
|
*
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public function changeExecute($request)
|
public function changeExecute($request)
|
||||||
{
|
{
|
||||||
$r = new Request();
|
$r = new Request();
|
||||||
$_s = $r->getSpell();
|
$_s = $r->getSpell();
|
||||||
$_old = $_s['old'];
|
$_old = $_s['old'];
|
||||||
$_new = $_s['new'];
|
$_new = $_s['new'];
|
||||||
|
|
||||||
$_user = 'vesta';
|
$_user = 'vesta';
|
||||||
|
|
||||||
$_DNS_DOMAIN = $_new['DNS_DOMAIN'];
|
$_DNS_DOMAIN = $_new['DNS_DOMAIN'];
|
||||||
|
|
||||||
|
|
||||||
if ($_old['IP'] != $_new['IP'])
|
if ($_old['IP'] != $_new['IP'])
|
||||||
{
|
{
|
||||||
$result = array();
|
$result = array();
|
||||||
$result = Vesta::execute(Vesta::V_CHANGE_DNS_DOMAIN_IP, array('USER' => $_user, 'DNS_DOMAIN' => $_DNS_DOMAIN, 'IP' => $_new['IP']));
|
$result = Vesta::execute(Vesta::V_CHANGE_DNS_DOMAIN_IP, array('USER' => $_user, 'DNS_DOMAIN' => $_DNS_DOMAIN, 'IP' => $_new['IP']));
|
||||||
if(!$result['status'])
|
if(!$result['status'])
|
||||||
{
|
{
|
||||||
$this->status = FALSE;
|
$this->status = FALSE;
|
||||||
$this->errors['IP_ADDRESS'] = array($result['error_code'] => $result['error_message']);
|
$this->errors['IP_ADDRESS'] = array($result['error_code'] => $result['error_message']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_old['TPL'] != $_new['TPL'])
|
if ($_old['TPL'] != $_new['TPL'])
|
||||||
{
|
{
|
||||||
$result = array();
|
$result = array();
|
||||||
$result = Vesta::execute(Vesta::V_CHANGE_DNS_DOMAIN_TPL, array('USER' => $_user, 'DNS_DOMAIN' => $_DNS_DOMAIN, 'IP' => $_new['TPL']));
|
$result = Vesta::execute(Vesta::V_CHANGE_DNS_DOMAIN_TPL, array('USER' => $_user, 'DNS_DOMAIN' => $_DNS_DOMAIN, 'IP' => $_new['TPL']));
|
||||||
if(!$result['status'])
|
if(!$result['status'])
|
||||||
{
|
{
|
||||||
$this->status = FALSE;
|
$this->status = FALSE;
|
||||||
$this->errors['TPL'] = array($result['error_code'] => $result['error_message']);
|
$this->errors['TPL'] = array($result['error_code'] => $result['error_message']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_old['TTL'] != $_new['TTL'])
|
if ($_old['TTL'] != $_new['TTL'])
|
||||||
{
|
{
|
||||||
$result = array();
|
$result = array();
|
||||||
$result = Vesta::execute(Vesta::V_CHANGE_DNS_DOMAIN_TTL, array('USER' => $_user, 'DNS_DOMAIN' => $_DNS_DOMAIN, 'IP' => $_new['TTL']));
|
$result = Vesta::execute(Vesta::V_CHANGE_DNS_DOMAIN_TTL, array('USER' => $_user, 'DNS_DOMAIN' => $_DNS_DOMAIN, 'IP' => $_new['TTL']));
|
||||||
if(!$result['status'])
|
if(!$result['status'])
|
||||||
{
|
{
|
||||||
$this->status = FALSE;
|
$this->status = FALSE;
|
||||||
$this->errors['TTL'] = array($result['error_code'] => $result['error_message']);
|
$this->errors['TTL'] = array($result['error_code'] => $result['error_message']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_old['EXP'] != $_new['EXP'])
|
if ($_old['EXP'] != $_new['EXP'])
|
||||||
{
|
{
|
||||||
$result = array();
|
$result = array();
|
||||||
$result = Vesta::execute(Vesta::V_CHANGE_DNS_DOMAIN_EXP, array('USER' => $_user, 'DNS_DOMAIN' => $_DNS_DOMAIN, 'IP' => $_new['EXP']));
|
$result = Vesta::execute(Vesta::V_CHANGE_DNS_DOMAIN_EXP, array('USER' => $_user, 'DNS_DOMAIN' => $_DNS_DOMAIN, 'IP' => $_new['EXP']));
|
||||||
if (!$result['status'])
|
if (!$result['status'])
|
||||||
{
|
{
|
||||||
$this->status = FALSE;
|
$this->status = FALSE;
|
||||||
$this->errors['EXP'] = array($result['error_code'] => $result['error_message']);
|
$this->errors['EXP'] = array($result['error_code'] => $result['error_message']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_old['SOA'] != $_new['SOA'])
|
if ($_old['SOA'] != $_new['SOA'])
|
||||||
{
|
{
|
||||||
$result = array();
|
$result = array();
|
||||||
$result = Vesta::execute(Vesta::V_CHANGE_DNS_DOMAIN_SOA, array('USER' => $_user, 'DNS_DOMAIN' => $_new['DNS_DOMAIN'], 'IP' => $_new['SOA']));
|
$result = Vesta::execute(Vesta::V_CHANGE_DNS_DOMAIN_SOA, array('USER' => $_user, 'DNS_DOMAIN' => $_new['DNS_DOMAIN'], 'IP' => $_new['SOA']));
|
||||||
if (!$result['status'])
|
if (!$result['status'])
|
||||||
{
|
{
|
||||||
$this->status = FALSE;
|
$this->status = FALSE;
|
||||||
$this->errors['SOA'] = array($result['error_code'] => $result['error_message']);
|
$this->errors['SOA'] = array($result['error_code'] => $result['error_message']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->status)
|
if (!$this->status)
|
||||||
{
|
{
|
||||||
Vesta::execute(Vesta::V_CHANGE_DNS_DOMAIN_IP, array('USER' => $_user, 'DNS_DOMAIN' => $_DNS_DOMAIN, 'IP' => $_old['IP']));
|
Vesta::execute(Vesta::V_CHANGE_DNS_DOMAIN_IP, array('USER' => $_user, 'DNS_DOMAIN' => $_DNS_DOMAIN, 'IP' => $_old['IP']));
|
||||||
Vesta::execute(Vesta::V_CHANGE_DNS_DOMAIN_TPL, array('USER' => $_user, 'DNS_DOMAIN' => $_DNS_DOMAIN, 'IP' => $_old['TPL']));
|
Vesta::execute(Vesta::V_CHANGE_DNS_DOMAIN_TPL, array('USER' => $_user, 'DNS_DOMAIN' => $_DNS_DOMAIN, 'IP' => $_old['TPL']));
|
||||||
Vesta::execute(Vesta::V_CHANGE_DNS_DOMAIN_TTL, array('USER' => $_user, 'DNS_DOMAIN' => $_DNS_DOMAIN, 'IP' => $_old['TTL']));
|
Vesta::execute(Vesta::V_CHANGE_DNS_DOMAIN_TTL, array('USER' => $_user, 'DNS_DOMAIN' => $_DNS_DOMAIN, 'IP' => $_old['TTL']));
|
||||||
Vesta::execute(Vesta::V_CHANGE_DNS_DOMAIN_EXP, array('USER' => $_user, 'DNS_DOMAIN' => $_DNS_DOMAIN, 'IP' => $_old['EXP']));
|
Vesta::execute(Vesta::V_CHANGE_DNS_DOMAIN_EXP, array('USER' => $_user, 'DNS_DOMAIN' => $_DNS_DOMAIN, 'IP' => $_old['EXP']));
|
||||||
Vesta::execute(Vesta::V_CHANGE_DNS_DOMAIN_SOA, array('USER' => $_user, 'DNS_DOMAIN' => $_new['DNS_DOMAIN'], 'IP' => $_old['SOA']));
|
Vesta::execute(Vesta::V_CHANGE_DNS_DOMAIN_SOA, array('USER' => $_user, 'DNS_DOMAIN' => $_new['DNS_DOMAIN'], 'IP' => $_old['SOA']));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->reply($this->status, '');
|
return $this->reply($this->status, '');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change record
|
* Change record
|
||||||
*
|
*
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public function changeRecordsExecute($request)
|
public function changeRecordsExecute($request)
|
||||||
{
|
{
|
||||||
$r = new Request();
|
$r = new Request();
|
||||||
$_s = $r->getSpell();
|
$_s = $r->getSpell();
|
||||||
$_old = $_s['old'];
|
$_old = $_s['old'];
|
||||||
$_new = $_s['new'];
|
$_new = $_s['new'];
|
||||||
$_user = 'vesta';
|
$_user = 'vesta';
|
||||||
$_DNS_DOMAIN = $_s['DNS_DOMAIN'];
|
$_DNS_DOMAIN = $_s['DNS_DOMAIN'];
|
||||||
|
|
||||||
foreach ($_new as $record_id => $record_data)
|
foreach ($_new as $record_id => $record_data)
|
||||||
{
|
{
|
||||||
// checking if record existed - update
|
// checking if record existed - update
|
||||||
if(is_array($_old[$record_id]))
|
if(is_array($_old[$record_id]))
|
||||||
{
|
{
|
||||||
// TODO: Remove this. is it necessary??!
|
// TODO: Remove this. is it necessary??!
|
||||||
echo '<br> updating'.$record_id;
|
echo '<br> updating'.$record_id;
|
||||||
|
|
||||||
$result = Vesta::execute(Vesta::V_CHANGE_DNS_DOMAIN_RECORD, array('USER' => $_user, 'DNS_DOMAIN' => $_DNS_DOMAIN, 'ID' => $record_id, 'RECORD' => $record_data['RECORD'], 'TYPE' => $record_data['RECORD_TYPE'], 'VALUE' => $record_data['RECORD_VALUE']));
|
$result = Vesta::execute(Vesta::V_CHANGE_DNS_DOMAIN_RECORD, array('USER' => $_user, 'DNS_DOMAIN' => $_DNS_DOMAIN, 'ID' => $record_id, 'RECORD' => $record_data['RECORD'], 'TYPE' => $record_data['RECORD_TYPE'], 'VALUE' => $record_data['RECORD_VALUE']));
|
||||||
if(!$result['status'])
|
if(!$result['status'])
|
||||||
{
|
{
|
||||||
$this->status = FALSE;
|
$this->status = FALSE;
|
||||||
$this->errors[$record_id] = array($result['error_code'] => $result['error_message']);
|
$this->errors[$record_id] = array($result['error_code'] => $result['error_message']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// record is new - add
|
// record is new - add
|
||||||
// TODO: Remove this. is it necessary??!
|
// TODO: Remove this. is it necessary??!
|
||||||
echo '<br> adding'.$record_id;
|
echo '<br> adding'.$record_id;
|
||||||
|
|
||||||
$result = Vesta::execute(Vesta::V_ADD_DNS_DOMAIN_RECORD, array('USER' => $_user, 'DNS_DOMAIN' => $_DNS_DOMAIN, 'RECORD' => $record_data['RECORD'], 'TYPE' => $record_data['RECORD_TYPE'], 'VALUE' => $record_data['RECORD_VALUE'], 'ID' => $record_id));
|
$result = Vesta::execute(Vesta::V_ADD_DNS_DOMAIN_RECORD, array('USER' => $_user, 'DNS_DOMAIN' => $_DNS_DOMAIN, 'RECORD' => $record_data['RECORD'], 'TYPE' => $record_data['RECORD_TYPE'], 'VALUE' => $record_data['RECORD_VALUE'], 'ID' => $record_id));
|
||||||
if(!$result['status'])
|
if(!$result['status'])
|
||||||
{
|
{
|
||||||
$this->status = FALSE;
|
$this->status = FALSE;
|
||||||
$this->errors[$record_id] = array($result['error_code'] => $result['error_message']);
|
$this->errors[$record_id] = array($result['error_code'] => $result['error_message']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unset($_old[$record_id]);
|
unset($_old[$record_id]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// in $_old have remained only record that do not present in new - so they have to be deleted
|
// in $_old have remained only record that do not present in new - so they have to be deleted
|
||||||
foreach ($_old as $record_id => $record_data)
|
foreach ($_old as $record_id => $record_data)
|
||||||
{
|
{
|
||||||
echo '<br> deleting'.$record_id;
|
echo '<br> deleting'.$record_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->reply($this->status, '');
|
return $this->reply($this->status, '');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -9,198 +9,198 @@
|
||||||
*/
|
*/
|
||||||
class IP extends AjaxHandler
|
class IP extends AjaxHandler
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* List entries
|
* List entries
|
||||||
*
|
*
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public function getListExecute($request)
|
public function getListExecute($request)
|
||||||
{
|
{
|
||||||
$reply = array();
|
$reply = array();
|
||||||
|
|
||||||
$result = Vesta::execute(Vesta::V_LIST_SYS_IPS, array(Config::get('response_type')));
|
$result = Vesta::execute(Vesta::V_LIST_SYS_IPS, array(Config::get('response_type')));
|
||||||
foreach ($result['data'] as $ip => $details)
|
foreach ($result['data'] as $ip => $details)
|
||||||
{
|
{
|
||||||
$reply[] = array_merge(array(
|
$reply[] = array_merge(array(
|
||||||
'IP_ADDRESS' => $ip,
|
'IP_ADDRESS' => $ip,
|
||||||
'DATE' => date(Config::get('ui_date_format', strtotime($details['DATE'])))
|
'DATE' => date(Config::get('ui_date_format', strtotime($details['DATE'])))
|
||||||
), $details);
|
), $details);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$result['status'])
|
if (!$result['status'])
|
||||||
{
|
{
|
||||||
$this->errors[] = array($result['error_code'] => $result['error_message']);
|
$this->errors[] = array($result['error_code'] => $result['error_message']);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->reply($result['status'], $reply);
|
return $this->reply($result['status'], $reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List user ips entries
|
* List user ips entries
|
||||||
*
|
*
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public function getListUserIpsExecute($request)
|
public function getListUserIpsExecute($request)
|
||||||
{
|
{
|
||||||
$reply = array();
|
$reply = array();
|
||||||
|
|
||||||
$result = Vesta::execute(Vesta::V_LIST_SYS_IPS, array(Config::get('response_type')));
|
$result = Vesta::execute(Vesta::V_LIST_SYS_IPS, array(Config::get('response_type')));
|
||||||
foreach ($result['data'] as $ip => $details)
|
foreach ($result['data'] as $ip => $details)
|
||||||
{
|
{
|
||||||
$reply[] = array_merge(array(
|
$reply[] = array_merge(array(
|
||||||
'IP_ADDRESS' => $ip,
|
'IP_ADDRESS' => $ip,
|
||||||
'DATE' => date(Config::get('ui_date_format', strtotime($details['DATE'])))
|
'DATE' => date(Config::get('ui_date_format', strtotime($details['DATE'])))
|
||||||
), $details);
|
), $details);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$result['status'])
|
if (!$result['status'])
|
||||||
{
|
{
|
||||||
$this->errors[] = array($result['error_code'] => $result['error_message']);
|
$this->errors[] = array($result['error_code'] => $result['error_message']);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->reply($result['status'], $reply);
|
return $this->reply($result['status'], $reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add entry
|
* Add entry
|
||||||
*
|
*
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public function addExecute($request)
|
public function addExecute($request)
|
||||||
{
|
{
|
||||||
$r = new Request();
|
$r = new Request();
|
||||||
$_s = $r->getSpell();
|
$_s = $r->getSpell();
|
||||||
$_user = 'vesta';
|
$_user = 'vesta';
|
||||||
|
|
||||||
$params = array(
|
$params = array(
|
||||||
'IP_ADDRESS' => $_s['IP_ADDRESS'],
|
'IP_ADDRESS' => $_s['IP_ADDRESS'],
|
||||||
'MASK' => $_s['MASK'],
|
'MASK' => $_s['MASK'],
|
||||||
'INTERFACE' => $_s['INTERFACE'],
|
'INTERFACE' => $_s['INTERFACE'],
|
||||||
'OWNER' => $_s['OWNER'],
|
'OWNER' => $_s['OWNER'],
|
||||||
'IP_STATUS' => $_s['IP_STATUS'],
|
'IP_STATUS' => $_s['IP_STATUS'],
|
||||||
'IP_NAME' => $_s['IP_NAME']
|
'IP_NAME' => $_s['IP_NAME']
|
||||||
);
|
);
|
||||||
|
|
||||||
$result = Vesta::execute(Vesta::V_ADD_SYS_IP, $params);
|
$result = Vesta::execute(Vesta::V_ADD_SYS_IP, $params);
|
||||||
|
|
||||||
|
|
||||||
if (!$result['status'])
|
if (!$result['status'])
|
||||||
{
|
{
|
||||||
$this->errors[] = array($result['error_code'] => $result['error_message']);
|
$this->errors[] = array($result['error_code'] => $result['error_message']);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->reply($result['status'], $result['data']);
|
return $this->reply($result['status'], $result['data']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete entry
|
* Delete entry
|
||||||
*
|
*
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public function delExecute($request)
|
public function delExecute($request)
|
||||||
{
|
{
|
||||||
$r = new Request();
|
$r = new Request();
|
||||||
$_s = $r->getSpell();
|
$_s = $r->getSpell();
|
||||||
$_user = 'vesta';
|
$_user = 'vesta';
|
||||||
|
|
||||||
$params = array(
|
$params = array(
|
||||||
'IP_ADDRESS' => $_s['IP_ADDRESS']
|
'IP_ADDRESS' => $_s['IP_ADDRESS']
|
||||||
);
|
);
|
||||||
|
|
||||||
$result = Vesta::execute(Vesta::V_DEL_SYS_IP, $params);
|
$result = Vesta::execute(Vesta::V_DEL_SYS_IP, $params);
|
||||||
|
|
||||||
if (!$result['status'])
|
if (!$result['status'])
|
||||||
{
|
{
|
||||||
$this->errors[] = array($result['error_code'] => $result['error_message']);
|
$this->errors[] = array($result['error_code'] => $result['error_message']);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->reply($result['status'], $result['data']);
|
return $this->reply($result['status'], $result['data']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change entry
|
* Change entry
|
||||||
*
|
*
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public function changeExecute($request)
|
public function changeExecute($request)
|
||||||
{
|
{
|
||||||
$r = new Request();
|
$r = new Request();
|
||||||
$_s = $r->getSpell();
|
$_s = $r->getSpell();
|
||||||
$_old = $_s['old'];
|
$_old = $_s['old'];
|
||||||
$_new = $_s['new'];
|
$_new = $_s['new'];
|
||||||
|
|
||||||
$_user = 'vesta';
|
$_user = 'vesta';
|
||||||
|
|
||||||
if ($_old['OWNER'] != $_new['OWNER'])
|
if ($_old['OWNER'] != $_new['OWNER'])
|
||||||
{
|
{
|
||||||
$result = array();
|
$result = array();
|
||||||
$result = Vesta::execute(Vesta::V_CHANGE_SYS_IP_OWNER, array('OWNER' => $_new['OWNER'], 'IP' => $_new['IP_ADDRESS']));
|
$result = Vesta::execute(Vesta::V_CHANGE_SYS_IP_OWNER, array('OWNER' => $_new['OWNER'], 'IP' => $_new['IP_ADDRESS']));
|
||||||
if(!$result['status'])
|
if(!$result['status'])
|
||||||
{
|
{
|
||||||
$this->status = FALSE;
|
$this->status = FALSE;
|
||||||
$this->errors['OWNER'] = array($result['error_code'] => $result['error_message']);
|
$this->errors['OWNER'] = array($result['error_code'] => $result['error_message']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_old['NAME'] != $_new['NAME'])
|
if ($_old['NAME'] != $_new['NAME'])
|
||||||
{
|
{
|
||||||
$result = array();
|
$result = array();
|
||||||
$result = Vesta::execute(Vesta::V_CHANGE_SYS_IP_NAME, array('IP' => $_new['IP_ADDRESS'], 'NAME' => $_new['NAME']));
|
$result = Vesta::execute(Vesta::V_CHANGE_SYS_IP_NAME, array('IP' => $_new['IP_ADDRESS'], 'NAME' => $_new['NAME']));
|
||||||
if (!$result['status'])
|
if (!$result['status'])
|
||||||
{
|
{
|
||||||
$this->status = FALSE;
|
$this->status = FALSE;
|
||||||
$this->errors['NAME'] = array($result['error_code'] => $result['error_message']);
|
$this->errors['NAME'] = array($result['error_code'] => $result['error_message']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_old['IP_STATUS'] != $_new['IP_STATUS'])
|
if ($_old['IP_STATUS'] != $_new['IP_STATUS'])
|
||||||
{
|
{
|
||||||
$result = array();
|
$result = array();
|
||||||
$result = Vesta::execute(Vesta::V_CHANGE_SYS_IP_STATUS, array('IP' => $_new['IP_ADDRESS'], 'IP_STATUS' => $_new['IP_STATUS']));
|
$result = Vesta::execute(Vesta::V_CHANGE_SYS_IP_STATUS, array('IP' => $_new['IP_ADDRESS'], 'IP_STATUS' => $_new['IP_STATUS']));
|
||||||
if (!$result['status'])
|
if (!$result['status'])
|
||||||
{
|
{
|
||||||
$this->status = FALSE;
|
$this->status = FALSE;
|
||||||
$this->errors['IP_STATUS'] = array($result['error_code'] => $result['error_message']);
|
$this->errors['IP_STATUS'] = array($result['error_code'] => $result['error_message']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!$result['status'])
|
if (!$result['status'])
|
||||||
{
|
{
|
||||||
$this->errors[] = array($result['error_code'] => $result['error_message']);
|
$this->errors[] = array($result['error_code'] => $result['error_message']);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->reply($result['status'], $result['data']);
|
return $this->reply($result['status'], $result['data']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get sys interfaces
|
* Get sys interfaces
|
||||||
*
|
*
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public function getSysInterfacesExecute($request)
|
public function getSysInterfacesExecute($request)
|
||||||
{
|
{
|
||||||
$reply = array();
|
$reply = array();
|
||||||
|
|
||||||
$result = Vesta::execute(Vesta::V_LIST_SYS_INTERFACES, array(Config::get('response_type')));
|
$result = Vesta::execute(Vesta::V_LIST_SYS_INTERFACES, array(Config::get('response_type')));
|
||||||
|
|
||||||
foreach ($result['data'] as $iface)
|
foreach ($result['data'] as $iface)
|
||||||
{
|
{
|
||||||
$reply[$iface] = $iface;
|
$reply[$iface] = $iface;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$result['status'])
|
if (!$result['status'])
|
||||||
{
|
{
|
||||||
$this->errors[] = array($result['error_code'] => $result['error_message']);
|
$this->errors[] = array($result['error_code'] => $result['error_message']);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->reply($result['status'], $reply);
|
return $this->reply($result['status'], $reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,116 +16,116 @@
|
||||||
*/
|
*/
|
||||||
class MAIN extends AjaxHandler
|
class MAIN extends AjaxHandler
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get version
|
* Get version
|
||||||
*
|
*
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public function versionExecute($request)
|
public function versionExecute($request)
|
||||||
{
|
{
|
||||||
$result = array(
|
$result = array(
|
||||||
'version' => '1.0',
|
'version' => '1.0',
|
||||||
'author' => 'http://vestacp.com/',
|
'author' => 'http://vestacp.com/',
|
||||||
'docs' => 'http://vestacp.com/docs'
|
'docs' => 'http://vestacp.com/docs'
|
||||||
);
|
);
|
||||||
|
|
||||||
return $this->reply(true, $result);
|
return $this->reply(true, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get initial params
|
* Get initial params
|
||||||
*
|
*
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public function getInitialExecute($request)
|
public function getInitialExecute($request)
|
||||||
{
|
{
|
||||||
require_once V_ROOT_DIR . 'api/IP.class.php';
|
require_once V_ROOT_DIR . 'api/IP.class.php';
|
||||||
require_once V_ROOT_DIR . 'api/USER.class.php';
|
require_once V_ROOT_DIR . 'api/USER.class.php';
|
||||||
|
|
||||||
$ip_obj = new IP();
|
$ip_obj = new IP();
|
||||||
$user_obj = new USER();
|
$user_obj = new USER();
|
||||||
|
|
||||||
$user_ips = json_decode($ip_obj->getListUserIpsExecute(), TRUE);
|
$user_ips = json_decode($ip_obj->getListUserIpsExecute(), TRUE);
|
||||||
foreach ($user_ips['data'] as $ip)
|
foreach ($user_ips['data'] as $ip)
|
||||||
{
|
{
|
||||||
$ips[$ip['IP_ADDRESS']] = $ip['IP_ADDRESS'];
|
$ips[$ip['IP_ADDRESS']] = $ip['IP_ADDRESS'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$users = json_decode($user_obj->getListExecute(), TRUE);
|
$users = json_decode($user_obj->getListExecute(), TRUE);
|
||||||
$user_names = array_keys($users['data']['data']);
|
$user_names = array_keys($users['data']['data']);
|
||||||
$db_types = array(
|
$db_types = array(
|
||||||
'mysql' => 'mysql',
|
'mysql' => 'mysql',
|
||||||
'postgress' => 'postgress'
|
'postgress' => 'postgress'
|
||||||
);
|
);
|
||||||
|
|
||||||
$interfaces_arr = json_decode($ip_obj->getSysInterfacesExecute(), TRUE);
|
$interfaces_arr = json_decode($ip_obj->getSysInterfacesExecute(), TRUE);
|
||||||
$interfaces = $interfaces_arr['data'];
|
$interfaces = $interfaces_arr['data'];
|
||||||
|
|
||||||
|
|
||||||
$reply = array(
|
$reply = array(
|
||||||
'WEB_DOMAIN' => array(
|
'WEB_DOMAIN' => array(
|
||||||
'TPL' => array('default' => 'default'),
|
'TPL' => array('default' => 'default'),
|
||||||
'ALIAS' => array(),
|
'ALIAS' => array(),
|
||||||
'STAT' => array(
|
'STAT' => array(
|
||||||
'webalizer' => 'webalizer',
|
'webalizer' => 'webalizer',
|
||||||
'awstats' => 'awstats'),
|
'awstats' => 'awstats'),
|
||||||
'IP' => $ips
|
'IP' => $ips
|
||||||
),
|
),
|
||||||
'CRON' => array(),
|
'CRON' => array(),
|
||||||
'IP' => array(
|
'IP' => array(
|
||||||
'SYS_USERS' => $user_names,
|
'SYS_USERS' => $user_names,
|
||||||
'STATUSES' => array(
|
'STATUSES' => array(
|
||||||
'shared' => 'shared',
|
'shared' => 'shared',
|
||||||
'exclusive' => 'exclusive'
|
'exclusive' => 'exclusive'
|
||||||
),
|
),
|
||||||
'INTERFACES' => $interfaces,
|
'INTERFACES' => $interfaces,
|
||||||
'MASK' => array(
|
'MASK' => array(
|
||||||
'255.255.255.0' => '255.255.255.0',
|
'255.255.255.0' => '255.255.255.0',
|
||||||
'255.255.255.128' => '255.255.255.128',
|
'255.255.255.128' => '255.255.255.128',
|
||||||
'255.255.255.192' => '255.255.255.192',
|
'255.255.255.192' => '255.255.255.192',
|
||||||
'255.255.255.224' => '255.255.255.224',
|
'255.255.255.224' => '255.255.255.224',
|
||||||
'255.255.255.240' => '255.255.255.240',
|
'255.255.255.240' => '255.255.255.240',
|
||||||
'255.255.255.248' => '255.255.255.248',
|
'255.255.255.248' => '255.255.255.248',
|
||||||
'255.255.255.252' => '255.255.255.252',
|
'255.255.255.252' => '255.255.255.252',
|
||||||
'255.255.255.255' => '255.255.255.255'
|
'255.255.255.255' => '255.255.255.255'
|
||||||
),
|
),
|
||||||
'OWNER' => array()
|
'OWNER' => array()
|
||||||
),
|
),
|
||||||
'DNS' => array(
|
'DNS' => array(
|
||||||
'IP' => $ips,
|
'IP' => $ips,
|
||||||
'TPL' => array(
|
'TPL' => array(
|
||||||
'default' => 'default'
|
'default' => 'default'
|
||||||
),
|
),
|
||||||
'EXP' => array(),
|
'EXP' => array(),
|
||||||
'SOA' => array(),
|
'SOA' => array(),
|
||||||
'TTL' => array(),
|
'TTL' => array(),
|
||||||
'record' => array(
|
'record' => array(
|
||||||
'RECORD' => array(),
|
'RECORD' => array(),
|
||||||
'RECORD_TYPE' => array('a' => 'a', 'reverse' => 'reverse'),
|
'RECORD_TYPE' => array('a' => 'a', 'reverse' => 'reverse'),
|
||||||
'RECORD_VALUE' => array()
|
'RECORD_VALUE' => array()
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
'DB' => array(
|
'DB' => array(
|
||||||
'TYPE' => $db_types
|
'TYPE' => $db_types
|
||||||
),
|
),
|
||||||
'USERS' => array(
|
'USERS' => array(
|
||||||
'ROLE' => array('user' => 'user'),
|
'ROLE' => array('user' => 'user'),
|
||||||
'OWNER' => $user_names,
|
'OWNER' => $user_names,
|
||||||
'PACKAGE' => array('default' => 'default'),
|
'PACKAGE' => array('default' => 'default'),
|
||||||
'NS1' => array('' => ''),
|
'NS1' => array('' => ''),
|
||||||
'NS2' => array('' => ''),
|
'NS2' => array('' => ''),
|
||||||
'SHELL' => array(
|
'SHELL' => array(
|
||||||
'/bin/sh' => '/bin/sh',
|
'/bin/sh' => '/bin/sh',
|
||||||
'/bin/bash' => '/bin/bash',
|
'/bin/bash' => '/bin/bash',
|
||||||
'/sbin/nologin' => '/sbin/nologin',
|
'/sbin/nologin' => '/sbin/nologin',
|
||||||
'/bin/tcsh' => '/bin/tcsh',
|
'/bin/tcsh' => '/bin/tcsh',
|
||||||
'/bin/csh' => '/bin/csh')
|
'/bin/csh' => '/bin/csh')
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
return $this->reply(true, $reply);
|
return $this->reply(true, $reply);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,96 +11,96 @@
|
||||||
class PARAMS extends AjaxHandler
|
class PARAMS extends AjaxHandler
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Get initial params
|
* Get initial params
|
||||||
*
|
*
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public function getInitialExecute($request)
|
public function getInitialExecute($request)
|
||||||
{
|
{
|
||||||
require_once V_ROOT_DIR . 'api/IP.class.php';
|
require_once V_ROOT_DIR . 'api/IP.class.php';
|
||||||
require_once V_ROOT_DIR . 'api/USER.class.php';
|
require_once V_ROOT_DIR . 'api/USER.class.php';
|
||||||
|
|
||||||
$ip_obj = new IP();
|
$ip_obj = new IP();
|
||||||
$user_obj = new USER();
|
$user_obj = new USER();
|
||||||
|
|
||||||
$user_ips = json_decode($ip_obj->getListUserIpsExecute(), TRUE);
|
$user_ips = json_decode($ip_obj->getListUserIpsExecute(), TRUE);
|
||||||
foreach ($user_ips['data'] as $ip)
|
foreach ($user_ips['data'] as $ip)
|
||||||
{
|
{
|
||||||
$ips[$ip['IP_ADDRESS']] = $ip['IP_ADDRESS'];
|
$ips[$ip['IP_ADDRESS']] = $ip['IP_ADDRESS'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$users = json_decode($user_obj->getListExecute(), TRUE);
|
$users = json_decode($user_obj->getListExecute(), TRUE);
|
||||||
$user_names = array_keys($users['data']['data']);
|
$user_names = array_keys($users['data']['data']);
|
||||||
|
|
||||||
$db_types = array(
|
$db_types = array(
|
||||||
'mysql' => 'mysql',
|
'mysql' => 'mysql',
|
||||||
'postgress' => 'postgress'
|
'postgress' => 'postgress'
|
||||||
);
|
);
|
||||||
|
|
||||||
$interfaces_arr = json_decode($ip_obj->getSysInterfacesExecute(), TRUE);
|
$interfaces_arr = json_decode($ip_obj->getSysInterfacesExecute(), TRUE);
|
||||||
$interfaces = $interfaces_arr['data'];
|
$interfaces = $interfaces_arr['data'];
|
||||||
|
|
||||||
$reply = array(
|
$reply = array(
|
||||||
'WEB_DOMAIN' => array(
|
'WEB_DOMAIN' => array(
|
||||||
'TPL' => array('default' => 'default'),
|
'TPL' => array('default' => 'default'),
|
||||||
'ALIAS' => array(),
|
'ALIAS' => array(),
|
||||||
'STAT' => array(
|
'STAT' => array(
|
||||||
'webalizer' => 'webalizer',
|
'webalizer' => 'webalizer',
|
||||||
'awstats' => 'awstats'),
|
'awstats' => 'awstats'),
|
||||||
'IP' => $ips
|
'IP' => $ips
|
||||||
),
|
),
|
||||||
'CRON' => array(),
|
'CRON' => array(),
|
||||||
'IP' => array(
|
'IP' => array(
|
||||||
'SYS_USERS' => $user_names,
|
'SYS_USERS' => $user_names,
|
||||||
'STATUSES' => array(
|
'STATUSES' => array(
|
||||||
'shared' => 'shared',
|
'shared' => 'shared',
|
||||||
'exclusive' => 'exclusive'
|
'exclusive' => 'exclusive'
|
||||||
),
|
),
|
||||||
'INTERFACES' => $interfaces,
|
'INTERFACES' => $interfaces,
|
||||||
'MASK' => array(
|
'MASK' => array(
|
||||||
'255.255.255.0' => '255.255.255.0',
|
'255.255.255.0' => '255.255.255.0',
|
||||||
'255.255.255.128' => '255.255.255.128',
|
'255.255.255.128' => '255.255.255.128',
|
||||||
'255.255.255.192' => '255.255.255.192',
|
'255.255.255.192' => '255.255.255.192',
|
||||||
'255.255.255.224' => '255.255.255.224',
|
'255.255.255.224' => '255.255.255.224',
|
||||||
'255.255.255.240' => '255.255.255.240',
|
'255.255.255.240' => '255.255.255.240',
|
||||||
'255.255.255.248' => '255.255.255.248',
|
'255.255.255.248' => '255.255.255.248',
|
||||||
'255.255.255.252' => '255.255.255.252',
|
'255.255.255.252' => '255.255.255.252',
|
||||||
'255.255.255.255' => '255.255.255.255'
|
'255.255.255.255' => '255.255.255.255'
|
||||||
),
|
),
|
||||||
'OWNER' => array()
|
'OWNER' => array()
|
||||||
),
|
),
|
||||||
'DNS' => array(
|
'DNS' => array(
|
||||||
'IP' => $ips,
|
'IP' => $ips,
|
||||||
'TPL' => array(
|
'TPL' => array(
|
||||||
'default' => 'default'
|
'default' => 'default'
|
||||||
),
|
),
|
||||||
'EXP' => array(),
|
'EXP' => array(),
|
||||||
'SOA' => array(),
|
'SOA' => array(),
|
||||||
'TTL' => array(),
|
'TTL' => array(),
|
||||||
'record' => array(
|
'record' => array(
|
||||||
'RECORD' => array(),
|
'RECORD' => array(),
|
||||||
'RECORD_TYPE' => array('a' => 'a', 'reverse' => 'reverse'),
|
'RECORD_TYPE' => array('a' => 'a', 'reverse' => 'reverse'),
|
||||||
'RECORD_VALUE' => array()
|
'RECORD_VALUE' => array()
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
'DB' => array(
|
'DB' => array(
|
||||||
'TYPE' => $db_types
|
'TYPE' => $db_types
|
||||||
),
|
),
|
||||||
'USERS' => array(
|
'USERS' => array(
|
||||||
'ROLE' => array('user' => 'user'),
|
'ROLE' => array('user' => 'user'),
|
||||||
'OWNER' => $user_names,
|
'OWNER' => $user_names,
|
||||||
'PACKAGE' => array('default' => 'default'),
|
'PACKAGE' => array('default' => 'default'),
|
||||||
'NS1' => array('' => ''),
|
'NS1' => array('' => ''),
|
||||||
'NS2' => array('' => ''),
|
'NS2' => array('' => ''),
|
||||||
'SHELL' => array(
|
'SHELL' => array(
|
||||||
'/bin/sh' => '/bin/sh',
|
'/bin/sh' => '/bin/sh',
|
||||||
'/bin/bash' => '/bin/bash',
|
'/bin/bash' => '/bin/bash',
|
||||||
'/sbin/nologin' => '/sbin/nologin',
|
'/sbin/nologin' => '/sbin/nologin',
|
||||||
'/bin/tcsh' => '/bin/tcsh',
|
'/bin/tcsh' => '/bin/tcsh',
|
||||||
'/bin/csh' => '/bin/csh')
|
'/bin/csh' => '/bin/csh')
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
return $this->reply(true, $reply);
|
return $this->reply(true, $reply);
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,14 +9,14 @@
|
||||||
*/
|
*/
|
||||||
class USER extends AjaxHandler
|
class USER extends AjaxHandler
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get list
|
* Get list
|
||||||
*
|
*
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public function getListExecute($request)
|
public function getListExecute($request)
|
||||||
{
|
{
|
||||||
$reply = array();
|
$reply = array();
|
||||||
$result = Vesta::execute(Vesta::V_LIST_SYS_USERS, array(Config::get('response_type')));
|
$result = Vesta::execute(Vesta::V_LIST_SYS_USERS, array(Config::get('response_type')));
|
||||||
|
@ -39,177 +39,177 @@ class USER extends AjaxHandler
|
||||||
return $this->reply(true, $result);
|
return $this->reply(true, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add action
|
* Add action
|
||||||
*
|
*
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public function addExecute($_spell = false)
|
public function addExecute($_spell = false)
|
||||||
{
|
{
|
||||||
$r = new Request();
|
$r = new Request();
|
||||||
if ($_spell)
|
if ($_spell)
|
||||||
{
|
{
|
||||||
$_s = $_spell;
|
$_s = $_spell;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$_s = $r->getSpell();
|
$_s = $r->getSpell();
|
||||||
}
|
}
|
||||||
$_user = 'vesta';
|
$_user = 'vesta';
|
||||||
$params = array(
|
$params = array(
|
||||||
'USER' => $_s['USER'],
|
'USER' => $_s['USER'],
|
||||||
'PASSWORD' => $_s['PASSWORD'],
|
'PASSWORD' => $_s['PASSWORD'],
|
||||||
'EMAIL' => $_s['EMAIL'],
|
'EMAIL' => $_s['EMAIL'],
|
||||||
'ROLE' => $_s['ROLE'],
|
'ROLE' => $_s['ROLE'],
|
||||||
'OWNER' => $_user,
|
'OWNER' => $_user,
|
||||||
'PACKAGE' => $_s['PACKAGE'],
|
'PACKAGE' => $_s['PACKAGE'],
|
||||||
'NS1' => $_s['NS1'],
|
'NS1' => $_s['NS1'],
|
||||||
'NS2' => $_s['NS2']
|
'NS2' => $_s['NS2']
|
||||||
);
|
);
|
||||||
|
|
||||||
$result = Vesta::execute(Vesta::V_ADD_SYS_USER, $params);
|
$result = Vesta::execute(Vesta::V_ADD_SYS_USER, $params);
|
||||||
if (!$result['status'])
|
if (!$result['status'])
|
||||||
{
|
{
|
||||||
$this->errors[] = array($result['error_code'] => $result['error_message']);
|
$this->errors[] = array($result['error_code'] => $result['error_message']);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->reply($result['status'], $result['data']);
|
return $this->reply($result['status'], $result['data']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete action
|
* Delete action
|
||||||
*
|
*
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public function delExecute($_spell = false)
|
public function delExecute($_spell = false)
|
||||||
{
|
{
|
||||||
$r = new Request();
|
$r = new Request();
|
||||||
if ($_spell)
|
if ($_spell)
|
||||||
{
|
{
|
||||||
$_s = $_spell;
|
$_s = $_spell;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$_s = $r->getSpell();
|
$_s = $r->getSpell();
|
||||||
}
|
}
|
||||||
$_user = 'vesta';
|
$_user = 'vesta';
|
||||||
$params = array(
|
$params = array(
|
||||||
'USER' => $_s['USER']
|
'USER' => $_s['USER']
|
||||||
);
|
);
|
||||||
$result = Vesta::execute(Vesta::V_DEL_SYS_USER, $params);
|
$result = Vesta::execute(Vesta::V_DEL_SYS_USER, $params);
|
||||||
|
|
||||||
if (!$result['status'])
|
if (!$result['status'])
|
||||||
{
|
{
|
||||||
$this->errors[] = array($result['error_code'] => $result['error_message']);
|
$this->errors[] = array($result['error_code'] => $result['error_message']);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->reply($result['status'], $result['data']);
|
return $this->reply($result['status'], $result['data']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change action
|
* Change action
|
||||||
*
|
*
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public function changeExecute($request)
|
public function changeExecute($request)
|
||||||
{
|
{
|
||||||
$r = new Request();
|
$r = new Request();
|
||||||
$_s = $r->getSpell();
|
$_s = $r->getSpell();
|
||||||
$_old = $_s['old'];
|
$_old = $_s['old'];
|
||||||
$_new = $_s['new'];
|
$_new = $_s['new'];
|
||||||
|
|
||||||
$_USER = $_new['USER'];
|
$_USER = $_new['USER'];
|
||||||
|
|
||||||
if($_old['USER'] != $_new['USER'])
|
if($_old['USER'] != $_new['USER'])
|
||||||
{
|
{
|
||||||
$result = array();
|
$result = array();
|
||||||
// creating new user
|
// creating new user
|
||||||
$result = $this->addExecute($_new);
|
$result = $this->addExecute($_new);
|
||||||
|
|
||||||
// deleting old
|
// deleting old
|
||||||
if ($result['status'])
|
if ($result['status'])
|
||||||
{
|
{
|
||||||
$result = array();
|
$result = array();
|
||||||
|
|
||||||
$result = $this->delExecute($_old);
|
$result = $this->delExecute($_old);
|
||||||
return $this->reply($this->status, '');
|
return $this->reply($this->status, '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_old['PASSWORD'] != $_new['PASSWORD'])
|
if ($_old['PASSWORD'] != $_new['PASSWORD'])
|
||||||
{
|
{
|
||||||
$result = array();
|
$result = array();
|
||||||
$result = Vesta::execute(Vesta::V_CHANGE_SYS_USER_PASSWORD,
|
$result = Vesta::execute(Vesta::V_CHANGE_SYS_USER_PASSWORD,
|
||||||
array('USER' => $_USER, 'PASSWORD' => $_new['PASSWORD']));
|
array('USER' => $_USER, 'PASSWORD' => $_new['PASSWORD']));
|
||||||
if (!$result['status'])
|
if (!$result['status'])
|
||||||
{
|
{
|
||||||
$this->status = FALSE;
|
$this->status = FALSE;
|
||||||
$this->errors['PASSWORD'] = array($result['error_code'] => $result['error_message']);
|
$this->errors['PASSWORD'] = array($result['error_code'] => $result['error_message']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_old['PACKAGE'] != $_new['PACKAGE'])
|
if ($_old['PACKAGE'] != $_new['PACKAGE'])
|
||||||
{
|
{
|
||||||
$result = array();
|
$result = array();
|
||||||
$result = Vesta::execute(Vesta::V_CHANGE_SYS_USER_PACKAGE,
|
$result = Vesta::execute(Vesta::V_CHANGE_SYS_USER_PACKAGE,
|
||||||
array('USER' => $_USER, 'PACKAGE' => $_new['PACKAGE']));
|
array('USER' => $_USER, 'PACKAGE' => $_new['PACKAGE']));
|
||||||
if (!$result['status'])
|
if (!$result['status'])
|
||||||
{
|
{
|
||||||
$this->status = FALSE;
|
$this->status = FALSE;
|
||||||
$this->errors['PACKAGE'] = array($result['error_code'] => $result['error_message']);
|
$this->errors['PACKAGE'] = array($result['error_code'] => $result['error_message']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_old['EMAIL'] != $_new['EMAIL'])
|
if ($_old['EMAIL'] != $_new['EMAIL'])
|
||||||
{
|
{
|
||||||
$result = array();
|
$result = array();
|
||||||
$result = Vesta::execute(Vesta::V_CHANGE_SYS_USER_CONTACT,
|
$result = Vesta::execute(Vesta::V_CHANGE_SYS_USER_CONTACT,
|
||||||
array('USER' => $_USER, 'EMAIL' => $_new['EMAIL']));
|
array('USER' => $_USER, 'EMAIL' => $_new['EMAIL']));
|
||||||
if (!$result['status'])
|
if (!$result['status'])
|
||||||
{
|
{
|
||||||
$this->status = FALSE;
|
$this->status = FALSE;
|
||||||
$this->errors['EMAIL'] = array($result['error_code'] => $result['error_message']);
|
$this->errors['EMAIL'] = array($result['error_code'] => $result['error_message']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_old['NS1'] != $_new['NS1'] || $_old['NS2'] != $_new['NS2'])
|
if ($_old['NS1'] != $_new['NS1'] || $_old['NS2'] != $_new['NS2'])
|
||||||
{
|
{
|
||||||
$result = array();
|
$result = array();
|
||||||
$result = Vesta::execute(Vesta::V_CHANGE_SYS_USER_NS,
|
$result = Vesta::execute(Vesta::V_CHANGE_SYS_USER_NS,
|
||||||
array('USER' => $_USER, 'NS1' => $_new['NS1'], 'NS2' => $_new['NS2']));
|
array('USER' => $_USER, 'NS1' => $_new['NS1'], 'NS2' => $_new['NS2']));
|
||||||
if (!$result['status'])
|
if (!$result['status'])
|
||||||
{
|
{
|
||||||
$this->status = FALSE;
|
$this->status = FALSE;
|
||||||
$this->errors['NS'] = array($result['error_code'] => $result['error_message']);
|
$this->errors['NS'] = array($result['error_code'] => $result['error_message']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_old['SHELL'] != $_new['SHELL'])
|
if ($_old['SHELL'] != $_new['SHELL'])
|
||||||
{
|
{
|
||||||
$result = array();
|
$result = array();
|
||||||
$result = Vesta::execute(Vesta::V_CHANGE_SYS_USER_SHELL,
|
$result = Vesta::execute(Vesta::V_CHANGE_SYS_USER_SHELL,
|
||||||
array('USER' => $_USER, 'SHELL' => $_new['SHELL']));
|
array('USER' => $_USER, 'SHELL' => $_new['SHELL']));
|
||||||
if (!$result['status'])
|
if (!$result['status'])
|
||||||
{
|
{
|
||||||
$this->status = FALSE;
|
$this->status = FALSE;
|
||||||
$this->errors['SHELL'] = array($result['error_code'] => $result['error_message']);
|
$this->errors['SHELL'] = array($result['error_code'] => $result['error_message']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->status)
|
if (!$this->status)
|
||||||
{
|
{
|
||||||
Vesta::execute(Vesta::V_CHANGE_SYS_USER_PASSWORD, array('USER' => $_USER, 'PASSWORD' => $_old['PASSWORD']));
|
Vesta::execute(Vesta::V_CHANGE_SYS_USER_PASSWORD, array('USER' => $_USER, 'PASSWORD' => $_old['PASSWORD']));
|
||||||
Vesta::execute(Vesta::V_CHANGE_SYS_USER_PACKAGE, array('USER' => $_USER, 'PACKAGE' => $_old['PACKAGE']));
|
Vesta::execute(Vesta::V_CHANGE_SYS_USER_PACKAGE, array('USER' => $_USER, 'PACKAGE' => $_old['PACKAGE']));
|
||||||
Vesta::execute(Vesta::V_CHANGE_SYS_USER_CONTACT, array('USER' => $_USER, 'EMAIL' => $_old['EMAIL']));
|
Vesta::execute(Vesta::V_CHANGE_SYS_USER_CONTACT, array('USER' => $_USER, 'EMAIL' => $_old['EMAIL']));
|
||||||
// change role // $result = Vesta::execute(Vesta::V_CHANGE_SYS_USER_PACKAGE, array('USER' => $_USER, 'PACKAGE' => $_new['PACKAGE']));
|
// change role // $result = Vesta::execute(Vesta::V_CHANGE_SYS_USER_PACKAGE, array('USER' => $_USER, 'PACKAGE' => $_new['PACKAGE']));
|
||||||
Vesta::execute(Vesta::V_CHANGE_SYS_USER_NS, array('USER' => $_USER, 'NS1' => $_old['NS1'], 'NS2' => $_old['NS2']));
|
Vesta::execute(Vesta::V_CHANGE_SYS_USER_NS, array('USER' => $_USER, 'NS1' => $_old['NS1'], 'NS2' => $_old['NS2']));
|
||||||
Vesta::execute(Vesta::V_CHANGE_SYS_USER_SHELL, array('USER' => $_USER, 'SHELL' => $_old['SHELL']));
|
Vesta::execute(Vesta::V_CHANGE_SYS_USER_SHELL, array('USER' => $_USER, 'SHELL' => $_old['SHELL']));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->reply($this->status, '');
|
return $this->reply($this->status, '');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,56 +10,56 @@
|
||||||
*/
|
*/
|
||||||
class WEB_DOMAIN extends AjaxHandler
|
class WEB_DOMAIN extends AjaxHandler
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get list
|
* Get list
|
||||||
*
|
*
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public function getListExecute($request)
|
public function getListExecute($request)
|
||||||
{
|
{
|
||||||
$_user = 'vesta';
|
$_user = 'vesta';
|
||||||
$reply = array();
|
$reply = array();
|
||||||
|
|
||||||
$result = Vesta::execute(Vesta::V_LIST_WEB_DOMAINS, array($_user, Config::get('response_type')));
|
$result = Vesta::execute(Vesta::V_LIST_WEB_DOMAINS, array($_user, Config::get('response_type')));
|
||||||
foreach ($result['data'] as $web_domain => $data)
|
foreach ($result['data'] as $web_domain => $data)
|
||||||
{
|
{
|
||||||
$reply[$web_domain] = array(
|
$reply[$web_domain] = array(
|
||||||
'IP' => $record['IP'],
|
'IP' => $record['IP'],
|
||||||
'U_DISK' => $record['U_DISK'],
|
'U_DISK' => $record['U_DISK'],
|
||||||
'U_BANDWIDTH' => $record['U_BANDWIDTH'],
|
'U_BANDWIDTH' => $record['U_BANDWIDTH'],
|
||||||
'TPL' => $record['TPL'],
|
'TPL' => $record['TPL'],
|
||||||
'ALIAS' => $record['ALIAS'],
|
'ALIAS' => $record['ALIAS'],
|
||||||
'PHP' => $record['PHP'],
|
'PHP' => $record['PHP'],
|
||||||
'CGI' => $record['CGI'],
|
'CGI' => $record['CGI'],
|
||||||
'ELOG' => $record['ELOG'],
|
'ELOG' => $record['ELOG'],
|
||||||
'STATS' => $record['STATS'],
|
'STATS' => $record['STATS'],
|
||||||
'STATS_AUTH' => $record['STATS_AUTH'],
|
'STATS_AUTH' => $record['STATS_AUTH'],
|
||||||
'SSL' => $record['SSL'],
|
'SSL' => $record['SSL'],
|
||||||
'SSL_HOME' => $record['SSL_HOME'],
|
'SSL_HOME' => $record['SSL_HOME'],
|
||||||
'SSL_CERT' => $record['SSL_CERT'],
|
'SSL_CERT' => $record['SSL_CERT'],
|
||||||
'NGINX' => $record['NGINX'],
|
'NGINX' => $record['NGINX'],
|
||||||
'NGINX_EXT' => $record['NGINX_EXT'],
|
'NGINX_EXT' => $record['NGINX_EXT'],
|
||||||
'SUSPEND' => $record['SUSPEND'],
|
'SUSPEND' => $record['SUSPEND'],
|
||||||
'DATE' => date(Config::get('ui_date_format', strtotime($record['DATE'])))
|
'DATE' => date(Config::get('ui_date_format', strtotime($record['DATE'])))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$result['status'])
|
if (!$result['status'])
|
||||||
{
|
{
|
||||||
$this->errors[] = array($result['error_code'] => $result['error_message']);
|
$this->errors[] = array($result['error_code'] => $result['error_message']);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->reply($result['status'], $reply);
|
return $this->reply($result['status'], $reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add entry
|
* Add entry
|
||||||
*
|
*
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public function addExecute($request)
|
public function addExecute($request)
|
||||||
{
|
{
|
||||||
$r = new Request();
|
$r = new Request();
|
||||||
|
@ -92,7 +92,7 @@ class WEB_DOMAIN extends AjaxHandler
|
||||||
$result = Vesta::execute(Vesta::V_CHANGE_WEB_DOMAIN_TPL, $params);
|
$result = Vesta::execute(Vesta::V_CHANGE_WEB_DOMAIN_TPL, $params);
|
||||||
|
|
||||||
if (!$result['status'])
|
if (!$result['status'])
|
||||||
{
|
{
|
||||||
$this->errors['CHANGE_TPL'] = array(
|
$this->errors['CHANGE_TPL'] = array(
|
||||||
$result['error_code'] => $result['error_message']
|
$result['error_code'] => $result['error_message']
|
||||||
);
|
);
|
||||||
|
@ -115,7 +115,7 @@ class WEB_DOMAIN extends AjaxHandler
|
||||||
$result = Vesta::execute(Vesta::V_ADD_WEB_DOMAIN_ALIAS, $params);
|
$result = Vesta::execute(Vesta::V_ADD_WEB_DOMAIN_ALIAS, $params);
|
||||||
|
|
||||||
if (!$result['status'])
|
if (!$result['status'])
|
||||||
{
|
{
|
||||||
$this->errors['ALIAS'] = array(
|
$this->errors['ALIAS'] = array(
|
||||||
$result['error_code'] => $result['error_message']
|
$result['error_code'] => $result['error_message']
|
||||||
);
|
);
|
||||||
|
@ -134,7 +134,7 @@ class WEB_DOMAIN extends AjaxHandler
|
||||||
$result = Vesta::execute(Vesta::V_ADD_WEB_DOMAIN_STAT, $params);
|
$result = Vesta::execute(Vesta::V_ADD_WEB_DOMAIN_STAT, $params);
|
||||||
|
|
||||||
if (!$result['status'])
|
if (!$result['status'])
|
||||||
{
|
{
|
||||||
$this->errors['STATS'] = array(
|
$this->errors['STATS'] = array(
|
||||||
$result['error_code'] => $result['error_message']
|
$result['error_code'] => $result['error_message']
|
||||||
);
|
);
|
||||||
|
@ -153,7 +153,7 @@ class WEB_DOMAIN extends AjaxHandler
|
||||||
$result = Vesta::execute(Vesta::V_ADD_WEB_DOMAIN_STAT_AUTH, $params);
|
$result = Vesta::execute(Vesta::V_ADD_WEB_DOMAIN_STAT_AUTH, $params);
|
||||||
|
|
||||||
if (!$result['status'])
|
if (!$result['status'])
|
||||||
{
|
{
|
||||||
$this->errors['STAT_AUTH'] = array(
|
$this->errors['STAT_AUTH'] = array(
|
||||||
$result['error_code'] => $result['error_message']
|
$result['error_code'] => $result['error_message']
|
||||||
);
|
);
|
||||||
|
@ -161,34 +161,34 @@ class WEB_DOMAIN extends AjaxHandler
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ($_s['SSL'])
|
if ($_s['SSL'])
|
||||||
{
|
{
|
||||||
$params = array(
|
$params = array(
|
||||||
'USER' => $_user,
|
'USER' => $_user,
|
||||||
'DOMAIN' => $_s['DOMAIN'],
|
'DOMAIN' => $_s['DOMAIN'],
|
||||||
'SSL_CERT' => $_s['SSL_CERT']
|
'SSL_CERT' => $_s['SSL_CERT']
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($_s['SSL_HOME'])
|
if ($_s['SSL_HOME'])
|
||||||
{
|
{
|
||||||
$params['SSL_HOME'] = $_s['SSL_HOME'];
|
$params['SSL_HOME'] = $_s['SSL_HOME'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_s['SSL_TEXT'])
|
if ($_s['SSL_TEXT'])
|
||||||
{
|
{
|
||||||
// TODO: write it up
|
// TODO: write it up
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = 0;
|
$result = 0;
|
||||||
$result = Vesta::execute(Vesta::V_ADD_WEB_DOMAIN_SSL, $params);
|
$result = Vesta::execute(Vesta::V_ADD_WEB_DOMAIN_SSL, $params);
|
||||||
|
|
||||||
if (!$result['status'])
|
if (!$result['status'])
|
||||||
{
|
{
|
||||||
$this->errors['SSL'] = array(
|
$this->errors['SSL'] = array(
|
||||||
$result['error_code'] => $result['error_message']
|
$result['error_code'] => $result['error_message']
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_s['CREATE_DNS_DOMAIN'])
|
if ($_s['CREATE_DNS_DOMAIN'])
|
||||||
{
|
{
|
||||||
|
@ -211,36 +211,36 @@ class WEB_DOMAIN extends AjaxHandler
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_s['CREATE_MAIL_DOMAIN'])
|
if ($_s['CREATE_MAIL_DOMAIN'])
|
||||||
{
|
{
|
||||||
$params = array(
|
$params = array(
|
||||||
'USER' => $_user,
|
'USER' => $_user,
|
||||||
'MAIL_DOMAIN' => $_s['DOMAIN'],
|
'MAIL_DOMAIN' => $_s['DOMAIN'],
|
||||||
'IP' => $_s['IP']
|
'IP' => $_s['IP']
|
||||||
);
|
);
|
||||||
|
|
||||||
require_once V_ROOT_DIR . 'api/MAIL.class.php';
|
require_once V_ROOT_DIR . 'api/MAIL.class.php';
|
||||||
|
|
||||||
$mail = new MAIL();
|
$mail = new MAIL();
|
||||||
$result = 0;
|
$result = 0;
|
||||||
$result = $mail->addExecute($params);
|
$result = $mail->addExecute($params);
|
||||||
if (!$result['status'])
|
if (!$result['status'])
|
||||||
{
|
{
|
||||||
$this->errors['MAIL_DOMAIN'] = array(
|
$this->errors['MAIL_DOMAIN'] = array(
|
||||||
$result['error_code'] => $result['error_message']
|
$result['error_code'] => $result['error_message']
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->reply($result['status'], $result['data']);
|
return $this->reply($result['status'], $result['data']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete entry
|
* Delete entry
|
||||||
*
|
*
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public function delExecute($request)
|
public function delExecute($request)
|
||||||
{
|
{
|
||||||
$r = new Request();
|
$r = new Request();
|
||||||
|
@ -270,7 +270,7 @@ class WEB_DOMAIN extends AjaxHandler
|
||||||
|
|
||||||
if (!$result['status'] && $result['error_code'] != 31) // domain not found
|
if (!$result['status'] && $result['error_code'] != 31) // domain not found
|
||||||
{
|
{
|
||||||
$this->errors['DNS'] = array(
|
$this->errors['DNS'] = array(
|
||||||
$result['error_code'] => $result['error_message']
|
$result['error_code'] => $result['error_message']
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -286,11 +286,11 @@ class WEB_DOMAIN extends AjaxHandler
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change entry
|
* Change entry
|
||||||
*
|
*
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public function changeExecute($request)
|
public function changeExecute($request)
|
||||||
{
|
{
|
||||||
$r = new Request();
|
$r = new Request();
|
||||||
|
@ -428,55 +428,55 @@ class WEB_DOMAIN extends AjaxHandler
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_old['SSL'] != $_new['SSL'])
|
if ($_old['SSL'] != $_new['SSL'])
|
||||||
{
|
{
|
||||||
if ($_new['SSL'] == true)
|
if ($_new['SSL'] == true)
|
||||||
{
|
{
|
||||||
// TODO: write it
|
// TODO: write it
|
||||||
}
|
}
|
||||||
if ($_new['SSL'] == false)
|
if ($_new['SSL'] == false)
|
||||||
{
|
{
|
||||||
// TODO: write it
|
// TODO: write it
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ($_old['SSL_CERT'] != $_new['SSL_CERT'])
|
if ($_old['SSL_CERT'] != $_new['SSL_CERT'])
|
||||||
{
|
{
|
||||||
$result = array();
|
$result = array();
|
||||||
$_SSL_CERT = $_new['SSL_CERT'];
|
$_SSL_CERT = $_new['SSL_CERT'];
|
||||||
// or read uploaded tmp file
|
// or read uploaded tmp file
|
||||||
|
|
||||||
$result = Vesta::execute(Vesta::V_CHANGE_WEB_DOMAIN_CERT, array(
|
$result = Vesta::execute(Vesta::V_CHANGE_WEB_DOMAIN_CERT, array(
|
||||||
'USER' => $_user,
|
'USER' => $_user,
|
||||||
'DOMAIN' => $_DOMAIN,
|
'DOMAIN' => $_DOMAIN,
|
||||||
'SSL_CERT' => $_SSL_CERT
|
'SSL_CERT' => $_SSL_CERT
|
||||||
));
|
));
|
||||||
if (!$result['status'])
|
if (!$result['status'])
|
||||||
{
|
{
|
||||||
$this->status = FALSE;
|
$this->status = FALSE;
|
||||||
$this->errors['SSL_CERT'] = array(
|
$this->errors['SSL_CERT'] = array(
|
||||||
$result['error_code'] => $result['error_message']
|
$result['error_code'] => $result['error_message']
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($_old['SSL_HOME'] != $_new['SSL_HOME'])
|
if ($_old['SSL_HOME'] != $_new['SSL_HOME'])
|
||||||
{
|
{
|
||||||
$result = array();
|
$result = array();
|
||||||
$result = Vesta::execute(Vesta::V_CHANGE_WEB_DOMAIN_SSLHOME, array(
|
$result = Vesta::execute(Vesta::V_CHANGE_WEB_DOMAIN_SSLHOME, array(
|
||||||
'USER' => $_user,
|
'USER' => $_user,
|
||||||
'DOMAIN' => $_DOMAIN,
|
'DOMAIN' => $_DOMAIN,
|
||||||
'SSL_HOME' => $_new['SSL_HOME']
|
'SSL_HOME' => $_new['SSL_HOME']
|
||||||
));
|
));
|
||||||
if (!$result['status'])
|
if (!$result['status'])
|
||||||
{
|
{
|
||||||
$this->status = FALSE;
|
$this->status = FALSE;
|
||||||
$this->errors['SSL_HOME'] = array(
|
$this->errors['SSL_HOME'] = array(
|
||||||
$result['error_code'] => $result['error_message']
|
$result['error_code'] => $result['error_message']
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_old['CGI'] != $_new['CGI'])
|
if ($_old['CGI'] != $_new['CGI'])
|
||||||
{
|
{
|
||||||
|
@ -551,11 +551,11 @@ class WEB_DOMAIN extends AjaxHandler
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Suspend entry
|
* Suspend entry
|
||||||
*
|
*
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public function suspendExecute($request)
|
public function suspendExecute($request)
|
||||||
{
|
{
|
||||||
$r = new Request();
|
$r = new Request();
|
||||||
|
@ -571,7 +571,7 @@ class WEB_DOMAIN extends AjaxHandler
|
||||||
$result = Vesta::execute(Vesta::V_SUSPEND_WEB_DOMAIN, $params);
|
$result = Vesta::execute(Vesta::V_SUSPEND_WEB_DOMAIN, $params);
|
||||||
|
|
||||||
if (!$result['status'])
|
if (!$result['status'])
|
||||||
{
|
{
|
||||||
$this->errors[] = array(
|
$this->errors[] = array(
|
||||||
$result['error_code'] => $result['error_message']
|
$result['error_code'] => $result['error_message']
|
||||||
);
|
);
|
||||||
|
@ -581,11 +581,11 @@ class WEB_DOMAIN extends AjaxHandler
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unsuspend entry
|
* Unsuspend entry
|
||||||
*
|
*
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public function unsuspendExecute($request)
|
public function unsuspendExecute($request)
|
||||||
{
|
{
|
||||||
$r = new Request();
|
$r = new Request();
|
||||||
|
@ -601,7 +601,7 @@ class WEB_DOMAIN extends AjaxHandler
|
||||||
$result = Vesta::execute(Vesta::V_UNSUSPEND_WEB_DOMAIN, $params);
|
$result = Vesta::execute(Vesta::V_UNSUSPEND_WEB_DOMAIN, $params);
|
||||||
|
|
||||||
if (!$result['status'])
|
if (!$result['status'])
|
||||||
{
|
{
|
||||||
$this->errors[] = array(
|
$this->errors[] = array(
|
||||||
$result['error_code'] => $result['error_message']
|
$result['error_code'] => $result['error_message']
|
||||||
);
|
);
|
||||||
|
@ -611,11 +611,11 @@ class WEB_DOMAIN extends AjaxHandler
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Batch suspend entries
|
* Batch suspend entries
|
||||||
*
|
*
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public function suspendAllExecute($request)
|
public function suspendAllExecute($request)
|
||||||
{
|
{
|
||||||
$r = new Request();
|
$r = new Request();
|
||||||
|
@ -640,11 +640,11 @@ class WEB_DOMAIN extends AjaxHandler
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Batch unsuspend entry
|
* Batch unsuspend entry
|
||||||
*
|
*
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public function unsuspendAllExecute($request)
|
public function unsuspendAllExecute($request)
|
||||||
{
|
{
|
||||||
$r = new Request();
|
$r = new Request();
|
||||||
|
|
|
@ -16,20 +16,20 @@ class Config
|
||||||
static public $instance = null;
|
static public $instance = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Config constructor
|
* Config constructor
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->_config = parse_ini_file(V_ROOT_DIR.'config'.DIRECTORY_SEPARATOR.'vesta_config.ini');
|
$this->_config = parse_ini_file(V_ROOT_DIR.'config'.DIRECTORY_SEPARATOR.'vesta_config.ini');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get config parameter
|
* get config parameter
|
||||||
*
|
*
|
||||||
* @param string $key
|
* @param string $key
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function getParameter($key)
|
public function getParameter($key)
|
||||||
{
|
{
|
||||||
return isset($this->_config[$key]) ? $this->_config[$key] : false;
|
return isset($this->_config[$key]) ? $this->_config[$key] : false;
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* Holds parameters, decorating them and providing easy access
|
* Holds parameters, decorating them and providing easy access
|
||||||
*
|
*
|
||||||
* @author Malishev Dima <dima.malishev@gmail.com>
|
* @author Malishev Dima <dima.malishev@gmail.com>
|
||||||
* @author vesta, http://vestacp.com/
|
* @author vesta, http://vestacp.com
|
||||||
* @copyright vesta 2010-2011
|
* @copyright vesta 2010-2011
|
||||||
*/
|
*/
|
||||||
class Request
|
class Request
|
||||||
|
@ -37,10 +37,10 @@ class Request
|
||||||
public function mergeContainers()
|
public function mergeContainers()
|
||||||
{
|
{
|
||||||
$this->_merged = array_merge($this->server,
|
$this->_merged = array_merge($this->server,
|
||||||
$this->post,
|
$this->post,
|
||||||
$this->get,
|
$this->get,
|
||||||
$this->global);
|
$this->global);
|
||||||
$this->_spell = json_decode($this->_merged['spell'], true);
|
$this->_spell = json_decode($this->_merged['spell'], true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -55,7 +55,7 @@ class Request
|
||||||
return isset($this->_merged[$key]) ? $this->_merged[$key] : $default;
|
return isset($this->_merged[$key]) ? $this->_merged[$key] : $default;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get spell variable from parameters
|
* Get spell variable from parameters
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
|
@ -65,7 +65,7 @@ class Request
|
||||||
return $this->_spell;
|
return $this->_spell;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if parameter is set
|
* Check if parameter is set
|
||||||
*
|
*
|
||||||
* @param string $key
|
* @param string $key
|
||||||
|
@ -90,7 +90,7 @@ class Request
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dissassemble ajax method
|
* Dissassemble ajax method
|
||||||
* Breaks ajax requested method param into "ENTITY"."ACTION"
|
* Breaks ajax requested method param into "ENTITY"."ACTION"
|
||||||
* for instance DNS.getList into "namespase" => DNS, "function" => "getList"
|
* for instance DNS.getList into "namespase" => DNS, "function" => "getList"
|
||||||
|
|
|
@ -12,98 +12,98 @@
|
||||||
class Vesta
|
class Vesta
|
||||||
{
|
{
|
||||||
// IP
|
// IP
|
||||||
const V_LIST_SYS_IPS = 'v_list_sys_ips';
|
const V_LIST_SYS_IPS = 'v_list_sys_ips';
|
||||||
const V_ADD_SYS_IP = 'v_add_sys_ip';
|
const V_ADD_SYS_IP = 'v_add_sys_ip';
|
||||||
const V_ADD_SYS_USER_IP = 'v_add_sys_user_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_OWNER = 'v_change_sys_ip_owner';
|
||||||
const V_CHANGE_SYS_IP_NAME = 'v_change_sys_ip_name';
|
const V_CHANGE_SYS_IP_NAME = 'v_change_sys_ip_name';
|
||||||
const V_CHANGE_SYS_IP_STATUS = 'v_change_sys_ip_status';
|
const V_CHANGE_SYS_IP_STATUS = 'v_change_sys_ip_status';
|
||||||
const V_DEL_SYS_IP = 'v_del_sys_ip';
|
const V_DEL_SYS_IP = 'v_del_sys_ip';
|
||||||
const V_UPD_SYS_IP = 'v_upd_sys_ip';
|
const V_UPD_SYS_IP = 'v_upd_sys_ip';
|
||||||
const V_LIST_SYS_INTERFACES = 'v_list_sys_interfaces';
|
const V_LIST_SYS_INTERFACES = 'v_list_sys_interfaces';
|
||||||
// DNS
|
// DNS
|
||||||
const V_LIST_DNS_DOMAINS = 'v_list_dns_domains';
|
const V_LIST_DNS_DOMAINS = 'v_list_dns_domains';
|
||||||
const V_LIST_DNS_DOMAIN_RECORDS = 'v_list_dns_domain';
|
const V_LIST_DNS_DOMAIN_RECORDS = 'v_list_dns_domain';
|
||||||
const V_ADD_DNS_DOMAIN = 'v_add_dns_domain';
|
const V_ADD_DNS_DOMAIN = 'v_add_dns_domain';
|
||||||
const V_ADD_DNS_DOMAIN_RECORD = 'v_add_dns_domain_record';
|
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_IP = 'v_change_dns_domain_ip';
|
||||||
const V_CHANGE_DNS_DOMAIN_SOA = 'v_change_dns_domain_soa';
|
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_TPL = 'v_change_dns_domain_tpl';
|
||||||
const V_CHANGE_DNS_DOMAIN_TTL = 'v_change_dns_domain_ttl';
|
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_EXP = 'v_change_dns_domain_exp';
|
||||||
const V_CHANGE_DNS_DOMAIN_RECORD = 'v_change_dns_domain_record';
|
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 = 'v_del_dns_domain';
|
||||||
const V_DEL_DNS_DOMAIN_RECORD = 'v_del_dns_domain_record';
|
const V_DEL_DNS_DOMAIN_RECORD = 'v_del_dns_domain_record';
|
||||||
// CRON
|
// CRON
|
||||||
const V_LIST_CRON_JOBS = 'v_list_sys_cron';
|
const V_LIST_CRON_JOBS = 'v_list_sys_cron';
|
||||||
const V_ADD_CRON_JOB = 'v_add_sys_cron';
|
const V_ADD_CRON_JOB = 'v_add_sys_cron';
|
||||||
const V_ADD_SYS_USER_REPORTS = 'v_add_sys_user_reports';
|
const V_ADD_SYS_USER_REPORTS = 'v_add_sys_user_reports';
|
||||||
const V_CHANGE_CRON_JOB = 'v_change_sys_cron_job';
|
const V_CHANGE_CRON_JOB = 'v_change_sys_cron_job';
|
||||||
const V_SUSPEND_CRON_JOB = 'v_suspend_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_SUSPEND_CRON_JOBS = 'v_suspend_sys_cron_jobs';
|
||||||
const V_UNSUSPEND_CRON_JOB = 'v_unsuspend_sys_cron_job';
|
const V_UNSUSPEND_CRON_JOB = 'v_unsuspend_sys_cron_job';
|
||||||
const V_UNSUSPEND_CRON_JOBS = 'v_unsuspend_sys_cron_jobs';
|
const V_UNSUSPEND_CRON_JOBS = 'v_unsuspend_sys_cron_jobs';
|
||||||
const V_DEL_CRON_JOB = 'v_del_sys_cron';
|
const V_DEL_CRON_JOB = 'v_del_sys_cron';
|
||||||
const V_DEL_SYS_USER_REPORTS = 'v_del_sys_user_reports';
|
const V_DEL_SYS_USER_REPORTS = 'v_del_sys_user_reports';
|
||||||
// USER
|
// USER
|
||||||
const V_LIST_SYS_USERS = 'v_list_sys_users';
|
const V_LIST_SYS_USERS = 'v_list_sys_users';
|
||||||
const V_ADD_SYS_USER = 'v_add_sys_user';
|
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_CONTACT = 'v_change_sys_user_contact';
|
||||||
const V_CHANGE_SYS_USER_NS = 'v_change_sys_user_ns';
|
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_PACKAGE = 'v_change_sys_user_package';
|
||||||
const V_CHANGE_SYS_USER_PASSWORD = 'v_change_sys_user_password';
|
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_SHELL = 'v_change_sys_user_shell';
|
||||||
const V_CHANGE_SYS_USER_ROLE = 'v_change_sys_user_role';
|
const V_CHANGE_SYS_USER_ROLE = 'v_change_sys_user_role';
|
||||||
const V_DEL_SYS_USER = 'v_del_sys_user';
|
const V_DEL_SYS_USER = 'v_del_sys_user';
|
||||||
// WEB_DOMAIN
|
// WEB_DOMAIN
|
||||||
const V_LIST_WEB_DOMAINS = 'v_list_web_domains';
|
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_ALIAS = 'v_list_web_domains_alias';
|
||||||
const V_LIST_WEB_DOMAINS_ELOG = 'v_list_web_domains_elog';
|
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_PROXY = 'v_list_web_domains_proxy';
|
||||||
const V_LIST_WEB_DOMAINS_SSL = 'v_list_web_domains_ssl';
|
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_DOMAINS_STATS = 'v_list_web_domains_stats';
|
||||||
const V_LIST_WEB_TEMPLATES = 'v_list_web_templates';
|
const V_LIST_WEB_TEMPLATES = 'v_list_web_templates';
|
||||||
const V_ADD_WEB_DOMAIN = 'v_add_web_domain';
|
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_ALIAS = 'v_add_web_domain_alias';
|
||||||
const V_ADD_WEB_DOMAIN_STAT = 'v_add_web_domain_stat';
|
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_STAT_AUTH = 'v_add_web_domain_stat_auth';
|
||||||
const V_ADD_WEB_DOMAIN_SSL = 'v_add_web_domain_ssl';
|
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_ELOG = 'v_add_web_domain_elog';
|
||||||
const V_ADD_WEB_DOMAIN_CGI = 'v_add_web_domain_cgi';
|
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_IP = 'v_change_web_domain_ip';
|
||||||
const V_CHANGE_WEB_DOMAIN_SSLCERT = 'v_change_web_domain_sslcert';
|
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_SSLHOME = 'v_change_web_domain_sslhome';
|
||||||
const V_CHANGE_WEB_DOMAIN_TPL = 'v_change_web_domain_tpl';
|
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_CGI = 'v_del_web_domain_cgi';
|
||||||
const V_DEL_WEB_DOMAIN_ELOG = 'v_del_web_domain_elog';
|
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_SSL = 'v_del_web_domain_ssl';
|
||||||
const V_DEL_WEB_DOMAIN_STAT = 'v_del_web_domain_stat';
|
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_STAT_AUTH = 'v_del_web_domain_stat_auth';
|
||||||
const V_DEL_WEB_DOMAIN_ALIAS = 'v_del_web_domain_alias';
|
const V_DEL_WEB_DOMAIN_ALIAS = 'v_del_web_domain_alias';
|
||||||
const V_SUSPEND_WEB_DOMAIN = 'v_suspend_web_domain';
|
const V_SUSPEND_WEB_DOMAIN = 'v_suspend_web_domain';
|
||||||
const V_SUSPEND_WEB_DOMAINS = 'v_suspend_web_domains';
|
const V_SUSPEND_WEB_DOMAINS = 'v_suspend_web_domains';
|
||||||
const V_UNSUSPEND_WEB_DOMAIN = 'v_unsuspend_web_domain';
|
const V_UNSUSPEND_WEB_DOMAIN = 'v_unsuspend_web_domain';
|
||||||
const V_UNSUSPEND_WEB_DOMAINS = 'v_unsuspend_web_domains';
|
const V_UNSUSPEND_WEB_DOMAINS = 'v_unsuspend_web_domains';
|
||||||
const V_UPD_WEB_DOMAIN_DISK = 'v_upd_web_domain_disk';
|
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_DOMAINS_DISK = 'v_upd_web_domains_disk';
|
||||||
const V_UPD_WEB_DOMAIN_TRAFF = 'v_upd_web_domain_traff';
|
const V_UPD_WEB_DOMAIN_TRAFF = 'v_upd_web_domain_traff';
|
||||||
const V_UPD_WEB_DOMAINS_TRAFF = 'v_upd_web_domains_traff';
|
const V_UPD_WEB_DOMAINS_TRAFF = 'v_upd_web_domains_traff';
|
||||||
const V_DEL_WEB_DOMAIN = 'v_del_web_domain';
|
const V_DEL_WEB_DOMAIN = 'v_del_web_domain';
|
||||||
// DB
|
// DB
|
||||||
const V_LIST_DB_BASES = 'v_list_db_bases';
|
const V_LIST_DB_BASES = 'v_list_db_bases';
|
||||||
const V_LIST_DB_HOSTS = 'v_list_db_hosts';
|
const V_LIST_DB_HOSTS = 'v_list_db_hosts';
|
||||||
const V_ADD_DB_BASE = 'v_add_db_base';
|
const V_ADD_DB_BASE = 'v_add_db_base';
|
||||||
const V_ADD_DB_HOST = 'v_add_db_host';
|
const V_ADD_DB_HOST = 'v_add_db_host';
|
||||||
const V_SUSPEND_DB_BASE = 'v_suspend_db_base';
|
const V_SUSPEND_DB_BASE = 'v_suspend_db_base';
|
||||||
const V_SUSPEND_DB_BASES = 'v_suspend_db_bases';
|
const V_SUSPEND_DB_BASES = 'v_suspend_db_bases';
|
||||||
const V_UNSUSPEND_DB_BASE = 'v_unsuspend_db_base';
|
const V_UNSUSPEND_DB_BASE = 'v_unsuspend_db_base';
|
||||||
const V_UNSUSPEND_DB_BASES = 'v_unsuspend_db_bases';
|
const V_UNSUSPEND_DB_BASES = 'v_unsuspend_db_bases';
|
||||||
const V_CHANGE_DB_PASSWORD = 'v_change_db_password';
|
const V_CHANGE_DB_PASSWORD = 'v_change_db_password';
|
||||||
const V_DEL_DB_BASE = 'v_del_db_base';
|
const V_DEL_DB_BASE = 'v_del_db_base';
|
||||||
const V_DEL_DB_HOST = 'v_del_db_host';
|
const V_DEL_DB_HOST = 'v_del_db_host';
|
||||||
const V_UPD_DB_BASE_DISK = 'v_upd_db_base_disk';
|
const V_UPD_DB_BASE_DISK = 'v_upd_db_base_disk';
|
||||||
const V_UPD_DB_BASES_DISK = 'v_upd_db_bases_disk';
|
const V_UPD_DB_BASES_DISK = 'v_upd_db_bases_disk';
|
||||||
const PARAM_DELIMETER = ' ';
|
const PARAM_DELIMETER = ' ';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute vesta command
|
* Execute vesta command
|
||||||
|
@ -114,8 +114,8 @@ class Vesta
|
||||||
*/
|
*/
|
||||||
static function execute($cmd_command, $parameters=array())
|
static function execute($cmd_command, $parameters=array())
|
||||||
{
|
{
|
||||||
$r = new Request();
|
$r = new Request();
|
||||||
$_DEBUG = $r->getParameter("debug", FALSE);
|
$_DEBUG = $r->getParameter("debug", FALSE);
|
||||||
|
|
||||||
if (!isset($cmd_command))
|
if (!isset($cmd_command))
|
||||||
{
|
{
|
||||||
|
@ -123,51 +123,51 @@ class Vesta
|
||||||
}
|
}
|
||||||
|
|
||||||
$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'),
|
||||||
'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']}";
|
$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('status' => TRUE,
|
$result = array('status' => TRUE,
|
||||||
'data' => '',
|
'data' => '',
|
||||||
'error_code' => '',
|
'error_code' => '',
|
||||||
'error_message' => ''
|
'error_message' => ''
|
||||||
);
|
);
|
||||||
|
|
||||||
// TODO: please remove this later :)
|
// TODO: please remove this later :)
|
||||||
if ($_DEBUG)
|
if ($_DEBUG)
|
||||||
{
|
{
|
||||||
$result['debug'] = array(
|
$result['debug'] = array(
|
||||||
"cmd" => $cmd,
|
"cmd" => $cmd,
|
||||||
"output" => $output,
|
"output" => $output,
|
||||||
"return" => $return
|
"return" => $return
|
||||||
);
|
);
|
||||||
if ($debug == 2)
|
if ($debug == 2)
|
||||||
{
|
{
|
||||||
echo '<p>'.$cmd;
|
echo '<p>'.$cmd;
|
||||||
echo '<br> output: '; print_r($output);
|
echo '<br> output: '; print_r($output);
|
||||||
echo '<br> return: '.$return;
|
echo '<br> return: '.$return;
|
||||||
echo '</p>';
|
echo '</p>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!!(int)$return)
|
if (!!(int)$return)
|
||||||
{
|
{
|
||||||
$result['status'] = FALSE;
|
$result['status'] = FALSE;
|
||||||
$result['error_code'] = (int)$return;
|
$result['error_code'] = (int)$return;
|
||||||
$result['error_message'] = implode('', $output);
|
$result['error_message'] = implode('', $output);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$result['data'] = json_decode(implode('', $output), true);
|
$result['data'] = json_decode(implode('', $output), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,17 +13,17 @@ class ProtectionException extends Exception
|
||||||
{
|
{
|
||||||
const CODE_GENERAL = 0;
|
const CODE_GENERAL = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Protection exception
|
* Protection exception
|
||||||
*/
|
*/
|
||||||
public function __construct($message, $code=self::CODE_GENERAL, $previous=null)
|
public function __construct($message, $code=self::CODE_GENERAL, $previous=null)
|
||||||
{
|
{
|
||||||
parent::__construct($message, $code, $previous);
|
parent::__construct($message, $code, $previous);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Renders error message
|
* Renders error message
|
||||||
*/
|
*/
|
||||||
public function __toString()
|
public function __toString()
|
||||||
{
|
{
|
||||||
print $this->message;
|
print $this->message;
|
||||||
|
|
|
@ -11,15 +11,15 @@
|
||||||
*/
|
*/
|
||||||
class Message
|
class Message
|
||||||
{
|
{
|
||||||
|
|
||||||
const ERROR = 'error';
|
const ERROR = 'error';
|
||||||
const REQUEST_INVALID = 'Malformed request';
|
const REQUEST_INVALID = 'Malformed request';
|
||||||
const REQUEST_IS_NOT_POST = 'Request is not POST';
|
const REQUEST_IS_NOT_POST = 'Request is not POST';
|
||||||
const GENERAL_ERROR = 'General protection fault';
|
const GENERAL_ERROR = 'General protection fault';
|
||||||
const METHOD_NOT_EXIST = 'Message not exist';
|
const METHOD_NOT_EXIST = 'Message not exist';
|
||||||
const INVALID_METHOD = 'Method Invalid';
|
const INVALID_METHOD = 'Method Invalid';
|
||||||
const SYSTEM_ERROR = 'System Error';
|
const SYSTEM_ERROR = 'System Error';
|
||||||
const PROTECTION_ERROR = 'Protection error';
|
const PROTECTION_ERROR = 'Protection error';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,28 +14,28 @@ function error_dumper($errno, $errstr, $errfile, $errline)
|
||||||
$o.= " Fatal error on line $errline in file $errfile";
|
$o.= " Fatal error on line $errline in file $errfile";
|
||||||
$o.= ", PHP " . PHP_VERSION . " (" . PHP_OS . ")\n";
|
$o.= ", PHP " . PHP_VERSION . " (" . PHP_OS . ")\n";
|
||||||
$o.= "Aborting...\n";
|
$o.= "Aborting...\n";
|
||||||
fwrite($log, $o);
|
fwrite($log, $o);
|
||||||
fclose($log);
|
fclose($log);
|
||||||
exit(1);
|
exit(1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case E_USER_WARNING:
|
case E_USER_WARNING:
|
||||||
$o = "WARNING: [$errno] $errstr\n";
|
$o = "WARNING: [$errno] $errstr\n";
|
||||||
fwrite($log, $o);
|
fwrite($log, $o);
|
||||||
fclose($log);
|
fclose($log);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case E_USER_NOTICE:
|
case E_USER_NOTICE:
|
||||||
$o = "NOTICE: [$errno] $errstr\n";
|
$o = "NOTICE: [$errno] $errstr\n";
|
||||||
fwrite($log, $o);
|
fwrite($log, $o);
|
||||||
fclose($log);
|
fclose($log);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
$o = "Unknown error type: [$errno] $errstr\n";
|
$o = "Unknown error type: [$errno] $errstr\n";
|
||||||
fwrite($log, $o);
|
fwrite($log, $o);
|
||||||
fclose($log);
|
fclose($log);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Don't execute PHP internal error handler */
|
/* Don't execute PHP internal error handler */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue