diff --git a/modules/addons/passwordtoggleplus/passwordtoggleplus.php b/modules/addons/passwordtoggleplus/passwordtoggleplus.php new file mode 100644 index 0000000..783b756 --- /dev/null +++ b/modules/addons/passwordtoggleplus/passwordtoggleplus.php @@ -0,0 +1,61 @@ + 'Password Toggle Plus', + 'description' => 'Enhanced password visibility control with copy functionality for WHMCS product details', + 'version' => '1.0', + 'author' => 'ArkHost', + 'fields' => [] + ]; +} + +function passwordtoggleplus_activate() { + return [ + 'status' => 'success', + 'description' => 'Password Toggle Plus activated successfully' + ]; +} + +function passwordtoggleplus_deactivate() { + return [ + 'status' => 'success', + 'description' => 'Password Toggle Plus deactivated successfully' + ]; +} + +function passwordtoggleplus_clientarea($vars) { + if (isset($_GET['action']) && $_GET['action'] === 'getpassword') { + header('Content-Type: text/plain'); + + $serviceid = (int)$_GET['id']; + $pid = Capsule::table('tblhosting') + ->where('id', $serviceid) + ->value('packageid'); + + if ($pid) { + $fields = Capsule::table('tblcustomfields') + ->where('type', 'product') + ->where('relid', $pid) + ->get(); + + foreach ($fields as $field) { + if (strpos(strtolower($field->fieldname), 'password') !== false) { + $value = Capsule::table('tblcustomfieldsvalues') + ->where('fieldid', $field->id) + ->where('relid', $serviceid) + ->value('value'); + + logActivity("Password Toggle Plus - Password request via clientarea"); + return ['password' => $value ?? 'No password value']; + } + } + } + return ['password' => 'No password found']; + } + return []; +}