mirror of
https://github.com/myvesta/vesta
synced 2025-08-19 04:50:47 -07:00
php files cleaned, added php formatting
This commit is contained in:
parent
a163413043
commit
4df3488c00
5 changed files with 105 additions and 109 deletions
|
@ -5,8 +5,8 @@
|
|||
*
|
||||
* Reads, manipulate configs
|
||||
*
|
||||
* @author Malishev Dima <dima.malishev@gmail.com>
|
||||
* @author vesta, http://vestacp.com/
|
||||
* @author Dmitry Malishev <dima.malishev@gmail.com>
|
||||
* @copyright vesta 2010-2011
|
||||
*/
|
||||
class Config
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
* Api Main class
|
||||
* Calls / Executes native vesta methods
|
||||
*
|
||||
* @author Malishev Dima <dima.malishev@gmail.com>
|
||||
* @author Naumov-Socolov <naumov.socolov@gmail.com>
|
||||
* @author vesta, http://vestacp.com/
|
||||
* @author Dmitry Malishev <dima.malishev@gmail.com>
|
||||
* @author Dmitry Naumov-Socolov <naumov.socolov@gmail.com>
|
||||
* @copyright vesta 2010-2011
|
||||
*/
|
||||
class Vesta
|
||||
|
@ -117,8 +117,7 @@ class Vesta
|
|||
$r = new Request();
|
||||
$_DEBUG = $r->getParameter("debug", FALSE);
|
||||
|
||||
if (!isset($cmd_command))
|
||||
{
|
||||
if (!isset($cmd_command)) {
|
||||
throw new ProtectionException('No function name passed into Vesta::execute'); // TODO: move msg to Messages::
|
||||
}
|
||||
|
||||
|
@ -134,22 +133,21 @@ class Vesta
|
|||
exec($cmd, $output, $return);
|
||||
|
||||
$result = 0;
|
||||
$result = array('status' => TRUE,
|
||||
$result = array(
|
||||
'status' => TRUE,
|
||||
'data' => '',
|
||||
'error_code' => '',
|
||||
'error_message' => ''
|
||||
);
|
||||
|
||||
// TODO: please remove this later :)
|
||||
if ($_DEBUG)
|
||||
{
|
||||
if ($_DEBUG) {
|
||||
$result['debug'] = array(
|
||||
"cmd" => $cmd,
|
||||
"output" => $output,
|
||||
"return" => $return
|
||||
);
|
||||
if ($debug == 2)
|
||||
{
|
||||
if ($debug == 2) {
|
||||
echo '<p>'.$cmd;
|
||||
echo '<br> output: '; print_r($output);
|
||||
echo '<br> return: '.$return;
|
||||
|
@ -157,14 +155,12 @@ class Vesta
|
|||
}
|
||||
}
|
||||
|
||||
if (!!(int)$return)
|
||||
{
|
||||
if (!!(int)$return) {
|
||||
$result['status'] = FALSE;
|
||||
$result['error_code'] = (int)$return;
|
||||
$result['error_message'] = implode('', $output);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
$result['data'] = json_decode(implode('', $output), true);
|
||||
}
|
||||
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
*
|
||||
* Thrown if unexpected action or behaviour detected
|
||||
*
|
||||
* @author Malishev Dima <dima.malishev@gmail.com>
|
||||
* @author vesta, http://vestacp.com/
|
||||
* @author Dmitry Malishev <dima.malishev@gmail.com>
|
||||
* @copyright vesta 2010-2011
|
||||
*/
|
||||
class ProtectionException extends Exception
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
* - system error occured
|
||||
* - unpredictable scenarios
|
||||
*
|
||||
* @author Malishev Dima <dima.malishev@gmail.com>
|
||||
* @author vesta, http://vestacp.com/
|
||||
* @author Dmitry Malishev <dima.malishev@gmail.com>
|
||||
* @copyright vesta 2010-2011
|
||||
*/
|
||||
class SystemException extends Exception {
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
*
|
||||
* Contains messages, that are used in the code.
|
||||
*
|
||||
* @author Malishev Dima <dima.malishev@gmail.com>
|
||||
* @author vesta, http://vestacp.com/
|
||||
* @author Dmitry Malishev <dima.malishev@gmail.com>
|
||||
* @copyright vesta 2010-2011
|
||||
*/
|
||||
class Message
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue