Malishev Dima 14 лет назад
Родитель
Сommit
4301323162

+ 0 - 82
web/vesta/api/AjaxHandler.php~

@@ -1,82 +0,0 @@
-<?php
-
-/**
- * Ajax Handler
- * 
- * @author vesta, http://vestacp.com/
- * @copyright vesta 2010
- */
-class AjaxHandler {
-
-    static public $instance = null;
-
-    /**
-     * Grab current instance or create it
-     *
-     * @return <type>
-     */
-    static function getInstance($request=null) {
-        return null == self::$instance ? self::$instance = new self() : self::$instance;
-    }
-
-    /**
-     * Called functions should reply in the following way
-     * return $this->reply($result, $data, $msg, $extra);
-     * 
-     * @param type $request
-     * @return type 
-     */
-    function dispatch($request) {
-        $method = Request::parseAjaxMethod($request);
-        $inc_file = V_ROOT_DIR . 'api' . DIRECTORY_SEPARATOR . $method['namespace'] . '.class.php';
-        if (!is_readable($inc_file)) {
-            throw new SystemException(Message::INVALID_METHOD);
-        }
-
-        require $inc_file;
-
-        $space = new $method['namespace'];
-        $method = $method['function'] . 'Execute';
-
-        if (!method_exists($space, $method)) {
-            throw new SystemException(Message::INVALID_METHOD);
-        }
-
-        return $space->$method($request);
-    }
-
-    function reply($result, $data, $message = '', $extra = array()) {
-        return json_encode(array('result' => $result,
-            'data' => $data,
-            'message' => $message,
-            'extra' => $extra));
-    }
-
-    static function makeReply($reply) {
-        print $reply;
-    }
-
-    //
-    // Error handlers
-    //
-    
-    static function generalError($error) {
-        self::renderGlobalError(Message::ERROR, Message::GENERAL_ERROR, $error);
-    }
-
-    static function protectionError($error) {
-        self::renderGlobalError(Message::ERROR, Message::PROTECTION_ERROR, $error);
-    }
-
-    static function systemError($error) {
-        self::renderGlobalError(Message::ERROR, Message::SYSTEM_ERROR, $error);
-    }
-
-    static function renderGlobalError($type, $message, $error) {
-        $trace = $error->getTrace();
-        AjaxHandler::makeReply(
-                        AjaxHandler::getInstance()->reply(false, $type, $message . ': ' . $error->getMessage(), $trace[0]['file'] . ' / ' . $trace[0]['line'])
-        );
-    }
-
-}

+ 0 - 229
web/vesta/api/CRON.class.php~

@@ -1,229 +0,0 @@
-<?php
-/*
- * CRON 
- * 
- * @author vesta, http://vestacp.com/
- * @copyright vesta 2010 
- */
-class CRON extends AjaxHandler {
-    function getInitialParamsExecute($request) 
-    {
-        $reply = array();
-
-        return $this->reply(true, $reply);
-    }
-
-
-  function getListExecute($request) 
-  {
-    $_user = 'vesta';
-    $reply = array();
-    
-    $result = Vesta::execute(Vesta::V_LIST_CRON_JOBS, array($_user, Config::get('response_type')));
-    
-    //	echo '<pre>';
-    //	print_r($result);
-
-    foreach($result['data'] as $id => $record)
-      {
-	$reply[$id] = array(
-			    'CMD' => $record['CMD'],
-			    'MIN' => $record['MIN'],
-			    'HOUR' => $record['HOUR'],
-			    'DAY' => $record['DAY'],
-			    'MONTH' => $record['MONTH'],
-			    'WDAY' => $record['WDAY'],
-			    'SUSPEND' => $record['SUSPEND'],
-			    'DATE' => date(Config::get('ui_date_format', strtotime($record['DATE'])))
-			    );
-      }
-    
-    if(!$result['status'])
-      $this->errors[] = array($result['error_code'] => $result['error_message']);
-    
-    return $this->reply($result['status'], $reply);
-  }
-
-
-    
-  function addExecute($request) 
-  {
-    $r = new Request();
-    $_s = $r->getSpell();
-    $_user = 'vesta';
-    
-    $params = array(
-		    'USER' => $_user,
-		    'MIN' => $_s['MIN'],
-		    'HOUR' => $_s['HOUR'],
-		    'DAY' => $_s['DAY'],
-		    'MONTH' => $_s['MONTH'],
-		    'WDAY' => $_s['WDAY'],
-		    'CMD' => $_s['CMD']
-		    );
-    
-    $result = Vesta::execute(Vesta::V_ADD_CRON_JOB, $params);
-
-
-    if($_s['REPORTS'])
-      {
-	$result = array();
-	$result = Vesta::execute(Vesta::V_ADD_SYS_USER_REPORTS, array('USER' => $_user));
-	if(!$result['status'])
-	  {
-	    $this->status = FALSE;
-	    $this->errors['REPORTS'] = array($result['error_code'] => $result['error_message']);
-	  }
-      }
-
-    if(!$result['status'])
-      $this->errors[] = array($result['error_code'] => $result['error_message']);
-    
-    return $this->reply($result['status'], $result['data']);
-  }
-  
-  
-    
-  function delExecute($request) 
-  {
-    $r = new Request();
-    $_s = $r->getSpell();
-    $_user = 'vesta';
-    
-    $params = array(
-		    'USER' => $_user,
-		    'JOB' => $_s['JOB']
-		    );
-    
-    $result = Vesta::execute(Vesta::V_DEL_CRON_JOB, $params);
-    
-    if(!$result['status'])
-      $this->errors[] = array($result['error_code'] => $result['error_message']);
-    
-    return $this->reply($result['status'], $result['data']);
-  }
-  
-    
-  
-  function changeExecute($request)
-  {
-    $r = new Request();
-    $_s = $r->getSpell();
-    $_old = $_s['old'];
-    $_new = $_s['new'];
-
-    $_user = 'vesta';
-    $_JOB = $_new['JOB'];
-    
-    $result = array();
-    $params = array(
-		    'USER' => $_user,
-		    'JOB' => $_JOB,
-		    'MIN' => $_new['MIN'],
-		    'HOUR' => $_new['HOUR'],
-		    'DAY' => $_new['DAY'],
-		    'MONTH' => $_new['MONTH'],
-		    'WDAY' => $_new['WDAY'],
-		    'CMD' => $_new['CMD']
-		    );
-
-    $result = Vesta::execute(Vesta::V_CHANGE_CRON_JOB, $params);
-
-
-    
-    if(!$result['status'])
-      $this->errors[] = array($result['error_code'] => $result['error_message']);
-    
-    return $this->reply($result['status'], $result['data']);
-  }
-
-
-
-  function suspendExecute($request)
-  {
-    $r = new Request();
-    $_s = $r->getSpell();
-
-    $_user = 'vesta';
-    $_JOB = $_s['JOB'];
-    
-    $params = array(
-		    'USER' => $_user,
-		    'JOB' => $_JOB
-		    );
-    
-    $result = Vesta::execute(Vesta::V_SUSPEND_CRON_JOB, $params);
-    
-    if(!$result['status'])
-      $this->errors[] = array($result['error_code'] => $result['error_message']);
-    
-    return $this->reply($result['status'], $result['data']);
-  }
-
-
-
-  function unsuspendExecute($request)
-  {
-    $r = new Request();
-    $_s = $r->getSpell();
-
-    $_user = 'vesta';
-    $_JOB = $_s['JOB'];
-    
-    $params = array(
-		    'USER' => $_user,
-		    'JOB' => $_JOB
-		    );
-    
-    $result = Vesta::execute(Vesta::V_UNSUSPEND_CRON_JOB, $params);
-    
-    if(!$result['status'])
-      $this->errors[] = array($result['error_code'] => $result['error_message']);
-    
-    return $this->reply($result['status'], $result['data']);
-  }
-
-
-
-  function suspendAllExecute($request)
-  {
-    $r = new Request();
-    $_s = $r->getSpell();
-
-    $_user = 'vesta';
-    $_JOB = $_s['JOB'];
-    
-    $params = array(
-		    'USER' => $_user
-		    );
-    
-    $result = Vesta::execute(Vesta::V_SUSPEND_CRON_JOBS, $params);
-    
-    if(!$result['status'])
-      $this->errors[] = array($result['error_code'] => $result['error_message']);
-    
-    return $this->reply($result['status'], $result['data']);
-  }
-
-
-
-  function unsuspendAllExecute($request)
-  {
-    $r = new Request();
-    $_s = $r->getSpell();
-
-    $_user = 'vesta';
-    
-    $params = array(
-		    'USER' => $_user
-		    );
-    
-    $result = Vesta::execute(Vesta::V_UNSUSPEND_CRON_JOBS, $params);
-    
-    if(!$result['status'])
-      $this->errors[] = array($result['error_code'] => $result['error_message']);
-    
-    return $this->reply($result['status'], $result['data']);
-  }
-   
-}

+ 0 - 215
web/vesta/api/DB.class.php~

