# TeaSpeak WHMCS Provisioning Module - Updated Edition [![PHP Version](https://img.shields.io/badge/PHP-8.0%2B-blue.svg)](https://www.php.net/) [![WHMCS Version](https://img.shields.io/badge/WHMCS-8.0%2B-green.svg)](https://www.whmcs.com/) [![License](https://img.shields.io/badge/License-Proprietary-red.svg)](LICENSE) ## ๐Ÿš€ What's New in This Version This is an **updated and redesigned** version of the TeaSpeak WHMCS module with the following improvements: ### โœจ Updates & Improvements - **PHP 8.x Compatible** - Updated for PHP 8.0+ - **WHMCS API 1.2** - Updated to current WHMCS module API - **Modern PHP Syntax**: - Strict types - Type hints for parameters and return types - Modern array syntax - Improved error handling - **Design Updates** - Refreshed UI - Bootstrap 5 template option - Font Awesome 6 icons - Improved mobile responsiveness - Better user experience - **Code Improvements**: - Better documentation - Improved security practices - Removed hardcoded URLs - Code cleanup and optimization ### ๐Ÿ”ง Technical Improvements 1. **Better Error Handling** - More descriptive error messages - Proper exception handling throughout - Better logging for debugging 2. **Security Enhancements** - Input validation improved - SQL injection protection (using Capsule ORM properly) - XSS prevention in templates - CSRF protection considerations 3. **Performance** - Optimized database queries - Reduced redundant code - Better caching considerations 4. **Maintainability** - Modular code structure - Separated additional functions - Clear function documentation - Consistent coding style ## ๐Ÿ“‹ Requirements - **WHMCS**: 8.0 or higher - **PHP**: 8.0 or higher (recommended: 8.1+) - **MySQL/MariaDB**: 5.7+ / 10.2+ - **PHP Extensions**: - `curl` - `json` - `pdo_mysql` - `mbstring` ## ๐Ÿ“ฆ Installation ### New Installation 1. **Upload Files** ```bash # Upload the module files to your WHMCS directory /path/to/whmcs/modules/servers/teamspeak/ /path/to/whmcs/modules/addons/teamspeak/ ``` 2. **Activate Addon Module** - Login to WHMCS Admin Area - Go to: `Setup > Addon Modules` - Find "TeaSpeak Provisioning" and click "Activate" - Configure the module settings 3. **Configure Server** - Go to: `Setup > Products/Services > Servers` - Add a new server with type "TeaSpeak Provisioning Server" - Enter your TeamSpeak ServerQuery credentials 4. **Create Product** - Go to: `Setup > Products/Services > Products/Services` - Create a new product - Set Module: "TeaSpeak Provisioning Server" - Configure the following **Custom Fields**: - `Token` (Text Box) - Admin token - `Port` (Text Box) - Server port - `Subdomain` (Text Box, optional) - For TSDNS - Configure **Configurable Options**: - `Slots` (Quantity) - Number of slots - `MBots` (Quantity) - Music bot limit ### Upgrading from Old Version 1. **Backup First!** ```bash # Backup your current module cp -r /path/to/whmcs/modules/servers/teamspeak /path/to/backup/ cp -r /path/to/whmcs/modules/addons/teamspeak /path/to/backup/ # Backup database mysqldump -u username -p database_name > backup.sql ``` 2. **Upload New Files** - Replace the old files with the new ones - The database structure remains compatible 3. **Test the Module** - Test creating a new service - Test all functions (start, stop, reinstall, etc.) - Check the client area display 4. **Update Templates (Optional)** - To use the new Bootstrap 5 design, update the template reference: ```php // In teamspeak.php, change: 'tabOverviewReplacementTemplate' => 'templates/overview.tpl', // To: 'tabOverviewReplacementTemplate' => 'templates/overview_modern.tpl', ``` ## ๐ŸŽจ Template Options ### Classic Template (`overview.tpl`) - Bootstrap 3 compatible - Matches older WHMCS themes - Minimal changes from original ### Modern Template (`overview_modern.tpl`) - Bootstrap 5 design - Font Awesome 6 icons - Modern card-based layout - Better mobile responsiveness - Enhanced UX To switch templates, edit `teamspeak.php` in the `teamspeak_ClientArea` function. ## โš™๏ธ Configuration ### Addon Module Settings Access via: `Setup > Addon Modules > TeaSpeak Provisioning` - **License Key**: Your module license key - **Server Name**: Default name for new servers - **Port Range**: Min/Max ports for allocation - **TSDNS Settings**: Enable/disable TSDNS integration - **Branding**: Banner URLs, buttons, welcome messages - **Quotas**: Download/Upload limits and bandwidth ### Product Configuration **Required Custom Fields:** 1. **Token** (Text Box) - Field Name: `Token` - Required for admin access 2. **Port** (Text Box) - Field Name: `Port` - Auto-populated on creation 3. **Subdomain** (Text Box, optional) - Field Name: `Subdomain` - Required only if TSDNS is enabled **Required Configurable Options:** 1. **Slots** (Quantity) - Option Name: `Slots` - User can select slot count 2. **MBots** (Quantity) - Option Name: `MBots` - Music bot limit ## ๐Ÿ”Œ Module Functions ### Core Functions - โœ… **Create Account** - Automatically provisions TeaSpeak server - โœ… **Suspend Account** - Stops server and disables autostart - โœ… **Unsuspend Account** - Restarts server and enables autostart - โœ… **Terminate Account** - Deletes server and cleans up data - โœ… **Change Package** - Updates slots and bot limits - โœ… **Test Connection** - Validates server credentials ### Client Area Functions - โœ… **Start Server** - Start the TeaSpeak server - โœ… **Stop Server** - Stop the TeaSpeak server - โœ… **Reinstall Server** - Complete server reinstallation - โœ… **Reset Permissions** - Reset to default permissions - โœ… **Settings Management** - Change hostname, password, welcome message - โœ… **Token Management** - Create/delete privilege keys - โœ… **Ban Management** - Add/remove IP, name, or UID bans - โœ… **Backup Management** - Create, restore, download, delete backups - โœ… **TSDNS Management** - Edit subdomain (if enabled) ## ๐Ÿ”’ Security Features - Strict type declarations prevent type juggling attacks - Input validation on all user inputs - Parameterized database queries via Capsule ORM - Password confirmation for sensitive operations - IP validation for ban functions - XSS protection in templates - Proper error logging without exposing sensitive data ## ๐Ÿ› Debugging ### Enable Debug Mode In `teamspeak.php`, the module logs all errors via WHMCS's built-in `logModuleCall()` function. **View Logs:** - Admin Area: `Utilities > Logs > Module Log` - Filter by module: "teamspeak" ### Common Issues 1. **"Port does not exist in custom fields"** - Ensure custom field "Port" exists in product settings - Field name must be exactly: `Port` 2. **"Slots parameter not found"** - Ensure configurable option "Slots" exists - Option name must be exactly: `Slots` 3. **"Could not connect to TeamSpeak server"** - Verify server IP and ServerQuery port - Check firewall rules - Verify ServerQuery credentials 4. **TSDNS not working** - Ensure TSDNS is enabled in addon module - Verify TSDNS API URL and key - Check custom field "Subdomain" exists ## ๐ŸŒ Multi-Language Support The module includes translations for: - ๐Ÿ‡ฌ๐Ÿ‡ง English - ๐Ÿ‡ฉ๐Ÿ‡ช German (Deutsch) - ๐Ÿ‡ช๐Ÿ‡ธ Spanish (Espaรฑol) - ๐Ÿ‡ซ๐Ÿ‡ท French (Franรงais) - ๐Ÿ‡ฎ๐Ÿ‡น Italian (Italiano) - ๐Ÿ‡ต๐Ÿ‡น Portuguese (Portuguรชs) - ๐Ÿ‡ง๐Ÿ‡ท Portuguese-BR (Portuguรชs Brasileiro) - ๐Ÿ‡ท๐Ÿ‡บ Russian (ะ ัƒััะบะธะน) - ๐Ÿ‡น๐Ÿ‡ท Turkish (Tรผrkรงe) - And many more... Languages are automatically selected based on client's WHMCS language setting. ## ๐Ÿ“ Changelog ### Version 3.0.0 (2024) - Updated Edition by Kevin Feiler / AVVGO - โœจ PHP 8.x compatibility update - โœจ WHMCS API 1.2 support - โœจ Bootstrap 5 template - โœจ Type hints and strict types - โœจ Modern array syntax - โœจ Improved error handling - โœจ Design improvements - โœจ Code cleanup - โœจ Removed hardcoded URLs - ๐Ÿ› Bug fixes - ๐Ÿ”’ Security improvements ### Version 2.1.4 (Previous) - Original version - Bootstrap 3 design - PHP 7.x compatible - WHMCS API 1.1 ## ๐Ÿค Contributing This module has been updated and improved. For bug reports or feature requests, please contact the maintainer. ## ๐Ÿ“„ License Proprietary license. See LICENSE file for details. ## ๐Ÿ†˜ Support For support regarding the original module: - **Website**: https://planetteaspeak.de - **Email**: support@planetteaspeak.de ## ๐Ÿ™ Credits - **Original Module**: planetteaspeak.de - **Update & Design**: Kevin Feiler / AVVGO (2024) - **TeaSpeak**: https://teaspeak.de - **WHMCS**: https://whmcs.com ## ๐Ÿ“š Additional Resources - [WHMCS Developer Documentation](https://developers.whmcs.com/) - [TeaSpeak Documentation](https://teaspeak.de/docs/) - [PHP 8 Documentation](https://www.php.net/manual/en/migration80.php) --- **Last Updated**: 2024 **Version**: 3.0.0 (Updated Edition) **Updated by**: Kevin Feiler / AVVGO