Commit Graph

31 Commits

Author SHA1 Message Date
johnnyq
ae468d6cee Encrypted backups with types, scheduling and CLI restore
Backups are now AES-256 encrypted zips in three types (full, database
only, master key), catalogued in a new backups table, built by cron rather
than the web request, and kept under uploads/backups with retention in the
nightly job. The encryption key is one value per install held in config.php,
never in the database and never in the file name.

Restore is shared by the setup wizard and the new scripts/restore_cli.php,
which is the only path without an upload size limit. It verifies the key and
unpacks the archive before dropping anything, and dumps the current database
first so a failed import is rolled back.

A backup dumps, zips and encrypts for minutes without issuing a query, so on
a server with a short wait_timeout the connection is closed underneath it and
the UPDATE marking the backup complete is what fails - long after the archive
was written correctly. The connection is now held open for the job and
re-established before any write that follows long file work, including the
database phase of a restore. Retention recovers rows a dropped connection
left behind: still Running after six hours becomes Complete if the archive is
on disk, Failed if it is not.

cron.php's own failure path is hardened to match. It recorded job failures
through the same connection the failing job had just killed, so an uncaught
exception ended the dispatch and no trace of the original error survived.
Failures now also echo to stdout, so cron mails something useful when the
database is unreachable.

Security: the setup wizard's restore step is now closed on any install that
has users, whatever config.php says. $config_enable_setup defaulted to
enabled when the flag was absent, and the flag is only written at the end of
a successful install, so an install abandoned partway left an unauthenticated
endpoint that would drop every table, import an attacker-supplied archive,
and overwrite uploads/ including the .htaccess that stops PHP running there.
Affects 26.07 and earlier. Restoring over a live install is now CLI only.
2026-07-31 16:18:20 -04:00
johnnyq
8993bce53f Force No Indexes of empty directories even if enabled using .htaccess in uploads 2026-07-24 20:52:35 -04:00
johnnyq
5ef53b569c Create upload folders for recurring tickets and ticket_templates 2025-11-24 13:09:01 -05:00
johnnyq
435da991ec Add custom folder to uploads for custom uploading for custom modules 2025-11-23 14:32:57 -05:00
johnnyq
ebd9aae924 Add Document Templates to uploads dir 2025-11-23 14:30:50 -05:00
johnnyq
e73af9980e Also Delete Documents/Document_id folder during bulk delete 2025-11-23 13:43:12 -05:00
johnnyq
29839d3b23 Implemented saveBase64Images() to convert base64 <img> tags into real files stored under /uploads/<module>/<id>/ with secure filenames. Added wrapper functions and updated document creation to use processed image paths. 2025-11-23 13:03:03 -05:00
johnnyq
2ee70fd3a8 Update .htaccess 2025-10-09 19:23:48 -04:00
johnnyq
ed589ef65b Update Backup / Restore, now streams backup and restore to disk instead of memory causing memory to run out, sets timeout limit to unlimited, checks backup file contents for anything bad, use php instead shell exec for import of db, added .htaccess for apache to prevent php execution in /uploads/ directory as this is intended for file download only 2025-10-09 12:28:38 -04:00
johnnyq
5d9ab76689 Remove Custom favicon 2024-02-03 14:32:08 -05:00
johnnyq
e9c85297eb Feature: Allow to upload custom fav icon under settings > Theme, icon is limited to .ico format only 2024-02-03 14:30:03 -05:00
Marcus Hill
0a9af8f2e0 Ticket attachments (email)
Email to ticket parser: Add support for email attachments
2023-04-30 10:52:25 +01:00
johnnyq
48fe49cf77 BREAKING CHANGES - MAKE FULL BACKUP BEFORE PROCEEDING - Requires Manual Intervention on files see Forum Post Make sure you run the Database update directly after update. This Removes Multi-Company Functionality. Fixes issues with Reponsive tables and bunch of other UI and small Fixes 2023-03-11 16:16:46 -05:00
Marcus Hill
6746edda1a Misc tidying code spacing & formatting in accordance with SonarCloud/PSR 2023-01-01 15:41:21 +00:00
johnny@pittpc.com
67a0c8bfbf Created a tmp directory, added states array to setup add localhost default database host value to setup, added inputmask to setup 2019-08-22 13:24:36 -04:00
johnny@pittpc.com
c2786d42ff even more gitignore fixes 2019-08-05 17:39:19 -04:00
johnny@pittpc.com
3770e8bdc5 more gitignore fixes 2019-08-05 17:34:24 -04:00
johnny@pittpc.com
4f65fcb86f Cleared git cache to honor gitignore 2019-08-05 17:29:49 -04:00
johnny@pittpc.com
8ca2b833e6 Invalid Get var in API redirect back to login Instead of showing error 2019-07-20 16:20:19 -04:00
johnny@pittpc.com
bdcb8e3bb7 Some UI Enhancements, Fixed issue where dashboard was calculating transfers as well as payment as income, fixed missing syntax in cron.php, fixed issue where invoice notes were not showing under guest invoice view, updated the db to comply with mysql strict mode 2019-07-12 17:53:34 -04:00
root
86b0c1c45a Changed upload paths 2019-05-27 13:45:47 -04:00
root
bdbbecfc7b Added Send Email to invoice listings, started adding pregtty graphs to dashboard, and other ui cleanup 2019-05-04 01:06:03 -04:00
root
448267cb32 Marked Invoice status overdue if > due_date and not draft or paid, Added some nice statistic graphics for invoices 2019-04-30 13:28:16 -04:00
root
40e3097125 Added SMTP Port field, Set invoice naming YYYY-MM-DD-COMPANY-Invoice##, and some other little cleanups 2019-04-28 14:38:10 -04:00
root
2e1a9ae7c7 Fixed Calculation in Profit and Loss under total expenses, it was calculating transfers too so added vendor_id > 0 2019-04-27 15:38:58 -04:00
root
3e7df44eed moved email_invoice.php into post.php along with pdf_invoice.php 2019-04-16 14:44:02 -04:00
root
88ee1f2156 Added Option to Email Thank you for your payment! under add payment 2019-04-16 14:11:30 -04:00
root
06b1f55849 Invoices now shows the remaining balance after amount 2019-04-13 22:41:03 -04:00
root
4ba961e533 Bunch of changes including mpdf library for creating pdf of invoices. It now attaches a PDF invoice when marked sent. Don't mark invoice_status sent if it partial or paid, removed green text from balance under clients only use red if the client has a balance and some other cleanups were done 2019-04-13 21:34:25 -04:00
root
a280a56e68 remove an s in add and edit mileage 2019-03-30 11:31:03 -04:00
root
8063c627f8 Implemented user avatar support 2019-03-22 21:38:08 -04:00