@@ -1,215 +0,0 @@
-<?php
-
-/**
- * DB 
- * 
- * @author vesta, http://vestacp.com/
- * @copyright vesta 2011
- */
-class DB extends AjaxHandler {
-    {
-	require_once V_ROOT_DIR . 'api/IP.class.php';
-
-        $ip_obj = new IP();
-        $user_ips = json_decode($ip_obj->getListUserIpsExecute(), TRUE);
-
-	foreach($user_ips['data'] as $ip)
-	    $ips[$ip['IP_ADDRESS']] = $ip['IP_ADDRESS'];
-
-
-        $reply = array(
-	    'TYPE' => $db_types
-        );
-
-
-        return $this->reply(true, $reply);
-    }
-
-
-    function getListExecute($request) 
-    {
-    $_user = 'vesta';
-    $reply = array();
-    
-    $result = Vesta::execute(Vesta::V_LIST_DB_BASES, array($_user, Config::get('response_type')));
-    
-    //    echo '<pre>';
-    //    print_r($result);
-
-    foreach($result['data'] as $db => $record)
-      {
-	$reply[$db] = array(
-			    'DB' => $db,
-			    'USER' => $record['USER'],
-			    'HOST' => $record['HOST'],
-			    'TYPE' => $record['TYPE'],
-			    'U_DISK' => $record['U_DISK'],
-			    'SUSPEND' => $record['SUSPEND'],
-			    'DATE' => date(Config::get('ui_date_format', strtotime($record['DATE'])))
-			    );
-      }
-    
-    if(!$result['status'])
-      $this->errors[] = array($result['error_code'] => $result['error_message']);
-    
-    return $this->reply($result['status'], $reply);
-  }
-
-  function addExecute($request) 
-  {
-    $r = new Request();
-    $_s = $r->getSpell();
-    $_user = 'vesta';
-
-    $params = array(
-		    'USER' => $_user,
-		    'DB' => $_s['DB'],
-		    'DB_USER' => $_s['DB_USER'],
-		    'DB_PASSWORD' => $_s['DB_PASSWORD'],
-		    'TYPE' => $_s['TYPE']
-		    );
-    if($_s['HOST'])
-      $params['HOST'] = $_s['HOST'];
-    
-    $result = Vesta::execute(Vesta::V_ADD_DB_BASE, $params);
-
-
-    if(!$result['status'])
-      $this->errors[] = array($result['error_code'] => $result['error_message']);
-    
-    return $this->reply($result['status'], $result['data']);
-  }
-  
-  
-    
-  function delExecute($request) 
-  {
-    $r = new Request();
-    $_s = $r->getSpell();
-    $_user = 'vesta';
-    
-    $params = array(
-		    'USER' => $_user,
-		    'DB' => $_user.'_'.$_s['DB']
-		    );
-    
-    $result = Vesta::execute(Vesta::V_DEL_DB_BASE, $params);
-    
-    if(!$result['status'])
-      $this->errors[] = array($result['error_code'] => $result['error_message']);
-    
-    return $this->reply($result['status'], $result['data']);
-  }
-  
-    
-  
-  function changePasswordExecute($request)
-  {
-    $r = new Request();
-    $_s = $r->getSpell();
-
-    $_user = 'vesta';
-    
-    $result = array();
-    $params = array(
-		    'USER' => $_user,
-		    'DB' => $_user.'_'.$_s['DB'],
-		    'PASSWORD' => $_s['DB_PASSWORD']
-		    );
-
-    $result = Vesta::execute(Vesta::V_CHANGE_DB_PASSWORD, $params);
-    
-    if(!$result['status'])
-      $this->errors[] = array($result['error_code'] => $result['error_message']);
-    
-    return $this->reply($result['status'], $result['data']);
-  }
-
-
-
-  function suspendExecute($request)
-  {
-    $r = new Request();
-    $_s = $r->getSpell();
-
-    $_user = 'vesta';
-    
-    $params = array(
-		    'USER' => $_user,
-		    'DB' => $_user.'_'.$_s['DB']
-		    );
-    
-    $result = Vesta::execute(Vesta::V_SUSPEND_DB_BASE, $params);
-    
-    if(!$result['status'])
-      $this->errors[] = array($result['error_code'] => $result['error_message']);
-    
-    return $this->reply($result['status'], $result['data']);
-  }
-
-
-
-  function unsuspendExecute($request)
-  {
-    $r = new Request();
-    $_s = $r->getSpell();
-
-    $_user = 'vesta';
-    
-    $params = array(
-		    'USER' => $_user,
-		    'DB' => $_user.'_'.$_s['DB']
-		    );
-    
-    $result = Vesta::execute(Vesta::V_UNSUSPEND_DB_BASE, $params);
-    
-    if(!$result['status'])
-      $this->errors[] = array($result['error_code'] => $result['error_message']);
-    
-    return $this->reply($result['status'], $result['data']);
-  }
-
-
-
-  function suspendAllExecute($request)
-  {
-    $r = new Request();
-    $_s = $r->getSpell();
-
-    $_user = 'vesta';
-    $_JOB = $_s['JOB'];
-    
-    $params = array(
-		    'USER' => $_user
-		    );
-    
-    $result = Vesta::execute(Vesta::V_SUSPEND_DB_BASES, $params);
-    
-    if(!$result['status'])
-      $this->errors[] = array($result['error_code'] => $result['error_message']);
-    
-    return $this->reply($result['status'], $result['data']);
-  }
-
-
-
-  function unsuspendAllExecute($request)
-  {
-    $r = new Request();
-    $_s = $r->getSpell();
-
-    $_user = 'vesta';
-    
-    $params = array(
-		    'USER' => $_user
-		    );
-    
-    $result = Vesta::execute(Vesta::V_UNSUSPEND_DB_BASES, $params);
-    
-    if(!$result['status'])
-      $this->errors[] = array($result['error_code'] => $result['error_message']);
-    
-    return $this->reply($result['status'], $result['data']);
-  }
-    
-}

+ 0 - 339
web/vesta/api/DNS.class.php~

