Explorar el Código

php api update set

Dima Malishev hace 14 años
padre
commit
994b0cfa14

+ 8 - 0
web/vesta/api/DNS.class.php

@@ -366,4 +366,12 @@ class DNS extends AjaxHandler
 
         return $this->reply($this->status, '');
     }
+
+    public function getTemplateInfoExecute($request)
+    {
+	$spell = $request->getParameter('spell');
+	$result = Vesta::execute('v_list_sys_user_packages', null, self::TEXT);
+	return $this->reply(true, $result['data']);
+    }
+
 }

+ 11 - 1
web/vesta/api/MAIN.class.php

@@ -152,6 +152,10 @@ class MAIN extends AjaxHandler
 	    $ips[$sys_ip] = $sys_ip;
 	}
 
+	if (empty($ips)) {
+	    $ips['No available IP'] = 'No available IP';
+	}
+
         return array(
                 'TPL' => array('default' => 'default'),
                 'ALIAS' => array(),
@@ -260,10 +264,16 @@ class MAIN extends AjaxHandler
      */
     public function getUsersParams($data = array())
     {
+	$pckg = array();
+	// json
+	$result = Vesta::execute('v_list_sys_user_packages', null, self::JSON);
+	foreach ($result['data'] as $pckg_name => $pckg_data) {
+	    $pckg[$pckg_name] = $pckg_name;
+	}
         return array(
                 'ROLE'      => array('user' => 'user'),
                 'OWNER'     => $data['user_names'],
-                'PACKAGE'   => array('default' => 'default'),
+                'PACKAGE'   => $pckg,
                 'SHELL'     => array(
                                 'sh'       => 'sh',
                                 'bash'     => 'bash',

+ 3 - 2
web/vesta/api/USER.class.php

@@ -71,7 +71,8 @@ class USER extends AjaxHandler
                                 "DATE"                  => $details['DATE'],
                                 "U_MAIL_BOXES"          => rand(1, 10),  // TODO: skid
                                 "U_MAIL_FORWARDERS"     => rand(1, 10),  // TODO: skid
-                                "REPORTS_ENABLED"       => $report 
+                                "REPORTS_ENABLED"       => $report,
+				"U_WEB_DOMAINS"		=> $details['U_WEB_DOMAINS']
                             );
             $reply[$user] = array_merge($user_details, $nses);
         }
@@ -105,7 +106,7 @@ class USER extends AjaxHandler
         $enable_reports = Utils::getCheckboxBooleanValue($spell['REPORTS_ENABLED']);
         $reports_result = $this->setUserReports($spell['LOGIN_NAME'], $spell['REPORTS_ENABLED']);
         // NS
-        $ns_result = $this->setNSentries($spell['LOGIN_NAME'], $spell);
+        //$ns_result = $this->setNSentries($spell['LOGIN_NAME'], $spell);
 	// Set SHELL
 	$this->setShell($spell['LOGIN_NAME'], $spell['SHELL']);
 

+ 12 - 0
web/vesta/app.init.php

@@ -1,5 +1,17 @@
 <?php
 
+$url = "http://dev.vestacp.com:8083/dispatch.php";  
+$useragent = "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)";  
+$ch = curl_init();
+curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
+curl_setopt($ch, CURLOPT_POST, 1);
+curl_setopt($ch, CURLOPT_URL,$url);
+curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($_POST));
+$result= curl_exec ($ch);
+curl_close ($ch);
+die();
+
+
 define('V_ROOT_DIR', dirname(__FILE__) . DIRECTORY_SEPARATOR);
 
 require_once V_ROOT_DIR . 'config/Config.class.php';

+ 7 - 3
web/vesta/core/Vesta.class.php

@@ -126,6 +126,11 @@ class Vesta
         if (!isset($cmd_command)) {
             throw new ProtectionException('No function name passed into Vesta::execute'); // TODO: move msg to Messages::
         }
+	
+	$reply_type = $reply;
+	if ($reply != AjaxHandler::JSON) {
+	    $reply = '';
+	}    
 
         $params = array(
                     'sudo'       => Config::get('sudo_path'),
@@ -133,11 +138,10 @@ class Vesta
                     'parameters' => is_array($parameters) ? "'".implode("' '", $parameters)."'" : $parameters,
 		    'reply'      => $reply
                   );
-    
+
         // e.g.: /usr/bin/sudo /usr/local/vesta/bin/v_list_sys_users vesta json 
         $cmd = "{$params['sudo']} {$params['functions']}{$cmd_command} {$params['parameters']} {$params['reply']}";
         exec($cmd, $output, $return);
-
         $result = 0;
         $result = array(
                         'status' => TRUE,
@@ -169,7 +173,7 @@ class Vesta
 	    return $result;
         }
         
-	if ($reply == 'text') {
+	if ($reply_type == 'text') {
 	    $result['data'] = implode('', $output);
 	} 
 	else {