@@ -264,13 +264,12 @@ function AMP_TestConnection(array $params)
264264
265265function AMP_CreateAccount (array $ params )
266266{
267-
268267 try {
269- AMP_commercialCheck ($ params );
268+ // AMP_commercialCheck($params);
270269 $ client = new Client ($ params );
271270 $ provisioningTemplateId = $ params ['configoption1 ' ];
272271 $ postCreate = !empty ($ params ['configoption2 ' ]) ? $ params ['configoption2 ' ] : 10 ;
273- $ templates = $ client ->call ('ADSModule/GetDeploymentTemplates ' );
272+ // $templates = $client->call('ADSModule/GetDeploymentTemplates');
274273
275274 $ options = [];
276275 foreach ($ templates ['result ' ] as $ t ) {
@@ -293,6 +292,20 @@ function AMP_CreateAccount(array $params)
293292 foreach ($ array as $ key => $ value ) {
294293 $ extraProvisionSettings [$ value [0 ]] = $ value [1 ];
295294 }
295+
296+ $ requiredTags = explode (', ' , trim ($ params ['configoption3 ' ]));
297+
298+ foreach ($ params ['configoptions ' ] as $ key => $ value ) {
299+ if ($ key [0 ] == '+ ' )
300+ {
301+ $ extraProvisionSettings [$ key ] = $ value ;
302+ }
303+ if ($ key [0 ] == '@ ' )
304+ {
305+ $ requiredTags [] = $ value ;
306+ }
307+ }
308+
296309 $ data = [
297310 'TemplateID ' => $ provisioningTemplateId ,
298311 'NewUsername ' => $ username ,
@@ -301,11 +314,10 @@ function AMP_CreateAccount(array $params)
301314 'FriendlyName ' => '' ,
302315 'Secret ' => 'secretwhmcs ' . $ params ['serviceid ' ],
303316 'PostCreate ' => $ postCreate ,
304- 'RequiredTags ' => explode ( ' , ' , trim ( $ params [ ' configoption3 ' ])) ,
317+ 'RequiredTags ' => $ requiredTags ,
305318 'ExtraProvisionSettings ' => $ extraProvisionSettings
306319 ];
307320
308-
309321 Capsule::table ('ampServices ' )->updateOrInsert (['serviceId ' => $ params ['serviceid ' ]], ['secret ' => 'secretwhmcs ' . $ params ['serviceid ' ]]);
310322 $ response = $ client ->call ('ADSModule/DeployTemplate ' , $ data );
311323
0 commit comments