@@ -1,339 +0,0 @@
-<?php
-
-/**
- * DNS 
- * 
- * @author vesta, http://vestacp.com/
- * @copyright vesta 2010 
- */
-
-class DNS extends AjaxHandler {
-    function getInitialParamsExecute($request) 
-    {
-	require_once V_ROOT_DIR . 'api/IP.class.php';
-
-        $ip_obj = new IP();
-        $user_ips = json_decode($ip_obj->getListUserIpsExecute(), TRUE);
-
-	foreach($user_ips['data'] as $ip)
-	    $ips[$ip['IP_ADDRESS']] = $ip['IP_ADDRESS'];
-
-
-        $reply = array(
-	    'IP' => $ips,
-	    'TPL' => array('default' => 'default'),
-	    'EXP' => array(),
-	    'SOA' => array(),
-	    'TTL' => array(),
-	    'record' => array(
-                'RECORD' => array(),
-		'RECORD_TYPE' => array(),
-		'RECORD_VALUE' => array()
-		)
-        );
-
-
-        return $this->reply(true, $reply);
-    }
-
-
-    function getListExecute($request) {
-        $_user = 'vesta';
-        $reply = array();
-       
-        $result = Vesta::execute(Vesta::V_LIST_DNS_DOMAINS, array($_user, Config::get('response_type')));
-        foreach($result['data'] as $dns_domain => $details){
-            $reply[] = array(
-			     'DNS_DOMAIN' => $dns_domain,
-			     'IP' => $details['IP'],
-			     'TPL' => $details['TPL'],
-			     'TTL' => $details['TTL'],
-			     'EXP' => $details['EXP'],
-			     'SOA' => $details['SOA'],
-			     'SUSPEND' => $details['SUSPEND'],
-			     //			     'OWNER' => $details['OWNER'],
-			     'DATE' => date(Config::get('ui_date_format', strtotime($details['DATE'])))
-			     );
-        }
-        if(!$result['status'])
-	  $this->errors[] = array($result['error_code'] => $result['error_message']);
-     
-	return $this->reply($result['status'], $reply);
-    }
-
-    function getListRecordsExecute($request) {
-	$r = new Request();
-	$_s = $r->getSpell();
-	$_user = 'vesta';
-
-        $reply = array();
-       
-        $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){
-            $reply[$record_id] = array(
-			     'RECORD_ID' => $record_id,
-			     'RECORD' => $details['RECORD'],
-			     'RECORD_TYPE' => $details['TYPE'],
-			     'RECORD_VALUE' => $details['VALUE'],
-			     'SUSPEND' => $details['SUSPEND'],
-			     'DATE' => date(Config::get('ui_date_format', strtotime($details['DATE'])))
-			     );
-        }
-
-        if(!$result['status'])
-	  $this->errors[] = array($result['error_code'] => $result['error_message']);
-     
-	return $this->reply($result['status'], $reply);
-    }
-
-    // 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
-    function addExecute($_spell = false) 
-    {
-      $r = new Request();
-      if($_spell)
-	$_s = $_spell;
-      else
-	$_s = $r->getSpell();
-
-      $_user = 'vesta';
-	
-	$params = array(
-			'USER' => $_user,  /// OWNER ???
-			'DNS_DOMAIN' => $_s['DNS_DOMAIN'],
-			'IP' => $_s['IP']);
-	if($_s['TPL']) $params['TPL'] = $_s['TPL'];
-	if($_s['EXP']) $params['EXP'] = $_s['EXP'];
-	if($_s['SOA']) $params['SOA'] = $_s['SOA'];
-	if($_s['TTL']) $params['TTL'] = $_s['TTL'];
-	
-        $result = Vesta::execute(Vesta::V_ADD_DNS_DOMAIN, $params);
-        if(!$result['status'])
-	  $this->errors[] = array($result['error_code'] => $result['error_message']);
-
-        return $this->reply($result['status'], $result['data']);
-    }
-
-    // v_add_dns_domain_record user domain record type value [id]
-    // http://95.163.16.160:8083/dispatch.php?jedi_method=DNS.addRecord&USER=vesta&DOMAIN=dev.vestacp.com&RECORD=ftp&TYPE=a&VALUE=87.248.190.222
-    function addRecordExecute($request) {
-	$r = new Request();
-	$_s = $r->getSpell();
-	$_user = 'vesta';
-
-	$params = array(
-			'USER' => $_s['USER'],  /// OWNER ???
-			'DOMAIN' => $_s['DOMAIN'],
-			'RECORD' => $_s['RECORD'],
-			'RECORD_TYPE' => $_s['TYPE'],
-			'RECORD_VALUE' => $_s['VALUE'],
-			'RECORD_ID' => $_s['RECORD_ID']
-			);
-	
-	// print_r($params);
-        
-        $result = Vesta::execute(Vesta::V_ADD_DNS_DOMAIN_RECORD, $params);
- 	
-        if(!$result['status'])
-	  $this->errors[] = array($result['error_code'] => $result['error_message']);
-
-        return $this->reply($result['status'], $result['data']);
-    }
-
-
-    // v_del_dns_domain user domain
-    // http://95.163.16.160:8083/dispatch.php?jedi_method=DNS.del&USER=vesta&DOMAIN=dev.vestacp.com
-    function delExecute($_spell = false) 
-    {
-      $r = new Request();
-      if($_spell)
-	$_s = $_spell;
-      else
-	$_s = $r->getSpell();
-      
-      $_user = 'vesta';
-	
-	$params = array(
-			'USER' => $_user,  /// OWNER ???
-			'DOMAIN' => $_s['DNS_DOMAIN'],
-			);
-	
-        $result = Vesta::execute(Vesta::V_DEL_DNS_DOMAIN, $params);
-
-        if(!$result['status'])
-	  $this->errors[] = array($result['error_code'] => $result['error_message']);
-
-        return $this->reply($result['status'], $result['data']);
-    }
-
-
-
-    // v_del_dns_domain_record user domain id 
-    // http://95.163.16.160:8083/dispatch.php?jedi_method=DNS.delRecord&USER=vesta&DOMAIN=dev.vestacp.com&RECORD_ID=9
-    function delRecordExecute($request) {
-	$r = new Request();
-	$_s = $r->getSpell();
-        $_user = 'vesta';
-	
-	$params = array(
-			'USER' => $_user,  /// OWNER ???
-			'DOMAIN' => $_s['DOMAIN'],
-			'RECORD_ID' => $_s['RECORD_ID']
-			);
-	
-        $result = Vesta::execute(Vesta::V_DEL_DNS_DOMAIN_RECORD, $params);
- 	
-        if(!$result['status'])
-	  $this->errors[] = array($result['error_code'] => $result['error_message']);
-
-        return $this->reply($result['status'], $result['data']);
-    }
-
-
-
-    // DNS.change&spell={"old":{"DNS_DOMAIN": "dev.vestacp.com","IP": "95.163.16.160","TPL": "default","TTL": "3377","EXP": "12-12-12","SOA": "ns2.vestacp.com"},"new":{"DNS_DOMAIN": "dev.vestacp.com","IP": "95.163.16.160","TPL": "default","TTL": "3600","EXP": "02-02-12","SOA": "ns1.vestacp.com"}}
-
-    function changeExecute($request)
-    {
-	$r = new Request();
-	$_s = $r->getSpell();
-	$_old = $_s['old'];
-	$_new = $_s['new'];
-
-	$_user = 'vesta';
-
-        $_DNS_DOMAIN = $_new['DNS_DOMAIN'];
-
-	 
-	if($_old['IP'] != $_new['IP'])
-	  {
-	    $result = array();
-	    $result = Vesta::execute(Vesta::V_CHANGE_DNS_DOMAIN_IP, array('USER' => $_user, 'DNS_DOMAIN' => $_DNS_DOMAIN, 'IP' => $_new['IP']));
-	    if(!$result['status'])
-	      {
-		$this->status = FALSE;
-		$this->errors['IP_ADDRESS'] = array($result['error_code'] => $result['error_message']);
-	      }
-	  }
-	
-	if($_old['TPL'] != $_new['TPL'])
-	  {
-	    $result = array();
-	    $result = Vesta::execute(Vesta::V_CHANGE_DNS_DOMAIN_TPL, array('USER' => $_user, 'DNS_DOMAIN' => $_DNS_DOMAIN, 'IP' => $_new['TPL']));
-	    if(!$result['status'])
-	      {
-		$this->status = FALSE;
- 		$this->errors['TPL'] = array($result['error_code'] => $result['error_message']);
-	      }
-	  }
-	
-	if($_old['TTL'] != $_new['TTL'])
-	  {
-	    $result = array();
-	    $result = Vesta::execute(Vesta::V_CHANGE_DNS_DOMAIN_TTL, array('USER' => $_user, 'DNS_DOMAIN' => $_DNS_DOMAIN, 'IP' => $_new['TTL']));
-	    if(!$result['status'])
-	      {
-		$this->status = FALSE;
-		$this->errors['TTL'] = array($result['error_code'] => $result['error_message']);
-	      }
-	  }
-
-	if($_old['EXP'] != $_new['EXP'])
-	  {
-	    $result = array();
-	    $result = Vesta::execute(Vesta::V_CHANGE_DNS_DOMAIN_EXP, array('USER' => $_user, 'DNS_DOMAIN' => $_DNS_DOMAIN, 'IP' => $_new['EXP']));
-	    if(!$result['status'])
-	      {
-		$this->status = FALSE;
-		$this->errors['EXP'] = array($result['error_code'] => $result['error_message']);
-	      }
-	  }
-	
-	if($_old['SOA'] != $_new['SOA'])
-	  {
-	    $result = array();
-	    $result = Vesta::execute(Vesta::V_CHANGE_DNS_DOMAIN_SOA, array('USER' => $_user, 'DNS_DOMAIN' => $_new['DNS_DOMAIN'], 'IP' => $_new['SOA']));
-	    if(!$result['status'])
-	      {
-		$this->status = FALSE;
-		$this->errors['SOA'] = array($result['error_code'] => $result['error_message']);
-	      }
-	  }
-
-	    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_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_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']));
-	      }
-
-        return $this->reply($this->status, '');
-    }
-
-
-
-    function changeRecordsExecute($request)
-    {
-	$r = new Request();
-	$_s = $r->getSpell();
-	$_old = $_s['old'];
-	$_new = $_s['new'];
-
-	//	echo '<pre>';
-	//	print_r($_new);
-	//	print_r($_old);
-
-	$_user = 'vesta';
-
-        $_DNS_DOMAIN = $_s['DNS_DOMAIN'];
-
-	foreach($_new as $record_id => $record_data)
-	  {
-	    // checking if record existed - update
-	    if(is_array($_old[$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']));
-		if(!$result['status'])
-		  {
-		    $this->status = FALSE;
-		    $this->errors[$record_id] = array($result['error_code'] => $result['error_message']);
-		  }
-	      }
-	    else
-	      {
-		// record is new - add
-		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));
-		if(!$result['status'])
-		  {
-		    $this->status = FALSE;
-		    $this->errors[$record_id] = array($result['error_code'] => $result['error_message']);
-		  }
-	      }
-
-	    
-	    unset($_old[$record_id]);
-	  }
-
-	// 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)
-	  {
-		echo '<br> deleting'.$record_id;
-		/*
-		$result = Vesta::execute(Vesta::V_DEL_DNS_DOMAIN_RECORD, array('USER' => $_user, 'DNS_DOMAIN' => $_DNS_DOMAIN, 'ID' => $record_id,));
-		if(!$result['status'])
-		  {
-		    $this->status = FALSE;
-		    $this->errors[$record_id] = array($result['error_code'] => $result['error_message']);
-		  }
-		*/
-	  }
-
-        return $this->reply($this->status, '');
-    }
-}

+ 0 - 185
web/vesta/api/IP.class.php~

@@ -1,185 +0,0 @@
-<?php
-/**
- * IP 
- * 
- * @author vesta, http://vestacp.com/
- * @copyright vesta 2010 
- * 
- */
-class IP extends AjaxHandler
-{
-    function getInitialParamsExecute($request) 
-    {
-	require_once V_ROOT_DIR . 'api/USER.class.php';
-
-        $user_obj = new USER();
-        $users = json_decode($user_obj->getListExecute(), TRUE);
-
-	$user_names = array_keys($users['data']['data']);
-
-
-	/// v_list_sys_interfaces
-        $reply = array(
-            'SYS_USERS' => $user_names,
-            'STATUSES' => array(
-                'shared' => 'shared',
-                'exclusive' => 'exclusive'
-            ),
-            'INTERFACES' => array(
-                'eth1' => 'eth1',
-                'eth0' => 'eth0',
-                'wf0' => 'wf0'
-	    ),
-	    'MASK' => array(
-		'255.255.255.0' => '255.255.255.0',
-		'255.255.255.128' => '255.255.255.128',
-		'255.255.255.192' => '255.255.255.192',
-		'255.255.255.224' => '255.255.255.224', 
-		'255.255.255.240' => '255.255.255.240', 
-		'255.255.255.248' => '255.255.255.248',
-		'255.255.255.252' => '255.255.255.252',
-		'255.255.255.255' => '255.255.255.255'
-	     ),
- 	     'OWNER' => array()
-        );
-
-        return $this->reply(true, $reply);
-    }
-
-
-    function getListExecute($request) 
-    {
-        $reply = array();
-	
-        $result = Vesta::execute(Vesta::V_LIST_SYS_IPS, array(Config::get('response_type')));
-        foreach ($result['data'] as $ip => $details) {
-	  $reply[] = array_merge(
-				 array(
-				       'IP_ADDRESS' => $ip,
-				       'DATE' => date(Config::get('ui_date_format', strtotime($details['DATE'])))
-				       ), $details);
-        }
-	
-        if(!$result['status'])
-	  $this->errors[] = array($result['error_code'] => $result['error_message']);
-	
-	return $this->reply($result['status'], $reply);
-    }
-
-
-    function getListUserIpsExecute($request) 
-    {
-        $reply = array();
-	
-        $result = Vesta::execute(Vesta::V_LIST_SYS_IPS, array(Config::get('response_type')));
-        foreach ($result['data'] as $ip => $details) {
-	  $reply[] = array_merge(
-				 array(
-				       'IP_ADDRESS' => $ip,
-				       'DATE' => date(Config::get('ui_date_format', strtotime($details['DATE'])))
-				       ), $details);
-        }
-	
-        if(!$result['status'])
-	  $this->errors[] = array($result['error_code'] => $result['error_message']);
-	
-	return $this->reply($result['status'], $reply);
-    }
-    
-
-    function addExecute($request) 
-    {
-      $r = new Request();
-      $_s = $r->getSpell();
-      $_user = 'vesta';
-      
-      $params = array(
-		      'IP_ADDRESS' => $_s['IP_ADDRESS'],
-		      'MASK' => $_s['MASK'],
-		      'INTERFACE' => $_s['INTERFACE'],
-		      'OWNER' => $_s['OWNER'],
-		      'IP_STATUS' => $_s['IP_STATUS'],
-		      'IP_NAME' => $_s['IP_NAME']
-		      );
-      
-      $result = Vesta::execute(Vesta::V_ADD_SYS_IP, $params);
-      
-
-      if(!$result['status'])
-	$this->errors[] = array($result['error_code'] => $result['error_message']);
-      
-      return $this->reply($result['status'], $result['data']);
-    }
-
-    function delExecute($request) 
-    {
-      $r = new Request();
-      $_s = $r->getSpell();
-      $_user = 'vesta';
-      
-      $params = array(
-		    'IP_ADDRESS' => $_s['IP_ADDRESS']
-		    );
-      
-      $result = Vesta::execute(Vesta::V_DEL_SYS_IP, $params);
-      
-      if(!$result['status'])
-	$this->errors[] = array($result['error_code'] => $result['error_message']);
-      
-      return $this->reply($result['status'], $result['data']);
-    }
-
-
-  
-    function changeExecute($request)
-    {
-      $r = new Request();
-      $_s = $r->getSpell();
-      $_old = $_s['old'];
-      $_new = $_s['new'];
-      
-      $_user = 'vesta';
-
-    
-      if($_old['OWNER'] != $_new['OWNER'])
-	{
-	  $result = array();
-	  $result = Vesta::execute(Vesta::V_CHANGE_SYS_IP_OWNER, array('OWNER' => $_new['OWNER'], 'IP' => $_new['IP_ADDRESS']));
-	  if(!$result['status'])
-	    {
-	      $this->status = FALSE;
-	      $this->errors['OWNER'] = array($result['error_code'] => $result['error_message']);
-	    }
-	}
-
-      if($_old['NAME'] != $_new['NAME'])
-	{
-	  $result = array();
-	  $result = Vesta::execute(Vesta::V_CHANGE_SYS_IP_NAME, array('IP' => $_new['IP_ADDRESS'], 'NAME' => $_new['NAME']));
-	  if(!$result['status'])
-	    {
-	      $this->status = FALSE;
-	      $this->errors['NAME'] = array($result['error_code'] => $result['error_message']);
-	    }
-	}
-
-      if($_old['IP_STATUS'] != $_new['IP_STATUS'])
-	{
-	  $result = array();
-	  $result = Vesta::execute(Vesta::V_CHANGE_SYS_IP_STATUS, array('IP' => $_new['IP_ADDRESS'], 'IP_STATUS' => $_new['IP_STATUS']));
-	  if(!$result['status'])
-	    {
-	      $this->status = FALSE;
-	      $this->errors['IP_STATUS'] = array($result['error_code'] => $result['error_message']);
-	    }
-	}
-
-
-      if(!$result['status'])
-	$this->errors[] = array($result['error_code'] => $result['error_message']);
-      
-      return $this->reply($result['status'], $result['data']);
-    }
-
-    
-}

