# Signature Manager - Land Title Texas
Self-hosted email signature management with Office 365 push.

## Deploy Steps

1. Upload and unzip to web root at `/signatures/`

2. Create MySQL database and user:
   ```sql
   CREATE DATABASE lt_signatures CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
   CREATE USER 'lt_sig_user'@'localhost' IDENTIFIED BY 'YOUR_PASSWORD_HERE';
   GRANT ALL PRIVILEGES ON lt_signatures.* TO 'lt_sig_user'@'localhost';
   FLUSH PRIVILEGES;
   ```

3. Import schema:
   ```bash
   mysql -u lt_sig_user -p lt_signatures < /var/www/html/signatures/schema.sql
   ```

4. Edit `includes/db.php` — set DB_PASS and BASE_URL

5. Set permissions:
   ```bash
   sudo chown -R www-data:www-data /var/www/html/signatures/assets/uploads
   sudo chmod -R 755 /var/www/html/signatures/assets/uploads
   ```

6. Create admin user:
   ```bash
   cd /var/www/html/signatures
   php setup.php
   rm setup.php
   ```

7. Upload company logo to `assets/img/logo.png`

8. Log in at `https://landtitletexas.com/signatures/admin/login.php`

## Office 365 Push

1. Install Exchange Online PowerShell module:
   ```powershell
   Install-Module -Name ExchangeOnlineManagement
   ```

2. Download the script from Admin > O365 Push Script

3. Run `Push-Signatures.ps1` — signs into O365 and pushes all signatures

## File Structure

```
signatures/
├── generate.php          # Signature HTML endpoint (public)
├── setup.php             # First-run admin creation (delete after use)
├── schema.sql            # MySQL schema
├── includes/
│   ├── db.php            # Database config (define() constants)
│   ├── auth.php          # Authentication helpers
│   └── layout.php        # Admin layout wrapper
├── admin/
│   ├── login.php         # Admin login
│   ├── index.php         # Employee list
│   ├── employee-edit.php # Add/edit employee
│   ├── settings.php      # Company branding settings
│   ├── preview-all.php   # Preview all signatures
│   ├── push-script.php   # O365 push script & API key
│   ├── download-script.php
│   ├── change-password.php
│   └── logout.php
├── assets/
│   ├── img/              # Company logo
│   └── uploads/photos/   # Employee headshots
└── README.md
```
