@@ -81,7 +81,7 @@ class remoting_admin extends remoting {
// check if permissions are valid
$value=strtolower($value);
if(!preg_match('/^[riud]+$/',$value)){
thrownewSoapFault('invalid parameters',$value.' is no valid permission string.');
thrownewISPConfigRemoteException('invalid parameters',$value.' is no valid permission string.');
returnfalse;
}
...
...
@@ -95,7 +95,7 @@ class remoting_admin extends remoting {
break;
default:
thrownewSoapFault('invalid parameters','Only sys_userid, sys_groupid, sys_perm_user and sys_perm_group parameters can be changed with this function.');
thrownewISPConfigRemoteException('invalid parameters','Only sys_userid, sys_groupid, sys_perm_user and sys_perm_group parameters can be changed with this function.');
break;
}
}
...
...
@@ -113,7 +113,7 @@ class remoting_admin extends remoting {
$check=$app->db->queryOneRecord('SELECT `assigned_template_id` FROM `client_template_assigned` WHERE `client_id` = ? AND `client_template_id` = ?',$client_id,$assigned_template_id);
$instance_record=$app->db->queryOneRecord("SELECT * FROM `sys_remoteaction` WHERE `action_param`=? and `action_type`=? and `action_state`='pending'",$primary_id,$action_type);
if($instance_record['action_id']>=1){
thrownewSoapFault('duplicate_action',"There is already a pending $action_type action");
thrownewISPConfigRemoteException('duplicate_action',"There is already a pending $action_type action");
returnfalse;
}
...
...
@@ -384,7 +337,7 @@ class remoting_mail extends remoting {
thrownewSoapFault('permission_denied','You do not have the permissions to access this function.');
returnfalse;
}
$server_id=$app->functions->intval($server_id);
if($server_id>0){
$tmp=$app->db->queryOneRecord("SELECT ip_address_id, server_id, ip_address FROM openvz_ip WHERE reserved = 'n' AND vm_id = 0 AND server_id = ? LIMIT 0,1",$server_id);
}else{
$tmp=$app->db->queryOneRecord("SELECT ip_address_id, server_id, ip_address FROM openvz_ip WHERE reserved = 'n' AND vm_id = 0 LIMIT 0,1");
}
if(count($tmp)>0){
return$tmp;
}else{
thrownewSoapFault('no_free_ip','There is no free IP available.');
thrownewSoapFault('template_id_error','Template ID must be > 0.');
returnfalse;
}
if($ostemplate_id==0){
thrownewSoapFault('ostemplate_id_error','OSTemplate ID must be > 0.');
returnfalse;
}
// Verify if template and ostemplate exist
$tmp=$app->db->queryOneRecord("SELECT template_id FROM openvz_template WHERE template_id = ?",$template_id);
if(!is_array($tmp)){
thrownewSoapFault('template_id_error','Template does not exist.');
returnfalse;
}
$tmp=$app->db->queryOneRecord("SELECT ostemplate_id FROM openvz_ostemplate WHERE ostemplate_id = ?",$ostemplate_id);
if(!is_array($tmp)){
thrownewSoapFault('ostemplate_id_error','OSTemplate does not exist.');
returnfalse;
}
//* Get the template
$vtpl=$app->db->queryOneRecord("SELECT * FROM openvz_template WHERE template_id = ?",$template_id);
//* Get the IP address and server_id
if($override_params['server_id']>0){
$vmip=$app->db->queryOneRecord("SELECT ip_address_id, server_id, ip_address FROM openvz_ip WHERE reserved = 'n' AND vm_id = 0 AND server_id = ? LIMIT 0,1",$override_params['server_id']);
}else{
$vmip=$app->db->queryOneRecord("SELECT ip_address_id, server_id, ip_address FROM openvz_ip WHERE reserved = 'n' AND vm_id = 0 LIMIT 0,1");
}
if(!is_array($vmip)){
thrownewSoapFault('vm_ip_error','Unable to get a free VM IP.');
$php_records=$app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fpm_init_script != '' AND php_fpm_ini_dir != '' AND php_fpm_pool_dir != '' AND server_id = ? AND (client_id = 0)",$server_id);
thrownewSoapFault('permission_denied','You do not have the permissions to access this function.');
thrownewISPConfigRemoteException('permission_denied','You do not have the permissions to access this function.');
returnfalse;
}
//* Check for duplicates
$tmp=$app->db->queryOneRecord("SELECT count(database_id) as dbnum FROM web_database WHERE database_name = ? AND server_id = ?",$params['database_name'],$params["server_id"]);
if($tmp['dbnum']>0){
thrownewSoapFault('database_name_error_unique','There is already a database with that name on the same server.');
thrownewISPConfigRemoteException('database_name_error_unique','There is already a database with that name on the same server.');
returnfalse;
}
...
...
@@ -151,7 +151,7 @@ class remoting_sites extends remoting {
$instance_record=$app->db->queryOneRecord("SELECT * FROM `sys_remoteaction` WHERE `action_param`= ? and `action_type`= ? and `action_state`= ?",$primary_id,$action_type,'pending');
if($instance_record['action_id']>=1){
thrownewSoapFault('duplicate_action',"There is already a pending $action_type action");
thrownewISPConfigRemoteException('duplicate_action',"There is already a pending $action_type action");
returnfalse;
}
...
...
@@ -967,7 +967,7 @@ class remoting_sites extends remoting {