+ 0 - 25
web/vesta/api/MAIN.class.php~

@@ -1,25 +0,0 @@
-<?php
-
-/**
- * Main entity class
- * Provides usefull methods (utils), shared for sub entities (DNS, IP etc)
- * Subentities should be extended from MAIN class
- * 
- * Details:
- *  - methods, used for ajax executions must be postfixed with execute keyword
- *      Eg.: getDnsInformationExecute()
- * 
- * @author vesta, http://vestacp.com/
- * @copyright vesta 2010
- */
-class MAIN extends AjaxHandler {
-
-    function versionExecute($request) {
-        $result = array('version' => '1.0',
-            'author' => 'http://vestacp.com/',
-            'docs' => 'http://vestacp.com/docs');
-
-        return $this->reply(true, $result);
-    }
-
-}

+ 0 - 533
web/vesta/api/PARAMS.class.php~

@@ -1,533 +0,0 @@
-<?php
-/**
- * DOMAIN
- * 
- * @author vesta, http://vestacp.com/
- * @copyright vesta 2011 
- */
-class WEB_DOMAIN extends AjaxHandler {
-    function getInitialParamsExecute($request) 
-    {
-	require_once V_ROOT_DIR . 'api/IP.class.php';
-
-        $ip_obj = new IP();
-        $user_ips = json_decode($ip_obj->getListUserIpsExecute(), TRUE);
-
-	foreach($user_ips['data'] as $ip)
-	    $ips[$ip['IP_ADDRESS']] = $ip['IP_ADDRESS'];
-
-        $reply = array(
-            'TPL' => array('default' => 'default'),
-	    'ALIAS' => array(),
-	    'STAT' => array(
-                'webalizer' => 'webalizer',
-                'awstats' => 'awstats'),
-            'IP' => $ips
-        );
-
-        return $this->reply(true, $reply);
-    }
-
-
-    function getListExecute($request) 
-    {
-      $_user = 'vesta';
-      $reply = array();
-    
-      $result = Vesta::execute(Vesta::V_LIST_WEB_DOMAINS, array($_user, Config::get('response_type')));
-      
-      //    echo '<pre>';
-      //    print_r($result);
-      
-      foreach($result['data'] as $web_domain => $data)
-	{
-	  $reply[$web_domain] = array(
-				      'IP' => $record['IP'],
-				      'U_DISK' => $record['U_DISK'],
-				      'U_BANDWIDTH' => $record['U_BANDWIDTH'],
-				      'TPL' => $record['TPL'],
-				      'ALIAS' => $record['ALIAS'],
-				      'PHP' => $record['PHP'],
-				      'CGI' => $record['CGI'],
-				      'ELOG' => $record['ELOG'],
-				      'STATS' => $record['STATS'],
-				      'STATS_AUTH' => $record['STATS_AUTH'],
-				      'SSL' => $record['SSL'],
-				      'SSL_HOME' => $record['SSL_HOME'],
-				      'SSL_CERT' => $record['SSL_CERT'],
-				      'NGINX' => $record['NGINX'],
-				      'NGINX_EXT' => $record['NGINX_EXT'],
-				      'SUSPEND' => $record['SUSPEND'],
-				      'DATE' => date(Config::get('ui_date_format', strtotime($record['DATE'])))
-				      );
-	}
-      
-      if(!$result['status'])
-	$this->errors[] = array($result['error_code'] => $result['error_message']);
-      
-      return $this->reply($result['status'], $reply);
-    }
-    
-    
-    
-    function addExecute($request) 
-    {
-      $r = new Request();
-      $_s = $r->getSpell();
-      $_user = 'vesta';
-
-      $params = array(
-		      'USER' => $_user,
-		      'DOMAIN' => $_s['DOMAIN'],
-		      'IP' => $_s['IP']
-		      );
-      
-      $result = Vesta::execute(Vesta::V_ADD_WEB_DOMAIN, $params);
-      
-      if(!$result['status'])
-	$this->errors[] = array($result['error_code'] => $result['error_message']);
-      
-      
-      
-      //    if(0)
-      if($_s['TPL'])
-	{
-	  $params = array('USER' => $_user,
-			'DOMAIN' => $_s['DOMAIN'],
-			  'TPL' => $_s['TPL']);
-	  $result = 0;
-	  $result = Vesta::execute(Vesta::V_CHANGE_WEB_DOMAIN_TPL, $params);
-	  
-	  if(!$result['status'])
-	    $this->errors['CHANGE_TPL'] = array($result['error_code'] => $result['error_message']);
-	}
-      
-      //    if(0)
-      if($_s['ALIAS'])
-	{
-	$alias_arr = explode(',', $_s['ALIAS']);
-	
-	foreach($alias_arr as $alias)
-	  {
-	    $params = array('USER' => $_user,
-			    'DOMAIN' => $_s['DOMAIN'],
-			    'ALIAS' => trim($alias));
-	    $result = 0;
-	    
-	    $result = Vesta::execute(Vesta::V_ADD_WEB_DOMAIN_ALIAS, $params);
-	    
-	    if(!$result['status'])
-	      $this->errors['ALIAS'] = array($result['error_code'] => $result['error_message']);
-	  }
-	}
-      
-      //    if(0)
-      if($_s['STAT'])
-	{
-	  $params = array('USER' => $_user,
-			  'DOMAIN' => $_s['DOMAIN'],
-			  'STAT' => $_s['STAT']);
-	  $result = 0;
-	  $result = Vesta::execute(Vesta::V_ADD_WEB_DOMAIN_STAT, $params);
-	  
-	  if(!$result['status'])
-	    $this->errors['STATS'] = array($result['error_code'] => $result['error_message']);
-	}
-      
-      //    if(0)
-      if($_s['STAT_AUTH'])
-	{
-	  $params = array('USER' => $_user,
-			  'DOMAIN' => $_s['DOMAIN'],
-			  'STAT_USER' => $_s['STAT_USER'],
-			  'STAT_PASSWORS' => $_s['STAT_PASSWORD']);
-	  $result = 0;
-	  $result = Vesta::execute(Vesta::V_ADD_WEB_DOMAIN_STAT_AUTH, $params);
-	  
-	  if(!$result['status'])
-	    $this->errors['STAT_AUTH'] = array($result['error_code'] => $result['error_message']);
-	}
-
-      if(0)
-	if($_s['SSL'])
-	  {
-	    $params = array('USER' => $_user,
-			    'DOMAIN' => $_s['DOMAIN'],
-			    'SSL_CERT' => $_s['SSL_CERT']);
-	    
-	    if($_s['SSL_HOME'])
-	      $params['SSL_HOME'] = $_s['SSL_HOME'];
-	    
-	    if($_s['SSL_TEXT'])
-	      {}
-	    //	if($_FILES['SSL_CERT'])
-	    // $ssl_text = file_get_contents($_FILES...);
-	    
-	    
-	    $result = 0;
-	    $result = Vesta::execute(Vesta::V_ADD_WEB_DOMAIN_SSL, $params);
-	    
-	    if(!$result['status'])
-	      $this->errors['SSL'] = array($result['error_code'] => $result['error_message']);
-	  }
-      
-    //    if(0)
-      if($_s['CREATE_DNS_DOMAIN'])
-	{
-	  $params = array('USER' => $_user,
-			  'DNS_DOMAIN' => $_s['DOMAIN'],
-			  'IP' => $_s['IP']);
-	  
-	  require_once V_ROOT_DIR . 'api/DNS.class.php';
-	  
-	  $dns = new DNS();
-	  $result = 0;
-	  $result = $dns->addExecute($params);
-	  if(!$result['status'])
-	    $this->errors['DNS_DOMAIN'] = array($result['error_code'] => $result['error_message']);
-	}
-      
-      if(0)
-	if($_s['CREATE_MAIL_DOMAIN'])
-	  {
-	    $params = array('USER' => $_user,
-			    'MAIL_DOMAIN' => $_s['DOMAIN'],
-			    'IP' => $_s['IP']);
-	    
-	    
-	    require_once V_ROOT_DIR . 'api/MAIL.class.php';
-	    
-	    $mail = new MAIL();
-	    $result = 0;
-	    $result = $mail->addExecute($params);
-	    if(!$result['status'])
-	      $this->errors['MAIL_DOMAIN'] = array($result['error_code'] => $result['error_message']);
-	  }
-      
-      return $this->reply($result['status'], $result['data']);
-    }
-    
-    function delExecute($request) 
-    {
-      $r = new Request();
-      $_s = $r->getSpell();
-      $_user = 'vesta';
-      
-      $params = array(
-		      'USER' => $_user,
-		      'DOMAIN' => $_s['DOMAIN']
-		      );
-      
-      $result = Vesta::execute(Vesta::V_DEL_WEB_DOMAIN, $params);
-      
-      if(!$result['status'])
-	$this->errors[] = array($result['error_code'] => $result['error_message']);
-
-
-
-    $params = array(
-		    'USER' => $_user,
-		    'DNS_DOMAIN' => $_s['DOMAIN']
-		    );
-   
-    require_once V_ROOT_DIR . 'api/DNS.class.php';
-    $dns = new DNS();
-    $result = $dns->delExecute($params);
-    
-    if(!$result['status'] && $result['error_code'] != 31) // domain not found
-      $this->errors['DNS'] = array($result['error_code'] => $result['error_message']);
-   
-    require_once V_ROOT_DIR . 'api/DNS.class.php';
-
-    $params = array(
-		    'USER' => $_user,
-		    'MAIL_DOMAIN' => $_s['DOMAIN']
-		    );
-
-    /*
-    require_once V_ROOT_DIR . 'api/MAIL.class.php';
-    $mail = new MAIL();
-    $result = $mail->delExecute($params);
-    
-    if(!$result['status'] && $result['error_code'] != 31) // domain not found
-      $this->errors['MAIL'] = array($result['error_code'] => $result['error_message']);
-    */
-    return $this->reply($result['status'], $result['data']);
-  }
-  
-    
-  
-  function changeExecute($request)
-  {
-    $r = new Request();
-    $_s = $r->getSpell();
-    $_old = $_s['old'];
-    $_new = $_s['new'];
-
-    $_user = 'vesta';
-    $_DOMAIN = $_new['DOMAIN'];
-    
-    if($_old['IP'] != $_new['IP'])
-      {
-	$result = array();
-	$result = Vesta::execute(Vesta::V_CHANGE_WEB_DOMAIN_IP, array('USER' => $_user, 'DOMAIN' => $_DOMAIN, 'IP' => $_new['IP']));
-	if(!$result['status'])
-	  {
-	    $this->status = FALSE;
-	    $this->errors['IP_ADDRESS'] = array($result['error_code'] => $result['error_message']);
-	  }
-      }
-
-
-    if($_old['TPL'] != $_new['TPL'])
-      {
-	$result = array();
-	$result = Vesta::execute(Vesta::V_CHANGE_WEB_DOMAIN_TPL, array('USER' => $_user, 'DOMAIN' => $_DOMAIN, 'TPL' => $_new['TPL']));
-	if(!$result['status'])
-	  {
-	    $this->status = FALSE;
-	    $this->errors['TPL'] = array($result['error_code'] => $result['error_message']);
-	  }
-      }
-
-    if($_old['ALIAS'] != $_new['ALIAS'])
-      {
-	$result = array();
-
-	$old_arr = explode(',', $_old['ALIAS']);
-	$new_arr = explode(',', $_new['ALIAS']);
-
-	$added = array_diff($new_arr, $old_arr);
-	$deleted = array_diff($old_arr, $new_arr);
-
-	foreach($added as $alias)
-	  {
-	    $result = Vesta::execute(Vesta::V_ADD_WEB_DOMAIN_ALIAS, array('USER' => $_user, 'DOMAIN' => $_DOMAIN, 'ALIAS' => $alias));
-	    if(!$result['status'])
-	      {
-		$this->status = FALSE;
-		$this->errors['ADD_ALIAS'] = array($result['error_code'] => $result['error_message']);
-	      }
-	  }
-	foreach($deleted as $alias)
-	  {
-	    $result = Vesta::execute(Vesta::V_DEL_WEB_DOMAIN_ALIAS, array('USER' => $_user, 'DOMAIN' => $_DOMAIN, 'ALIAS' => $alias));
-	    if(!$result['status'])
-	      {
-		$this->status = FALSE;
-		$this->errors['DEL_ALIAS'] = array($result['error_code'] => $result['error_message']);
-	      }
-	  }
-      }
-
-
-    if($_old['STAT'] != $_new['STAT'])
-      {
-	if($_new['STAT'] == true)
-	  {
-	    $result = array();
-	    $result = Vesta::execute(Vesta::V_ADD_WEB_DOMAIN_STAT, array('USER' => $_user, 'DOMAIN' => $_DOMAIN, 'STAT' => $_new['STAT']));
-	    if(!$result['status'])
-	      {
-		$this->status = FALSE;
-		$this->errors['ADD_STAT'] = array($result['error_code'] => $result['error_message']);
-	      }
-	  }
-
-	if($_new['STAT'] == false)
-	  {
-	    $result = array();
-	    $result = Vesta::execute(Vesta::V_DEL_WEB_DOMAIN_STAT, array('USER' => $_user, 'DOMAIN' => $_DOMAIN));
-	    if(!$result['status'])
-	      {
-		$this->status = FALSE;
-		$this->errors['DEL_STAT'] = array($result['error_code'] => $result['error_message']);
-	      }
-	    $result = array();
-
-	    $result = Vesta::execute(Vesta::V_DEL_WEB_DOMAIN_STAT_AUTH, array('USER' => $_user, 'DOMAIN' => $_DOMAIN, 'STAT_USER' => $_new['STAT_USER']));
-	    if(!$result['status'])
-	      {
-		$this->status = FALSE;
-		$this->errors['DEL_STAT_AUTH'] = array($result['error_code'] => $result['error_message']);
-	      }
-	  }
-      }
-
-    if(0)
-    // ssl
-    if($_old['SSL'] != $_new['SSL'])
-      {
-	if($_new['SSL'] == true)
-	  {
-
-
-	  }
-	if($_new['SSL'] == false)
-	  {
-
-
-	  }
-      }
-    else
-      {
-	if($_old['SSL_CERT'] != $_new['SSL_CERT'])
-	  {
-	    $result = array();
-	    $_SSL_CERT = $_new['SSL_CERT'];
-	    // or read uploaded tmp file
-
-	    $result = Vesta::execute(Vesta::V_CHANGE_WEB_DOMAIN_CERT, array('USER' => $_user, 'DOMAIN' => $_DOMAIN, 'SSL_CERT' => $_SSL_CERT ));
-	    if(!$result['status'])
-	    {
-	      $this->status = FALSE;
-	      $this->errors['SSL_CERT'] = array($result['error_code'] => $result['error_message']);
-	    }
-	  }
-	if($_old['SSL_HOME'] != $_new['SSL_HOME'])
-	  {
-	    $result = array();
-	    $result = Vesta::execute(Vesta::V_CHANGE_WEB_DOMAIN_SSLHOME, array('USER' => $_user, 'DOMAIN' => $_DOMAIN, 'SSL_HOME' => $_new['SSL_HOME']));
-	    if(!$result['status'])
-	      {
-		$this->status = FALSE;
-		$this->errors['SSL_HOME'] = array($result['error_code'] => $result['error_message']);
-	      }
-	  }
-      }
-
-    if($_old['CGI'] != $_new['CGI'])
-      {
-	if($_new['CGI'] == true)
-	{
-	  $result = array();
-	  $result = Vesta::execute(Vesta::V_ADD_WEB_DOMAIN_CGI, array('USER' => $_user, 'DOMAIN' => $_DOMAIN));
-	  if(!$result['status'])
-	    {
-	      $this->status = FALSE;
-	      $this->errors['ADD_CGI'] = array($result['error_code'] => $result['error_message']);
-	    }
-	}
-	if($_new['CGI'] == false)
-	{
-	  $result = array();
-	  $result = Vesta::execute(Vesta::V_DEL_WEB_DOMAIN_CGI, array('USER' => $_user, 'DOMAIN' => $_DOMAIN));
-	  if(!$result['status'])
-	    {
-	      $this->status = FALSE;
-	      $this->errors['DEL_CGI'] = array($result['error_code'] => $result['error_message']);
-	    }
-	}
-      }
-
-    if($_old['ELOG'] != $_new['ELOG'])
-      {
-	if($_new['ELOG'] == true)
-	{
-	  $result = array();
-	  $result = Vesta::execute(Vesta::V_ADD_WEB_DOMAIN_ELOG, array('USER' => $_user, 'DOMAIN' => $_DOMAIN));
-	  if(!$result['status'])
-	    {
-	      $this->status = FALSE;
-	      $this->errors['ADD_ELOG'] = array($result['error_code'] => $result['error_message']);
-	    }
-	}
-	if($_new['ELOG'] == false)
-	{
-	  $result = array();
-	  $result = Vesta::execute(Vesta::V_DEL_WEB_DOMAIN_ELOG, array('USER' => $_user, 'DOMAIN' => $_DOMAIN));
-	  if(!$result['status'])
-	    {
-	      $this->status = FALSE;
-	      $this->errors['DEL_ELOG'] = array($result['error_code'] => $result['error_message']);
-	    }
-	}
-      }
-
-
-    return $this->reply($result['status'], $result['data']);
-  }
-
-
-
-  function suspendExecute($request)
-  {
-    $r = new Request();
-    $_s = $r->getSpell();
-
-    $_user = 'vesta';
-    
-    $params = array(
-		    'USER' => $_user,
-		    'DOMAIN' => $_s['DOMAIN']
-		    );
-    
-    $result = Vesta::execute(Vesta::V_SUSPEND_WEB_DOMAIN, $params);
-    
-    if(!$result['status'])
-      $this->errors[] = array($result['error_code'] => $result['error_message']);
-    
-    return $this->reply($result['status'], $result['data']);
-  }
-
-
-  function unsuspendExecute($request)
-  {
-    $r = new Request();
-    $_s = $r->getSpell();
-
-    $_user = 'vesta';
-    
-    $params = array(
-		    'USER' => $_user,
-		    'DOMAIN' => $_s['DOMAIN']
-		    );
-    
-    $result = Vesta::execute(Vesta::V_UNSUSPEND_WEB_DOMAIN, $params);
-    
-    if(!$result['status'])
-      $this->errors[] = array($result['error_code'] => $result['error_message']);
-    
-    return $this->reply($result['status'], $result['data']);
-  }
-
-
-
-  function suspendAllExecute($request)
-  {
-    $r = new Request();
-    $_s = $r->getSpell();
-
-    $_user = 'vesta';
-    
-    $params = array(
-		    'USER' => $_user
-		    );
-    
-    $result = Vesta::execute(Vesta::V_SUSPEND_WEB_DOMAINS, $params);
-    
-    if(!$result['status'])
-      $this->errors[] = array($result['error_code'] => $result['error_message']);
-    
-    return $this->reply($result['status'], $result['data']);
-  }
-
-  function unsuspendAllExecute($request)
-  {
-    $r = new Request();
-    $_s = $r->getSpell();
-
-    $_user = 'vesta';
-    
-    $params = array(
-		    'USER' => $_user
-		    );
-    
-    $result = Vesta::execute(Vesta::V_UNSUSPEND_WEB_DOMAINS, $params);
-    
-    if(!$result['status'])
-      $this->errors[] = array($result['error_code'] => $result['error_message']);
-    
-    return $this->reply($result['status'], $result['data']);
-  }
-}

