@@ -104,7 +104,7 @@ public function time4vps_InitAPI($params)
104
104
Endpoint::DebugFunction (function ($ args , $ request , $ response ) use ($ debug ) {
105
105
$ id = hash ('crc32 ' , microtime (true ));
106
106
$ benchmark = $ debug ->benchmark ();
107
- $ this ->log ($ args [1 ], json_encode (array ('Request ' => $ request ,'Response ' => (string ) $ response , 'time taken ' => $ benchmark ), true ), 'input ' , true );
107
+ $ this ->log ($ args [1 ], json_encode (array ('Request ' => $ request , 'Response ' => (string )$ response , 'time taken ' => $ benchmark ), true ), 'input ' , true );
108
108
});
109
109
}
110
110
@@ -254,6 +254,7 @@ public function tabserviceStats($package, $service, array $get = null, array $po
254
254
$ this ->view ->setDefaultView ('components ' . DS . 'modules ' . DS . 'time4vps ' . DS );
255
255
return $ this ->view ->fetch ();
256
256
}
257
+
257
258
/**
258
259
* Client Area Server Reboot
259
260
*
@@ -281,7 +282,7 @@ public function tabReboot($package, $service, array $get = null, array $post = n
281
282
$ last_result = null ;
282
283
$ error = null ;
283
284
if (!empty ($ _POST ['confirm ' ])) {
284
- $ error = time4vps_Reboot ($ params );
285
+ $ error = time4vps_Reboot ($ params );
285
286
if ($ error === 'success ' ) {
286
287
time4vps_MarkServerDetailsObsolete ($ params );
287
288
return ;
@@ -329,7 +330,7 @@ public function tabResetpassword($package, $service, array $get = null, array $p
329
330
$ last_result = null ;
330
331
$ error = null ;
331
332
if (!empty ($ post ['confirm ' ])) {
332
- $ error = time4vps_ResetPassword ($ params );
333
+ $ error = time4vps_ResetPassword ($ params );
333
334
if ($ error === 'success ' ) {
334
335
time4vps_MarkServerDetailsObsolete ($ params );
335
336
return ;
@@ -630,7 +631,7 @@ public function tabEmergencyConsole($package, $service, array $get = null, array
630
631
// Load the helpers required for this view
631
632
Loader::loadHelpers ($ this , ['Form ' , 'Html ' ]);
632
633
$ service_fields = $ this ->serviceFieldsToObject ($ service ->fields );
633
- if (isset ($ service_fields ->time4vps_domain ) && $ service_fields ->time4vps_domain == 'serverhost.name ' ){
634
+ if (isset ($ service_fields ->time4vps_domain ) && $ service_fields ->time4vps_domain == 'serverhost.name ' ) {
634
635
$ row = $ this ->getModuleRow ();
635
636
$ params = [];
636
637
$ params ['serverhttpprefix ' ] = isset ($ row ->meta ->use_ssl ) && $ row ->meta ->use_ssl == true ? 'https ' : 'http ' ;
@@ -640,13 +641,15 @@ public function tabEmergencyConsole($package, $service, array $get = null, array
640
641
$ params ['service_id ' ] = $ service ->id ;
641
642
time4vps_InitAPI ($ params );
642
643
$ remote_service = time4vps_GetServiceDetails ($ params ); // remote service details
643
- $ service_fields ->time4vps_domain = is_array ($ remote_service ) && isset ($ remote_service ['domain ' ]) && !empty ($ remote_service ['domain ' ]) ? $ remote_service ['domain ' ]: 'serverhost.name ' ;
644
+ $ service_fields ->time4vps_domain = is_array ($ remote_service ) && isset ($ remote_service ['domain ' ]) && !empty ($ remote_service ['domain ' ]) ? $ remote_service ['domain ' ] : 'serverhost.name ' ;
644
645
}
645
646
$ last_result = null ;
646
647
$ error = null ;
647
648
if (!empty ($ post ['timeout ' ])) {
649
+ $ error = time4vps_EmergencyConsole ($ params , $ post ['timeout ' ]);
648
650
if ($ error === 'success ' ) {
649
651
time4vps_MarkServerDetailsObsolete ($ params );
652
+ return ;
650
653
}
651
654
}
652
655
try {
@@ -682,7 +685,7 @@ public function tabCancelService($package, $service, array $get = null, array $p
682
685
// Load the helpers required for this view
683
686
Loader::loadHelpers ($ this , ['Form ' , 'Html ' ]);
684
687
$ service_fields = $ this ->serviceFieldsToObject ($ service ->fields );
685
- if (isset ($ service_fields ->time4vps_domain ) && $ service_fields ->time4vps_domain == 'serverhost.name ' ){
688
+ if (isset ($ service_fields ->time4vps_domain ) && $ service_fields ->time4vps_domain == 'serverhost.name ' ) {
686
689
$ row = $ this ->getModuleRow ();
687
690
$ params = [];
688
691
$ params ['serverhttpprefix ' ] = isset ($ row ->meta ->use_ssl ) && $ row ->meta ->use_ssl == true ? 'https ' : 'http ' ;
@@ -692,7 +695,7 @@ public function tabCancelService($package, $service, array $get = null, array $p
692
695
$ params ['service_id ' ] = $ service ->id ;
693
696
time4vps_InitAPI ($ params );
694
697
$ remote_service = time4vps_GetServiceDetails ($ params ); // remote service details
695
- $ service_fields ->time4vps_domain = is_array ($ remote_service ) && isset ($ remote_service ['domain ' ]) && !empty ($ remote_service ['domain ' ]) ? $ remote_service ['domain ' ]: 'serverhost.name ' ;
698
+ $ service_fields ->time4vps_domain = is_array ($ remote_service ) && isset ($ remote_service ['domain ' ]) && !empty ($ remote_service ['domain ' ]) ? $ remote_service ['domain ' ] : 'serverhost.name ' ;
696
699
}
697
700
// Perform the password reset
698
701
if (!empty ($ post )) {
@@ -885,8 +888,8 @@ public function getPackageFields($vars = null)
885
888
$ params ['serverusername ' ] = isset ($ response ->meta ) ? $ response ->meta ->user_name : $ response ->user_name ;
886
889
$ params ['serverpassword ' ] = isset ($ response ->meta ->password ) ? $ response ->meta ->password : $ response ->password ;
887
890
$ params ['serveraccesshash ' ] = isset ($ response ->meta ->access_hash ) ? $ response ->meta ->access_hash : $ response ->access_hash ;
888
- $ params ['serversecure ' ] = ((isset ($ response ->meta ->use_ssl ) && $ response ->meta ->use_ssl == true ) || (isset ($ response ->use_ssl ) && $ response ->use_ssl == true ) ) ? '1 ' : '0 ' ;
889
- $ params ['serverhttpprefix ' ] = ((isset ($ response ->meta ->use_ssl ) && $ response ->meta ->use_ssl == true ) || (isset ($ response ->use_ssl ) && $ response ->use_ssl == true ) ) ? 'https ' : 'http ' ;
891
+ $ params ['serversecure ' ] = ((isset ($ response ->meta ->use_ssl ) && $ response ->meta ->use_ssl == true ) || (isset ($ response ->use_ssl ) && $ response ->use_ssl == true )) ? '1 ' : '0 ' ;
892
+ $ params ['serverhttpprefix ' ] = ((isset ($ response ->meta ->use_ssl ) && $ response ->meta ->use_ssl == true ) || (isset ($ response ->use_ssl ) && $ response ->use_ssl == true )) ? 'https ' : 'http ' ;
890
893
$ available_products = $ available_products + $ this ->time4vps_ProductLoaderFunction ($ params ); //Append products to existing Array
891
894
$ available_scripts = $ available_scripts + $ this ->time4vps_InitScriptLoaderFunction ($ params ); // Append init scripts to existing Array
892
895
}
@@ -952,7 +955,7 @@ public function getPackageFields($vars = null)
952
955
$ configoption4_note = $ fields ->label (
953
956
Language::_ ('time4vps.package_fields.configoption4_note ' , true ),
954
957
'time4vps_configoption4_note ' ,
955
- array ( 'id ' => "time4vps_configoption4_note " )
958
+ array ('id ' => "time4vps_configoption4_note " )
956
959
);
957
960
$ fields ->setField ($ configoption4_note );
958
961
@@ -973,19 +976,19 @@ public function getPackageFields($vars = null)
973
976
$ Component_map_note = $ fields ->label (
974
977
Language::_ ('time4vps.package_fields.Component_map_note ' , true ),
975
978
'time4vps_Component_map_note ' ,
976
- array ( 'id ' => "time4vps_Component_map_note " )
979
+ array ('id ' => "time4vps_Component_map_note " )
977
980
);
978
981
$ fields ->setField ($ Component_map_note );
979
982
//Advance mode link
980
983
$ advance_mode = $ fields ->label (
981
984
Language::_ ('time4vps.package_fields.advance_mode ' , true ),
982
985
'time4vps_advance_mode ' ,
983
- array ( 'id ' => "time4vps_advance_mode " , 'style ' => "text-decoration: underline; " )
986
+ array ('id ' => "time4vps_advance_mode " , 'style ' => "text-decoration: underline; " )
984
987
);
985
988
$ normal_mode = $ fields ->label (
986
989
Language::_ ('time4vps.package_fields.normal_mode ' , true ),
987
990
'time4vps_normal_mode ' ,
988
- array ( 'id ' => "time4vps_normal_mode " , 'style ' => "text-decoration: underline; display:none; " )
991
+ array ('id ' => "time4vps_normal_mode " , 'style ' => "text-decoration: underline; display:none; " )
989
992
);
990
993
$ fields ->setField ($ advance_mode );
991
994
$ fields ->setField ($ normal_mode );
@@ -1117,8 +1120,8 @@ public function AddServerPackages($module, $module_id, $module_row)
1117
1120
$ vars = [
1118
1121
"names " => [
1119
1122
[
1120
- "lang " => 'en_us ' ,
1121
- "name " => $ product ['name ' ]
1123
+ "lang " => 'en_us ' ,
1124
+ "name " => $ product ['name ' ]
1122
1125
]
1123
1126
],
1124
1127
"descriptions " => [
@@ -1166,8 +1169,8 @@ public function AddServerPackages($module, $module_id, $module_row)
1166
1169
"groups " => [],
1167
1170
"group_names " => [
1168
1171
[
1169
- "lang " => "en_us " ,
1170
- "name " => ""
1172
+ "lang " => "en_us " ,
1173
+ "name " => ""
1171
1174
]
1172
1175
],
1173
1176
"save " => "Create Package " ,
@@ -1262,7 +1265,7 @@ public function addModuleRow(array &$vars)
1262
1265
$ params ['serverpassword ' ] = $ vars ['password ' ];
1263
1266
$ response = $ this ->time4vps_TestConnection ($ params );
1264
1267
if ($ response ['success ' ]) {
1265
- $ meta_fields = ['server_name ' , 'host_name ' , 'user_name ' , 'password ' , 'access_hash ' ,'use_ssl ' ];
1268
+ $ meta_fields = ['server_name ' , 'host_name ' , 'user_name ' , 'password ' , 'access_hash ' , 'use_ssl ' ];
1266
1269
$ encrypted_fields = ['password ' ];
1267
1270
1268
1271
// Set unspecified checkboxes
@@ -1306,7 +1309,7 @@ public function addModuleRow(array &$vars)
1306
1309
*/
1307
1310
public function editModuleRow ($ module_row , array &$ vars )
1308
1311
{
1309
- $ meta_fields = ['server_name ' , 'host_name ' , 'user_name ' , 'password ' , 'access_hash ' ,'use_ssl ' ];
1312
+ $ meta_fields = ['server_name ' , 'host_name ' , 'user_name ' , 'password ' , 'access_hash ' , 'use_ssl ' ];
1310
1313
$ encrypted_fields = ['password ' ];
1311
1314
1312
1315
// Set unspecified checkboxes
@@ -1376,7 +1379,7 @@ public function getServiceName($service)
1376
1379
$ params ['service_id ' ] = $ service ->id ;
1377
1380
time4vps_InitAPI ($ params );
1378
1381
$ remote_service = time4vps_GetServiceDetails ($ params ); // service details
1379
- $ service_name = is_array ($ remote_service ) && isset ($ remote_service ['domain ' ]) && !empty ($ remote_service ['domain ' ]) ? $ remote_service ['domain ' ]: 'serverhost.name ' ;
1382
+ $ service_name = is_array ($ remote_service ) && isset ($ remote_service ['domain ' ]) && !empty ($ remote_service ['domain ' ]) ? $ remote_service ['domain ' ] : 'serverhost.name ' ;
1380
1383
} else {
1381
1384
$ service_name = 'serverhost.name ' ;
1382
1385
}
@@ -1764,7 +1767,7 @@ public function addService($package, array $vars = null, $parent_package = null,
1764
1767
$ vars ['time4vps_billing_cycle ' ] = $ package ->pricing [0 ]->period ;
1765
1768
// Generate username/password
1766
1769
if (array_key_exists ('time4vps_domain ' , $ vars )) {
1767
- Loader::loadModels ($ this , ['Clients ' ,'Packages ' ]);
1770
+ Loader::loadModels ($ this , ['Clients ' , 'Packages ' ]);
1768
1771
1769
1772
// Strip "www." from beginning of domain if present
1770
1773
@@ -1993,7 +1996,7 @@ public function cancelService($package, $service, $parent_package = null, $paren
1993
1996
$ params ['serverhostname ' ] = $ row ->meta ->host_name ;
1994
1997
$ params ['serverusername ' ] = $ row ->meta ->user_name ;
1995
1998
$ params ['serverpassword ' ] = $ row ->meta ->password ;
1996
- $ params = array ('accountid ' => $ service ->id_value , 'serviceid ' => $ service ->id ,'userid ' => $ service ->client_id , 'domain ' => $ service_fields ->time4vps_domain , 'username ' => $ service_fields ->time4vps_username , 'password ' => $ service_fields ->time4vps_password , 'packageid ' => $ service ->package ->id , 'status ' => $ service ->package ->status , 'type ' => 'server ' , 'producttype ' => 'server ' , 'moduletype ' => 'time4vps ' , 'configoption3 ' => $ service ->package ->meta ->os_list );
1999
+ $ params = array ('accountid ' => $ service ->id_value , 'serviceid ' => $ service ->id , 'userid ' => $ service ->client_id , 'domain ' => $ service_fields ->time4vps_domain , 'username ' => $ service_fields ->time4vps_username , 'password ' => $ service_fields ->time4vps_password , 'packageid ' => $ service ->package ->id , 'status ' => $ service ->package ->status , 'type ' => 'server ' , 'producttype ' => 'server ' , 'moduletype ' => 'time4vps ' , 'configoption3 ' => $ service ->package ->meta ->os_list );
1997
2000
return time4vps_TerminateAccount ($ params );
1998
2001
}
1999
2002
return null ;
0 commit comments