Changeset 3799773 for gatecraft/trunk/includes/helpers.php
- Timestamp:
- 11/13/2026 06:38:04 AM (40 hours ago)
- File:
-
- 1 edited
-
gatecraft/trunk/includes/helpers.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
gatecraft/trunk/includes/helpers.php
r3797341 r3799773 687 687 } 688 688 689 /** 690 * Unlisted events are reached only by their address, so the address must not be guessable from the title. 691 * event_private_slug() ends it with 12 random hex characters (48 bits); event_slug_base() removes that part again, 692 * so a copy of an unlisted event never carries the original's private part. 693 */ 694 function event_slug_base(string $slug): string 695 { 696 return (string)preg_replace('/-[a-f0-9]{12}$/', '', $slug); 697 } 698 699 function event_private_slug(string $slug): string 700 { 701 if (preg_match('/-[a-f0-9]{12}$/', $slug)) return $slug; 702 return rtrim(substr($slug, 0, 100), '-') . '-' . bin2hex(random_bytes(6)); 703 } 704 689 705 /** Crockford base32 (no I, L, O, U): readable, unambiguous codes. */ 690 706 function random_code(int $len): string
Note:
See TracChangeset
for help on using the changeset viewer.