+ 0 - 270
web/vesta/api/USER.class.php~

@@ -1,270 +0,0 @@
-<?php
-/**
- * USERS 
- * 
- * @author vesta, http://vestacp.com/
- * @copyright vesta 2010 
- *
- */
-class USER extends AjaxHandler 
-{
-    function getInitialParamsExecute($request) 
-    {
-        $user_obj = new USER();
-        $users = json_decode($user_obj->getListExecute(), TRUE);
-
-	$user_names = array_keys($users['data']['data']);
-
-        $reply = array(
-            'ROLE' => array('user' => 'user'),
-	    'OWNER' => $user_names,
-	    'PACKAGE' => array('default' => 'default'),
-	    'NS1' => array('' => ''),
-            'NS2' => array('' => ''),
-            'SHELL' => array(
-	        '/bin/sh' => '/bin/sh',
-                '/bin/bash' => '/bin/bash',
-                '/sbin/nologin' => '/sbin/nologin',
-                '/bin/tcsh' => '/bin/tcsh',
-                '/bin/csh' => '/bin/csh')
-        );
-
-        return $this->reply(true, $reply);
-    }
-
-
-    function getListExecute($request) {
-        $reply = array();
-       
-        $result = Vesta::execute(Vesta::V_LIST_SYS_USERS, array(Config::get('response_type')));
-
-        foreach($result as $ip => $details){
-            $reply[] = array(
-                'interface' => $details['INTERFACE'],
-                'sys_users' => $details['U_SYS_USERS'],
-                'web_domains' => $details['U_WEB_DOMAINS'],
-                'status' => $details['STATUS'],
-                'ip' => $ip,
-                'net_mask' => $details['NETMASK'],
-                'name' => $details['NAME'],
-                'owner' => $details['OWNER'],
-                'created_at' => date(Config::get('ui_date_format', strtotime($details['DATE'])))
-
-
-		/*
-
-                "PACKAGE": "default",
-                "WEB_DOMAINS": "10",
-                "WEB_SSL": "10",
-                "WEB_ALIASES": "10",
-                "DATABASES": "10",
-                "MAIL_DOMAINS": "10",
-                "MAIL_BOXES": "30",
-                "MAIL_FORWARDERS": "30",
-                "DNS_DOMAINS": "10",
-                "DISK_QUOTA": "10000",
-                "BANDWIDTH": "10000",
-                "NS1": "ns1.localhost",
-                "NS2": "ns2.localhost",
-                "SHELL": "bash",
-                "BACKUPS": "3",
-                "TEMPLATES": "default, phpcgi, unlim",
-                "MAX_CHILDS": "300",
-                "SUSPENDED": "no",
-                "OWNER": "vesta",
-                "ROLE": "admin",
-                "IP_OWNED": "1",
-                "U_CHILDS": "0",
-                "U_DISK": "1",
-                "U_BANDWIDTH": "0",
-                "U_WEB_DOMAINS": "1",
-                "U_WEB_SSL": "0",
-                "U_DNS_DOMAINS": "3",
-                "U_DATABASES": "0",
-                "U_MAIL_DOMAINS": "0",
-                "CONTACT": "vesta@localhost",
-                "DATE": "01-04-11"
-
-		*/
-                );
-        }
-        
-        return $this->reply(true, $result);
-    }
-
-
-
-  function addExecute($_spell = false) 
-  {
-    $r = new Request();
-    if($_spell)
-      $_s = $_spell;
-    else
-      $_s = $r->getSpell();
-
-
-    $_user = 'vesta';
-    
-    // $_s['ROLE'] = 'user';
-    // reseller
-    // admin
-
-    // package: default 
-
-    $params = array(
-		    'USER' => $_s['USER'],
-		    'PASSWORD' => $_s['PASSWORD'],
-		    'EMAIL' => $_s['EMAIL'],
-		    'ROLE' => $_s['ROLE'],
-		    'OWNER' => $_user,
- 		    'PACKAGE' => $_s['PACKAGE'],
- 		    'NS1' => $_s['NS1'],
- 		    'NS2' => $_s['NS2']
-		    );
-    
-    $result = Vesta::execute(Vesta::V_ADD_SYS_USER, $params);
-      
-    if(!$result['status'])
-        $this->errors[] = array($result['error_code'] => $result['error_message']);
-    
-    return $this->reply($result['status'], $result['data']);
-  }
-  
-  
-    
-  function delExecute($_spell = false) 
-  {
-    $r = new Request();
-    if($_spell)
-      $_s = $_spell;
-    else
-      $_s = $r->getSpell();
-
-    $_user = 'vesta';
-    
-    $params = array(
-		    'USER' => $_s['USER']
-		    );
-    
-    $result = Vesta::execute(Vesta::V_DEL_SYS_USER, $params);
-    
-    if(!$result['status'])
-      $this->errors[] = array($result['error_code'] => $result['error_message']);
-    
-    return $this->reply($result['status'], $result['data']);
-  }
-
-
-
-  function changeExecute($request)
-  {
-    $r = new Request();
-    $_s = $r->getSpell();
-    $_old = $_s['old'];
-    $_new = $_s['new'];
-
-    $_USER = $_new['USER'];
-    
-    if($_old['USER'] != $_new['USER'])
-      {
-	
-	$result = array();
-	// creating new user
-	$result = $this->addExecute($_new);
-	
-	// deleting old
-	if($result['status'])
-	  {
-	    $result = array();
-	    
-	    $result = $this->delExecute($_old);
-	    return $this->reply($this->status, '');
-	  }
-      }
-
-    if($_old['PASSWORD'] != $_new['PASSWORD'])
-      {
-	$result = array();
-	$result = Vesta::execute(Vesta::V_CHANGE_SYS_USER_PASSWORD, array('USER' => $_USER, 'PASSWORD' => $_new['PASSWORD']));
-	if(!$result['status'])
-	      {
-		$this->status = FALSE;
-		$this->errors['PASSWORD'] = array($result['error_code'] => $result['error_message']);
-	      }
-      }
-
-    if($_old['PACKAGE'] != $_new['PACKAGE'])
-      {
-	$result = array();
-	$result = Vesta::execute(Vesta::V_CHANGE_SYS_USER_PACKAGE, array('USER' => $_USER, 'PACKAGE' => $_new['PACKAGE']));
-	if(!$result['status'])
-	      {
-		$this->status = FALSE;
-		$this->errors['PACKAGE'] = array($result['error_code'] => $result['error_message']);
-	      }
-      }
-  
-    /*
-    if($_old['ROLE'] != $_new['ROLE'])
-      {
-      	echo '<br> role';
-
-	$result = array();
-	$result = Vesta::execute(Vesta::V_CHANGE_SYS_USER_ROLE, array('USER' => $_USER, 'ROLE' => $_new['ROLE']));
-	if(!$result['status'])
-	      {
-		$this->status = FALSE;
-		$this->errors['ROLE'] = array($result['error_code'] => $result['error_message']);
-	      }
-      }
-    */
-
-    if($_old['EMAIL'] != $_new['EMAIL'])
-      {
-	$result = array();
-	$result = Vesta::execute(Vesta::V_CHANGE_SYS_USER_CONTACT, array('USER' => $_USER, 'EMAIL' => $_new['EMAIL']));
-	if(!$result['status'])
-	      {
-		$this->status = FALSE;
-		$this->errors['EMAIL'] = array($result['error_code'] => $result['error_message']);
-	      }
-    }
-
-    if($_old['NS1'] != $_new['NS1']  || $_old['NS2'] != $_new['NS2'])
-      {
-	$result = array();
-	$result = Vesta::execute(Vesta::V_CHANGE_SYS_USER_NS, array('USER' => $_USER, 'NS1' => $_new['NS1'], 'NS2' => $_new['NS2']));
-	if(!$result['status'])
-	      {
-		$this->status = FALSE;
-		$this->errors['NS'] = array($result['error_code'] => $result['error_message']);
-	      }
-      }
-
-    if($_old['SHELL'] != $_new['SHELL'])
-      {
-	$result = array();
-	$result = Vesta::execute(Vesta::V_CHANGE_SYS_USER_SHELL, array('USER' => $_USER, 'SHELL' => $_new['SHELL']));
-	if(!$result['status'])
-	      {
-		$this->status = FALSE;
-		$this->errors['SHELL'] = array($result['error_code'] => $result['error_message']);
-	      }
-      }
-
-    if(!$this->status)
-      {
-	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_CONTACT, array('USER' => $_USER, 'EMAIL' => $_old['EMAIL']));
-	// 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_SHELL, array('USER' => $_USER, 'SHELL' => $_old['SHELL']));
-      }
-
-        return $this->reply($this->status, '');
-    }
-
-
-
-}

