@@ -29,7 +29,7 @@ function ($table) {
2929 $ table ->integer ('serverId ' );
3030 $ table ->text ('sessionId ' );
3131 }
32- );
32+ );
3333 }
3434
3535 if (!Capsule::schema ()->hasTable ('ampServices ' )) {
@@ -44,7 +44,7 @@ function ($table) {
4444 $ table ->text ('instanceId ' );
4545 $ table ->longText ('endpoints ' );
4646 }
47- );
47+ );
4848 }else
4949 {
5050 if (!Capsule::schema ()->hasColumn ('ampServices ' , 'endpoints ' ))
@@ -68,7 +68,7 @@ function ($table) {
6868 $ table ->timestamp ('created_at ' )->default (Capsule::raw ('CURRENT_TIMESTAMP ' ));
6969 $ table ->timestamp ('updated_at ' )->default (Capsule::raw ('CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP ' ));
7070 }
71- );
71+ );
7272 }
7373
7474 $ server = Capsule::table ('tblservers ' )
@@ -135,12 +135,12 @@ function ($table) {
135135 {
136136 $ script = '<script>$("#ampAlert").remove(); $("#tab3").prepend( \'<div id="ampAlert" class="alert alert-warning" role="alert"> ' .$ errors .'</div> \')</script> ' ;
137137 }
138-
138+
139139
140140 $ templates = $ client ->call ('ADSModule/GetDeploymentTemplates ' );
141141
142142 $ options = [];
143- foreach ($ templates[ ' result ' ] as $ t ) {
143+ foreach ($ templates as $ t ) {
144144 $ options [$ t ['Id ' ]] = $ t ['Name ' ];
145145 }
146146
@@ -149,20 +149,20 @@ function ($table) {
149149 $( \'[name="packageconfigoption[4]"] \').hide();
150150 clone.appendTo($( \'[name="packageconfigoption[4]"] \').parent()).show();
151151
152-
152+
153153 formEl = document.getElementById("extraProvisionSettingsForm");
154154 tbodyEl = document.getElementById("extraProvisionSettingsTableBody");
155155 tableEl = document.getElementById("extraProvisionSettingsTable");
156156 formEl.addEventListener("submit", onAddWebsite);
157157 tableEl.addEventListener("click", onDeleteRow);
158158
159-
159+
160160 try {
161161 a = JSON.parse($( \'[name="packageconfigoption[4]"] \').val());
162162 tbodyEl.innerHTML = "";
163163 for (const element of a) {
164164 tbodyEl.innerHTML += \'<tr><td> \'+element[0]+ \'</td><td> \'+element[1]+ \'</td><td><button class="btn btn-danger deleteBtn">Delete</button></td> </tr> \';
165- }
165+ }
166166 } catch(e) {}
167167
168168 </script> ' ;
@@ -174,7 +174,7 @@ function ($table) {
174174 ),
175175 'Post Create Action ' => array (
176176 'Type ' => 'dropdown ' ,
177- 'Options ' =>
177+ 'Options ' =>
178178 [
179179 0 => 'Do nothing ' ,
180180 1 => 'Start instance only ' ,
@@ -188,7 +188,7 @@ function ($table) {
188188 'Size ' => '25 ' ,
189189 'Default ' => '' ,
190190 'Description ' => '<br><br>Seperate the tags by using a comma. For more info, see module install guide ' ,
191- ),
191+ ),
192192 'Extra Provision Settings ' => array (
193193 'Type ' => 'text ' ,
194194 'Size ' => '25 ' ,
@@ -251,16 +251,16 @@ function AMP_TestConnection(array $params)
251251 }
252252 $ errors = implode ('. ' , $ errors );
253253
254-
254+
255255 if (!empty ($ errors ))
256256 {
257257 return [
258258 'success ' => false ,
259259 'error ' => $ errors ,
260260 ];
261261 }
262-
263-
262+
263+
264264
265265 } catch (\Exception $ e ) {
266266 return [
@@ -286,14 +286,14 @@ function AMP_CreateAccount(array $params)
286286 $ templates = $ client ->call ('ADSModule/GetDeploymentTemplates ' );
287287
288288 $ options = [];
289- foreach ($ templates[ ' result ' ] as $ t ) {
289+ foreach ($ templates as $ t ) {
290290 if ($ t ['Id ' ] == $ provisioningTemplateId )
291291 {
292292 $ templateName = $ t ['Name ' ];
293293 break ;
294294 }
295295 }
296-
296+
297297 $ firstinitial = $ params ['clientsdetails ' ]['firstname ' ][0 ];
298298 $ lastname = $ params ['clientsdetails ' ]['lastname ' ];
299299 $ clientid = str_pad ($ params ['clientsdetails ' ]['client_id ' ], 4 , '0 ' , STR_PAD_LEFT );
@@ -345,8 +345,8 @@ function AMP_CreateAccount(array $params)
345345 Capsule::table ('ampTasks ' )->updateOrInsert (['serviceId ' => $ params ['serviceid ' ]], ['type ' => 'redeploy ' , 'tried ' => 0 ]);
346346 }
347347
348-
349-
348+
349+
350350
351351
352352 return 'success ' ;
@@ -359,7 +359,7 @@ function AMP_TerminateAccount(array $params)
359359{
360360 try {
361361 AMP_commercialCheck ($ params );
362- $ service = Capsule::table ('ampServices ' )->where ('serviceId ' , $ params ['serviceid ' ])->first ();
362+ $ service = Capsule::table ('ampServices ' )->where ('serviceId ' , $ params ['serviceid ' ])->first ();
363363 if (empty ($ service ->instanceId ))
364364 {
365365 return 'Instance ID not found ' ;
@@ -382,7 +382,7 @@ function AMP_SuspendAccount(array $params)
382382{
383383 try {
384384 AMP_commercialCheck ($ params );
385- $ service = Capsule::table ('ampServices ' )->where ('serviceId ' , $ params ['serviceid ' ])->first ();
385+ $ service = Capsule::table ('ampServices ' )->where ('serviceId ' , $ params ['serviceid ' ])->first ();
386386 if (empty ($ service ->instanceId ))
387387 {
388388 return 'Instance ID not found ' ;
@@ -405,7 +405,7 @@ function AMP_UnsuspendAccount(array $params)
405405{
406406 try {
407407 AMP_commercialCheck ($ params );
408- $ service = Capsule::table ('ampServices ' )->where ('serviceId ' , $ params ['serviceid ' ])->first ();
408+ $ service = Capsule::table ('ampServices ' )->where ('serviceId ' , $ params ['serviceid ' ])->first ();
409409 if (empty ($ service ->instanceId ))
410410 {
411411 return 'Instance ID not found ' ;
@@ -428,15 +428,15 @@ function AMP_ChangePackage(array $params)
428428{
429429 try {
430430 AMP_commercialCheck ($ params );
431- $ service = Capsule::table ('ampServices ' )->where ('serviceId ' , $ params ['serviceid ' ])->first ();
432- $ provisioningTemplateId = $ params ['configoption1 ' ];
431+ $ service = Capsule::table ('ampServices ' )->where ('serviceId ' , $ params ['serviceid ' ])->first ();
432+ $ provisioningTemplateId = $ params ['configoption1 ' ];
433433 if (empty ($ service ->instanceId ))
434434 {
435435 return 'Instance ID not found ' ;
436436 }
437437
438438 $ client = new Client ($ params );
439- $ data = [
439+ $ data = [
440440 'InstanceID ' => $ service ->instanceId ,
441441 'TemplateID ' => $ provisioningTemplateId ,
442442 'Secret ' => 'secretwhmcs ' . $ params ['serviceid ' ],
@@ -461,10 +461,10 @@ function AMP_AdminServicesTabFields(array $params)
461461 'Status ' => 'Awaiting callback '
462462 ];
463463 }
464-
464+
465465 try {
466466 $ client = new Client ($ params );
467-
467+
468468 $ response = $ client ->call ('ADSModule/GetGroup ' , [ 'GroupId ' => $ service ->targetId ] );
469469 foreach ($ response ['AvailableInstances ' ] as $ i )
470470 {
@@ -476,7 +476,7 @@ function AMP_AdminServicesTabFields(array $params)
476476 }
477477
478478 $ endpoint = $ service ->endpointUri ? ('<a target="_blank" href=" ' .$ service ->endpointUri .'" target="_blank"> ' .$ service ->endpoint .'</a> ' ) : $ service ->endpoint ;
479-
479+
480480 $ endpoints = json_decode ($ service ->endpoints , 1 );
481481
482482 foreach ($ endpoints as $ e )
@@ -494,11 +494,11 @@ function AMP_AdminServicesTabFields(array $params)
494494 . '<input type="text" name="amp_instance_id" value=" ' . htmlspecialchars ($ service ->instanceId ) . '" /> ' ,
495495 'Target ID ' => '<input type="hidden" name="amp_original_targetId" value=" ' . htmlspecialchars ($ service ->targetId ) . '" /> '
496496 . '<input type="text" name="amp_target_id" value=" ' . htmlspecialchars ($ service ->targetId ) . '" /> ' ,
497- ] + $ vars ;
497+ ] + $ vars ;
498498
499499 } catch (\Exception $ e ) {
500500 return ['Error ' => $ e ->getMessage ()];
501- }
501+ }
502502 }
503503 return [];
504504}
@@ -525,7 +525,7 @@ function AMP_AdminServicesTabFieldsSave(array $params)
525525
526526function AMP_ClientArea (array $ params )
527527{
528-
528+
529529 $ service = Capsule::table ('ampServices ' )->where ('serviceId ' , $ params ['serviceid ' ])->first ();
530530 $ client = new Client ($ params );
531531
@@ -537,36 +537,36 @@ function AMP_ClientArea(array $params)
537537 $ result = AMP_startInstance ($ params );
538538 $ r = ($ result == 'success ' ) ? 'success ' : 'failure ' ;
539539 $ m = ($ result == 'success ' ) ? 'Application has been started successfully ' : $ result ;
540- echo json_encode (['result ' => $ r , 'message ' => $ m ]);
540+ echo json_encode (['result ' => $ r , 'message ' => $ m ]);
541541 break ;
542542 case 'stopInstance ' :
543543 $ result = AMP_stopInstance ($ params );
544544 $ r = ($ result == 'success ' ) ? 'success ' : 'failure ' ;
545545 $ m = ($ result == 'success ' ) ? 'Application has been stopped successfully ' : $ result ;
546- echo json_encode (['result ' => $ r , 'message ' => $ m ]);
546+ echo json_encode (['result ' => $ r , 'message ' => $ m ]);
547547 break ;
548548 case 'restartInstance ' :
549549 $ result = AMP_restartInstance ($ params );
550550 $ r = ($ result == 'success ' ) ? 'success ' : 'failure ' ;
551551 $ m = ($ result == 'success ' ) ? 'Application has been restarted successfully ' : $ result ;
552- echo json_encode (['result ' => $ r , 'message ' => $ m ]);
552+ echo json_encode (['result ' => $ r , 'message ' => $ m ]);
553553 break ;
554554 case 'resetPassword ' :
555555 $ result = AMP_resetPassword ($ params );
556556 $ r = ($ result == 'success ' ) ? 'success ' : 'failure ' ;
557557 $ m = ($ result == 'success ' ) ? 'Application password has ben reseted successfully ' : $ result ;
558- echo json_encode (['result ' => $ r , 'message ' => $ m ]);
558+ echo json_encode (['result ' => $ r , 'message ' => $ m ]);
559559 break ;
560560 case 'ClearInstanceFromWHMCS ' :
561561 $ result = AMP_ClearInstanceFromWHMCS ($ params );
562562 $ r = ($ result == 'success ' ) ? 'success ' : 'failure ' ;
563563 $ m = ($ result == 'success ' ) ? 'Dismissed tasks ' : $ result ;
564564 echo json_encode (['result ' => $ r , 'message ' => $ m ]);
565- break ;
565+ break ;
566566 }
567567 die;
568568 }
569-
569+
570570 $ vars ['mode ' ] = isset ($ params ['configoption6 ' ]) ? $ params ['configoption6 ' ] : 'Standalone URL ' ;
571571
572572
@@ -603,8 +603,8 @@ function AMP_ClientArea(array $params)
603603 return array (
604604 'templatefile ' => 'templates/overview ' ,
605605 'vars ' => $ vars ,
606- );
607- }
606+ );
607+ }
608608
609609
610610function AMP_AdminCustomButtonArray ()
@@ -622,7 +622,7 @@ function AMP_startInstance(array $params)
622622{
623623 try {
624624 AMP_commercialCheck ($ params );
625- $ service = Capsule::table ('ampServices ' )->where ('serviceId ' , $ params ['serviceid ' ])->first ();
625+ $ service = Capsule::table ('ampServices ' )->where ('serviceId ' , $ params ['serviceid ' ])->first ();
626626 if (empty ($ service ->instanceId ))
627627 {
628628 return 'Instance ID not found ' ;
@@ -632,7 +632,7 @@ function AMP_startInstance(array $params)
632632 'InstanceName ' => $ service ->instanceId
633633 ];
634634 $ client ->call ('ADSModule/StartInstance ' , $ data );
635-
635+
636636
637637 return 'success ' ;
638638
@@ -645,7 +645,7 @@ function AMP_stopInstance(array $params)
645645{
646646 try {
647647 AMP_commercialCheck ($ params );
648- $ service = Capsule::table ('ampServices ' )->where ('serviceId ' , $ params ['serviceid ' ])->first ();
648+ $ service = Capsule::table ('ampServices ' )->where ('serviceId ' , $ params ['serviceid ' ])->first ();
649649 if (empty ($ service ->instanceId ))
650650 {
651651 return 'Instance ID not found ' ;
@@ -667,7 +667,7 @@ function AMP_restartInstance(array $params)
667667{
668668 try {
669669 AMP_commercialCheck ($ params );
670- $ service = Capsule::table ('ampServices ' )->where ('serviceId ' , $ params ['serviceid ' ])->first ();
670+ $ service = Capsule::table ('ampServices ' )->where ('serviceId ' , $ params ['serviceid ' ])->first ();
671671 if (empty ($ service ->instanceId ))
672672 {
673673 return 'Instance ID not found ' ;
@@ -689,7 +689,7 @@ function AMP_resetPassword(array $params)
689689{
690690 try {
691691 AMP_commercialCheck ($ params );
692- $ service = Capsule::table ('ampServices ' )->where ('serviceId ' , $ params ['serviceid ' ])->first ();
692+ $ service = Capsule::table ('ampServices ' )->where ('serviceId ' , $ params ['serviceid ' ])->first ();
693693 if (empty ($ service ->instanceId ))
694694 {
695695 return 'Instance ID not found ' ;
0 commit comments