+ 0 - 533
web/vesta/api/WEB_DOMAIN.class.php~

@@ -1,533 +0,0 @@
-<?php
-/**
- * DOMAIN
- * 
- * @author vesta, http://vestacp.com/
- * @copyright vesta 2011 
- */
-class WEB_DOMAIN extends AjaxHandler {
-    function getInitialParamsExecute($request) 
-    {
-	require_once V_ROOT_DIR . 'api/IP.class.php';
-
-        $ip_obj = new IP();
-        $user_ips = json_decode($ip_obj->getListUserIpsExecute(), TRUE);
-
-	foreach($user_ips['data'] as $ip)
-	    $ips[$ip['IP_ADDRESS']] = $ip['IP_ADDRESS'];
-
-        $reply = array(
-            'TPL' => array('default' => 'default'),
-	    'ALIAS' => array(),
-	    'STAT' => array(
-                'webalizer' => 'webalizer',
-                'awstats' => 'awstats'),
-            'IP' => $ips
-        );
-
-        return $this->reply(true, $reply);
-    }
-
-
-    function getListExecute($request) 
-    {
-      $_user = 'vesta';
-      $reply = array();
-    
-      $result = Vesta::execute(Vesta::V_LIST_WEB_DOMAINS, array($_user, Config::get('response_type')));
-      
-      //    echo '<pre>';
-      //    print_r($result);
-      
-      foreach($result['data'] as $web_domain => $data)
-	{
-	  $reply[$web_domain] = array(
-				      'IP' => $record['IP'],
-				      'U_DISK' => $record['U_DISK'],
-				      'U_BANDWIDTH' => $record['U_BANDWIDTH'],
-				      'TPL' => $record['TPL'],
-				      'ALIAS' => $record['ALIAS'],
-				      'PHP' => $record['PHP'],
-				      'CGI' => $record['CGI'],
-				      'ELOG' => $record['ELOG'],
-				      'STATS' => $record['STATS'],
-				      'STATS_AUTH' => $record['STATS_AUTH'],
-				      'SSL' => $record['SSL'],
-				      'SSL_HOME' => $record['SSL_HOME'],
-				      'SSL_CERT' => $record['SSL_CERT'],
-				      'NGINX' => $record['NGINX'],
-				      'NGINX_EXT' => $record['NGINX_EXT'],
-				      'SUSPEND' => $record['SUSPEND'],
-				      'DATE' => date(Config::get('ui_date_format', strtotime($record['DATE'])))
-				      );
-	}
-      
-      if(!$result['status'])
-	$this->errors[] = array($result['error_code'] => $result['error_message']);
-      
-      return $this->reply($result['status'], $reply);
-    }
-    
-    
-    
-    function addExecute($request) 
-    {
-      $r = new Request();
-      $_s = $r->getSpell();
-      $_user = 'vesta';
-
-      $params = array(
-		      'USER' => $_user,
-		      'DOMAIN' => $_s['DOMAIN'],
-		      'IP' => $_s['IP']
-		      );
-      
-      $result = Vesta::execute(Vesta::V_ADD_WEB_DOMAIN, $params);
-      
-      if(!$result['status'])
-	$this->errors[] = array($result['error_code'] => $result['error_message']);
-      
-      
-      
-      //    if(0)
-      if($_s['TPL'])
-	{
-	  $params = array('USER' => $_user,
-			'DOMAIN' => $_s['DOMAIN'],
-			  'TPL' => $_s['TPL']);
-	  $result = 0;
-	  $result = Vesta::execute(Vesta::V_CHANGE_WEB_DOMAIN_TPL, $params);
-	  
-	  if(!$result['status'])
-	    $this->errors['CHANGE_TPL'] = array($result['error_code'] => $result['error_message']);
-	}
-      
-      //    if(0)
-      if($_s['ALIAS'])
-	{
-	$alias_arr = explode(',', $_s['ALIAS']);
-	
-	foreach($alias_arr as $alias)
-	  {
-	    $params = array('USER' => $_user,
-			    'DOMAIN' => $_s['DOMAIN'],
-			    'ALIAS' => trim($alias));
-	    $result = 0;
-	    
-	    $result = Vesta::execute(Vesta::V_ADD_WEB_DOMAIN_ALIAS, $params);
-	    
-	    if(!$result['status'])
-	      $this->errors['ALIAS'] = array($result['error_code'] => $result['error_message']);
-	  }
-	}
-      
-      //    if(0)
-      if($_s['STAT'])
-	{
-	  $params = array('USER' => $_user,
-			  'DOMAIN' => $_s['DOMAIN'],
-			  'STAT' => $_s['STAT']);
-	  $result = 0;
-	  $result = Vesta::execute(Vesta::V_ADD_WEB_DOMAIN_STAT, $params);
-	  
-	  if(!$result['status'])
-	    $this->errors['STATS'] = array($result['error_code'] => $result['error_message']);
-	}
-      
-      //    if(0)
-      if($_s['STAT_AUTH'])
-	{
-	  $params = array('USER' => $_user,
-			  'DOMAIN' => $_s['DOMAIN'],
-			  'STAT_USER' => $_s['STAT_USER'],
-			  'STAT_PASSWORS' => $_s['STAT_PASSWORD']);
-	  $result = 0;
-	  $result = Vesta::execute(Vesta::V_ADD_WEB_DOMAIN_STAT_AUTH, $params);
-	  
-	  if(!$result['status'])
-	    $this->errors['STAT_AUTH'] = array($result['error_code'] => $result['error_message']);
-	}
-
-      if(0)
-	if($_s['SSL'])
-	  {
-	    $params = array('USER' => $_user,
-			    'DOMAIN' => $_s['DOMAIN'],
-			    'SSL_CERT' => $_s['SSL_CERT']);
-	    
-	    if($_s['SSL_HOME'])
-	      $params['SSL_HOME'] = $_s['SSL_HOME'];
-	    
-	    if($_s['SSL_TEXT'])
-	      {}
-	    //	if($_FILES['SSL_CERT'])
-	    // $ssl_text = file_get_contents($_FILES...);
-	    
-	    
-	    $result = 0;
-	    $result = Vesta::execute(Vesta::V_ADD_WEB_DOMAIN_SSL, $params);
-	    
-	    if(!$result['status'])
-	      $this->errors['SSL'] = array($result['error_code'] => $result['error_message']);
-	  }
-      
-    //    if(0)
-      if($_s['CREATE_DNS_DOMAIN'])
-	{
-	  $params = array('USER' => $_user,
-			  'DNS_DOMAIN' => $_s['DOMAIN'],
-			  'IP' => $_s['IP']);
-	  
-	  require_once V_ROOT_DIR . 'api/DNS.class.php';
-	  
-	  $dns = new DNS();
-	  $result = 0;
-	  $result = $dns->addExecute($params);
-	  if(!$result['status'])
-	    $this->errors['DNS_DOMAIN'] = array($result['error_code'] => $result['error_message']);
-	}
-      
-      if(0)
-	if($_s['CREATE_MAIL_DOMAIN'])
-	  {
-	    $params = array('USER' => $_user,
-			    'MAIL_DOMAIN' => $_s['DOMAIN'],
-			    'IP' => $_s['IP']);
-	    
-	    
-	    require_once V_ROOT_DIR . 'api/MAIL.class.php';
-	    
-	    $mail = new MAIL();
-	    $result = 0;
-	    $result = $mail->addExecute($params);
-	    if(!$result['status'])
-	      $this->errors['MAIL_DOMAIN'] = array($result['error_code'] => $result['error_message']);
-	  }
-      
-      return $this->reply($result['status'], $result['data']);
-    }
-    
-    function delExecute($request) 
-    {
-      $r = new Request();
-      $_s = $r->getSpell();
-      $_user = 'vesta';
-      
-      $params = array(
-		      'USER' => $_user,
-		      'DOMAIN' => $_s['DOMAIN']
-		      );
-      
-      $result = Vesta::execute(Vesta::V_DEL_WEB_DOMAIN, $params);
-      
-      if(!$result['status'])
-	$this->errors[] = array($result['error_code'] => $result['error_message']);
-
-
-
-    $params = array(
-		    'USER' => $_user,
-		    'DNS_DOMAIN' => $_s['DOMAIN']
-		    );
-   
-    require_once V_ROOT_DIR . 'api/DNS.class.php';
-    $dns = new DNS();
-    $result = $dns->delExecute($params);
-    
-    if(!$result['status'] && $result['error_code'] != 31) // domain not found
-      $this->errors['DNS'] = array($result['error_code'] => $result['error_message']);
-   
-    require_once V_ROOT_DIR . 'api/DNS.class.php';
-
-    $params = array(
-		    'USER' => $_user,
-		    'MAIL_DOMAIN' => $_s['DOMAIN']
-		    );
-
-    /*
-    require_once V_ROOT_DIR . 'api/MAIL.class.php';
-    $mail = new MAIL();
-    $result = $mail->delExecute($params);
-    
-    if(!$result['status'] && $result['error_code'] != 31) // domain not found
-      $this->errors['MAIL'] = array($result['error_code'] => $result['error_message']);
-    */
-    return $this->reply($result['status'], $result['data']);
-  }
-  
-    
-  
-  function changeExecute($request)
-  {
-    $r = new Request();
-    $_s = $r->getSpell();
-    $_old = $_s['old'];
-    $_new = $_s['new'];
-
-    $_user = 'vesta';
-    $_DOMAIN = $_new['DOMAIN'];
-    
-    if($_old['IP'] != $_new['IP'])
-      {
-	$result = array();
-	$result = Vesta::execute(Vesta::V_CHANGE_WEB_DOMAIN_IP, array('USER' => $_user, 'DOMAIN' => $_DOMAIN, 'IP' => $_new['IP']));
-	if(!$result['status'])
-	  {
-	    $this->status = FALSE;
-	    $this->errors['IP_ADDRESS'] = array($result['error_code'] => $result['error_message']);
-	  }
-      }
-
-
-    if($_old['TPL'] != $_new['TPL'])
-      {
-	$result = array();
-	$result = Vesta::execute(Vesta::V_CHANGE_WEB_DOMAIN_TPL, array('USER' => $_user, 'DOMAIN' => $_DOMAIN, 'TPL' => $_new['TPL']));
-	if(!$result['status'])
-	  {
-	    $this->status = FALSE;
-	    $this->errors['TPL'] = array($result['error_code'] => $result['error_message']);
-	  }
-      }
-
-    if($_old['ALIAS'] != $_new['ALIAS'])
-      {
-	$result = array();
-
-	$old_arr = explode(',', $_old['ALIAS']);
-	$new_arr = explode(',', $_new['ALIAS']);
-
-	$added = array_diff($new_arr, $old_arr);
-	$deleted = array_diff($old_arr, $new_arr);
-
-	foreach($added as $alias)
-	  {
-	    $result = Vesta::execute(Vesta::V_ADD_WEB_DOMAIN_ALIAS, array('USER' => $_user, 'DOMAIN' => $_DOMAIN, 'ALIAS' => $alias));
-	    if(!$result['status'])
-	      {
-		$this->status = FALSE;
-		$this->errors['ADD_ALIAS'] = array($result['error_code'] => $result['error_message']);
-	      }
-	  }
-	foreach($deleted as $alias)
-	  {
-	    $result = Vesta::execute(Vesta::V_DEL_WEB_DOMAIN_ALIAS, array('USER' => $_user, 'DOMAIN' => $_DOMAIN, 'ALIAS' => $alias));
-	    if(!$result['status'])
-	      {
-		$this->status = FALSE;
-		$this->errors['DEL_ALIAS'] = array($result['error_code'] => $result['error_message']);
-	      }
-	  }
-      }
-
-
-    if($_old['STAT'] != $_new['STAT'])
-      {
-	if($_new['STAT'] == true)
-	  {
-	    $result = array();
-	    $result = Vesta::execute(Vesta::V_ADD_WEB_DOMAIN_STAT, array('USER' => $_user, 'DOMAIN' => $_DOMAIN, 'STAT' => $_new['STAT']));
-	    if(!$result['status'])
-	      {
-		$this->status = FALSE;
-		$this->errors['ADD_STAT'] = array($result['error_code'] => $result['error_message']);
-	      }
-	  }
-
-	if($_new['STAT'] == false)
-	  {
-	    $result = array();
-	    $result = Vesta::execute(Vesta::V_DEL_WEB_DOMAIN_STAT, array('USER' => $_user, 'DOMAIN' => $_DOMAIN));
-	    if(!$result['status'])
-	      {
-		$this->status = FALSE;
-		$this->errors['DEL_STAT'] = array($result['error_code'] => $result['error_message']);
-	      }
-	    $result = array();
-
-	    $result = Vesta::execute(Vesta::V_DEL_WEB_DOMAIN_STAT_AUTH, array('USER' => $_user, 'DOMAIN' => $_DOMAIN, 'STAT_USER' => $_new['STAT_USER']));
-	    if(!$result['status'])
-	      {
-		$this->status = FALSE;
-		$this->errors['DEL_STAT_AUTH'] = array($result['error_code'] => $result['error_message']);
-	      }
-	  }
-      }
-
-    if(0)
-    // ssl
-    if($_old['SSL'] != $_new['SSL'])
-      {
-	if($_new['SSL'] == true)
-	  {
-
-
-	  }
-	if($_new['SSL'] == false)
-	  {
-
-
-	  }
-      }
-    else
-      {
-	if($_old['SSL_CERT'] != $_new['SSL_CERT'])
-	  {
-	    $result = array();
-	    $_SSL_CERT = $_new['SSL_CERT'];
-	    // or read uploaded tmp file
-
-	    $result = Vesta::execute(Vesta::V_CHANGE_WEB_DOMAIN_CERT, array('USER' => $_user, 'DOMAIN' => $_DOMAIN, 'SSL_CERT' => $_SSL_CERT ));
-	    if(!$result['status'])
-	    {
-	      $this->status = FALSE;
-	      $this->errors['SSL_CERT'] = array($result['error_code'] => $result['error_message']);
-	    }
-	  }
-	if($_old['SSL_HOME'] != $_new['SSL_HOME'])
-	  {
-	    $result = array();
-	    $result = Vesta::execute(Vesta::V_CHANGE_WEB_DOMAIN_SSLHOME, array('USER' => $_user, 'DOMAIN' => $_DOMAIN, 'SSL_HOME' => $_new['SSL_HOME']));
-	    if(!$result['status'])
-	      {
-		$this->status = FALSE;
-		$this->errors['SSL_HOME'] = array($result['error_code'] => $result['error_message']);
-	      }
-	  }
-      }
-
-    if($_old['CGI'] != $_new['CGI'])
-      {
-	if($_new['CGI'] == true)
-	{
-	  $result = array();
-	  $result = Vesta::execute(Vesta::V_ADD_WEB_DOMAIN_CGI, array('USER' => $_user, 'DOMAIN' => $_DOMAIN));
-	  if(!$result['status'])
-	    {
-	      $this->status = FALSE;
-	      $this->errors['ADD_CGI'] = array($result['error_code'] => $result['error_message']);
-	    }
-	}
-	if($_new['CGI'] == false)
-	{
-	  $result = array();
-	  $result = Vesta::execute(Vesta::V_DEL_WEB_DOMAIN_CGI, array('USER' => $_user, 'DOMAIN' => $_DOMAIN));
-	  if(!$result['status'])
-	    {
-	      $this->status = FALSE;
-	      $this->errors['DEL_CGI'] = array($result['error_code'] => $result['error_message']);
-	    }
-	}
-      }
-
-    if($_old['ELOG'] != $_new['ELOG'])
-      {
-	if($_new['ELOG'] == true)
-	{
-	  $result = array();
-	  $result = Vesta::execute(Vesta::V_ADD_WEB_DOMAIN_ELOG, array('USER' => $_user, 'DOMAIN' => $_DOMAIN));
-	  if(!$result['status'])
-	    {
-	      $this->status = FALSE;
-	      $this->errors['ADD_ELOG'] = array($result['error_code'] => $result['error_message']);
-	    }
-	}
-	if($_new['ELOG'] == false)
-	{
-	  $result = array();
-	  $result = Vesta::execute(Vesta::V_DEL_WEB_DOMAIN_ELOG, array('USER' => $_user, 'DOMAIN' => $_DOMAIN));
-	  if(!$result['status'])
-	    {
-	      $this->status = FALSE;
-	      $this->errors['DEL_ELOG'] = array($result['error_code'] => $result['error_message']);
-	    }
-	}
-      }
-
-
-    return $this->reply($result['status'], $result['data']);
-  }
-
-
-
-  function suspendExecute($request)
-  {
-    $r = new Request();
-    $_s = $r->getSpell();
-
-    $_user = 'vesta';
-    
-    $params = array(
-		    'USER' => $_user,
-		    'DOMAIN' => $_s['DOMAIN']
-		    );
-    
-    $result = Vesta::execute(Vesta::V_SUSPEND_WEB_DOMAIN, $params);
-    
-    if(!$result['status'])
-      $this->errors[] = array($result['error_code'] => $result['error_message']);
-    
-    return $this->reply($result['status'], $result['data']);
-  }
-
-
-  function unsuspendExecute($request)
-  {
-    $r = new Request();
-    $_s = $r->getSpell();
-
-    $_user = 'vesta';
-    
-    $params = array(
-		    'USER' => $_user,
-		    'DOMAIN' => $_s['DOMAIN']
-		    );
-    
-    $result = Vesta::execute(Vesta::V_UNSUSPEND_WEB_DOMAIN, $params);
-    
-    if(!$result['status'])
-      $this->errors[] = array($result['error_code'] => $result['error_message']);
-    
-    return $this->reply($result['status'], $result['data']);
-  }
-
-
-
-  function suspendAllExecute($request)
-  {
-    $r = new Request();
-    $_s = $r->getSpell();
-
-    $_user = 'vesta';
-    
-    $params = array(
-		    'USER' => $_user
-		    );
-    
-    $result = Vesta::execute(Vesta::V_SUSPEND_WEB_DOMAINS, $params);
-    
-    if(!$result['status'])
-      $this->errors[] = array($result['error_code'] => $result['error_message']);
-    
-    return $this->reply($result['status'], $result['data']);
-  }
-
-  function unsuspendAllExecute($request)
-  {
-    $r = new Request();
-    $_s = $r->getSpell();
-
-    $_user = 'vesta';
-    
-    $params = array(
-		    'USER' => $_user
-		    );
-    
-    $result = Vesta::execute(Vesta::V_UNSUSPEND_WEB_DOMAINS, $params);
-    
-    if(!$result['status'])
-      $this->errors[] = array($result['error_code'] => $result['error_message']);
-    
-    return $this->reply($result['status'], $result['data']);
-  }
-}