# Uploading a show This process involves requesting a slot and verifying that the request is valid. [`calendar.php`](https://repo.anhonesthost.net/HPR/hpr_hub/src/branch/main/hub/calendar.php) → [`request.php`](https://repo.anhonesthost.net/HPR/hpr_hub/src/branch/main/hub/request.php) → [`request_confirm.php`](https://repo.anhonesthost.net/HPR/hpr_hub/src/branch/main/hub/request_confirm.php) → `email` → [`upload.php`](https://repo.anhonesthost.net/HPR/hpr_hub/src/branch/main/hub/upload.php) → [`upload_confirm.php`](https://repo.anhonesthost.net/HPR/hpr_hub/src/branch/main/hub/upload_confirm.php) → `email` # Summary - The host has their show recorded and wishes to select a slot. - They go to https://hackerpublicradio.org/ and select the [⇧Upload⇧](https://hub.hackerpublicradio.org/calendar.php), which executes [calendar.php](https://repo.anhonesthost.net/HPR/hpr_hub/src/branch/main/hub/calendar.php). - The host selects a slot from [request.php](https://repo.anhonesthost.net/HPR/hpr_hub/src/branch/main/hub/request.php), which executes [request_confirm.php](https://repo.anhonesthost.net/HPR/hpr_hub/src/branch/main/hub/request_confirm.php). - An email is sent to the host. - The host clicks on the email link and is redirected to [upload.php](https://repo.anhonesthost.net/HPR/hpr_hub/src/branch/main/hub/upload.php). - The host fills in the form which executes [upload_confirm.php](https://repo.anhonesthost.net/HPR/hpr_hub/src/branch/main/hub/upload_confirm.php). - The host receives a confirmation email. # Checking for a free slot > The Host wishes to upload a show and wants to pick a date. [`calendar.php`](https://repo.anhonesthost.net/HPR/hpr_hub/src/branch/main/hub/calendar.php) ```mermaid sequenceDiagram Host->>HPR: Display current schedule Note over HPR: calendar.php HPR->>DB: Remove any old stale requests REQUEST_UNVERIFIED HPR->>HPR: Remove any requests from this IP older than 15min HPR->>Host: Display Calendar page ``` > The website provides a Calendar with a list of available slots. ![The Calendar page](calendar.png) --- # Requesting a slot > The Host decides on a slot and wants to reserve it. [`request.php`](https://repo.anhonesthost.net/HPR/hpr_hub/src/branch/main/hub/request.php) → **REQUEST_UNVERIFIED** ```mermaid sequenceDiagram Host->>HPR: Request a free slot Note over HPR: request.php HPR->>HPR: Remove unverified requests HPR->>HPR: Check for existing upload from this IP alt Existing Upload found HPR->>Host: You already made a request for a show Note over Host: 412 Precondition Failed end HPR->>HPR: Create a temporary entry for this Host HPR->>DB: Set status to REQUEST_UNVERIFIED HPR->>HPR: Check for excessive uploads alt Excessive uploads found HPR->>Host: Uploads have temporarily been suspended Note over Host: 412 Precondition Failed end HPR->>HPR: Populate the list of posted shows HPR->>HPR: Validate provided ID alt Invalid ID found HPR->>HPR: Log IP to naughty file. HPR->>Host: 412 Precondition Failed Note over Host: 412 Precondition Failed end HPR->>HPR: Generate webform of free slots HPR->>HPR: Populate the list of posted shows HPR->>Host: Webform ``` > The website returns the webpage for the Host to enter their email address, and modify the date. ![The request a slot form page](request_slot_form.png) --- # Reserving the Slot > The Hosts provides their email address, and date they wish to reserve. [`request_confirm.php`](https://repo.anhonesthost.net/HPR/hpr_hub/src/branch/main/hub/request_confirm.php) → **REQUEST_EMAIL_SENT** ```mermaid sequenceDiagram Host->>HPR: show ID and email Note over HPR: request_confirm.php loop Preform Checks alt If check fails HPR->>HPR: Log Error HPR->>Host: 412 ${error_code} end end HPR->>DB: Set status to REQUEST_EMAIL_SENT HPR-->>email: email upload url email-->>Host: email upload url HPR->>Host: Thank You page ``` > If an error occurs one of the following error codes will be returned. ### Possible request_confirm.php errors | 412 Error Code | Check | | --- | ------ | | e015b7c89da03385a9156d3e5d2eb25d | The ID is not an integer | | 1493a07dec01a006d11bf43d2f17e5aa | The ID is negative | | 79543dbb498ec47404aaed4d56bdc22b | Only one argument was allowed | | f1f531c768f64404cb00437254b06d71 | The ID is too large | | 2227263ac7171aca3214d155dec539ad | The ID is already allotted | | 5971624889258aefb44e5f7bf8dffbd4 | We are under DDOS attack. | | 19e9019c9615f755aec834000892ee9e | Wrong method used | | 9bb147a251e8db132dafa93d98f8487f | Your hiding your IP Address | | 02de1aef3b9490a417c39170d8f06028 | You did not use the web form | | 2162941738512bfdb1d21f288ee7cdb4 | You skipped the request page | | f0ad965f523b5c2ade071eb20d3618b5 | A breach in the space time continuum | | 6570026fd11fc31ac0cada3e1dae4d0b | There is too long a time entering the form | | a32fbe5f0494eb7f34034b164739314d | Wrong date | | 76eaa1a1556faeadfc14631c35b8590a | Missing an email address | | 8c307efe37146015a35e2d928c2c0f69 | Not a valid email | | 705f8e26e42a90b31075a110674b19ee | Not a valid date | | ad7f805c2f42be77122ec52f114fe318 | Date failed format check | | 9424f7407b2fb83407760ad763286b53 | Episode Number is wrong | | 59c7bff340d023773d987d71df545110 | Invalid date | | 47d186ad8d5b21ec7d455477ea08b023 | Episode already exists | | 7304801e8ce3b9096d28dbe1a0faa642 | Episode number is outside allowable window | | 34c4259b45927da50ba5c49970f880a4 | Episode date is outside allowable window | | d0e113355b35f96945124d8e507759a0 | Problem finding the date and episode number | | 434cb53552ce1e2708e74a42f438028c | Problem mapping the date to the episode number | | c7405e79b54f582e8db46c69ec4b0f24 | Problem writing to the database | > The website provides a "Thank You" page notifying the Host that the email is sent. ![The email confirmation page](request_slot_thank_you.png) --- # Confirming a working email address > The Host checks their email and receives a link to where they can upload their show `email` ![The email containing the link](email_confirmation_of_request_to_reserve.png) --- # Host clicks the email link to upload their show > The Host clicks on the link provided in the email in order to upload their show [`upload.php`](https://repo.anhonesthost.net/HPR/hpr_hub/src/branch/main/hub/upload.php) → **EMAIL_LINK_CLICKED** ```mermaid sequenceDiagram host->>HPR: Host clicks on link from email Note over HPR: upload.php HPR->>DB: Set status to EMAIL_LINK_CLICKED loop Preform Checks alt If check fails HPR->>HPR: Log Error HPR->>host: 412 ${error_code} end end HPR->>host: Upload Webform ``` ### Possible upload.php errors | 412 Error Code | Check | | --- | ------ | | 9a77e4ab24410cbf68a3a05ba97221e4 | Wrong method used | | e8ac90fc2a8996e5fb7a83e73e636e80 | The format of the key is invalid | | 91432866e3c9c36a9c4884345d578761 | Could not find reservation in the Database | | b019bd29c1fe5b756e4b620a5428f730 | The Database entry is missing fields | | 35a7f4e80ecba8284049e9d6261ae523 | Can't Delete entry from Database | | 066c518314f0d3b1ad3e4af60fcf36ce | Unable to remove temporary lock | | 5cb513b590ab5859bf7603b79402a5cb | Could not find Host in Database | > The website provides a form to upload the show, and to change the host profile. ![The upload form](upload_form.png) --- # Upload > The Host fills out the upload form and submits the show. [`upload_confirm.php`](https://repo.anhonesthost.net/HPR/hpr_hub/src/branch/main/hub/upload_confirm.php) → **SHOW_SUBMITTED** ```mermaid sequenceDiagram host->>HPR: Uploads show Note over HPR: upload_confirm.php loop Preform Checks alt If check fails HPR->>HPR: Log Error HPR->>host: 412 ${error_code} end end HPR-->>Disk: Save files HPR->>DB: Set status to SHOW_SUBMITTED HPR-->>email: Upload Confirmation email-->>host: Upload Confirmation ``` ### Possible upload_confirm.php errors | 412 Error Code | Check | | --- | ------ | | 88fe2bc11a90f9f9ab9bdcc8a82d7401 | We are under DDOS attack. | | 29e9019c9615f755aec834000892ee9e | Wrong method used | | abb147a251e8db132dafa93d98f8487f | Your hiding your IP Address | | 7a994999b40e3dc2e3eecfdc36a78d23 | Incorrect number of fields provided | | 2fb4c4e05f0e8f37a5b47565cfb863f5 | The format of the key is invalid | | 3162941738512bfdb1d21f288ee7cdb4 | Cant find reservation in the Database | | 457bf84c726d1cbbd381933e3a08b2ac | The email is missing from the Database | | 00ad965f523b5c2ade071eb20d3618b5 | The Timestamp is to old | | 7570026fd11fc31ac0cada3e1dae4d0b | The Timestamp is to young | | 32831f22fb96d02ce819127d558d28a2 | The Title length is not OK | | ecfcc4c12bf4319d412d66fd2e239249 | The Summary length is not OK | | a8345484b7a4ebad5af54937a3b2e26b | The Shownotes are missing | | b5609bad7edd70d76d75652fb0592ec4 | The shownotes_format is not OK | | 39cc8812b02607d613c6a7ba7e789f2c | The explicit flag is missing | | 198ab3b8af59ffba12c335239bde2876 | The explicit is not either Yes or Clean | | 194c24ff7396901c0ccc42fb21344683 | The license length is incorrect | | f5609bad7edd70d76d75652fb0592ec4 | The license is not a valid value | | 5860799406a323209b902d5104fe7bae | The Notes are greater than max 40000 | | f1c83b57821d562f66246d975ef28994 | The Series number is incorrect | | 27457bada69cbc352af762bdf649e905 | The Series has not been found | | 49a69b565acecf9d2a96aacc73aec5aa | The Tags are not the correct length | | 626eae845e0a448be0544775ab5e4dc4 | The host_name is not set or is not the correct length | | f69ec5999e0a02def5a110489401347f | The host_profile is not the correct length | | f2816b32e97be090a96ceabdc9230c9c | The host_license is not in the correct range | | 978a18fa8558f3180897429e63d6ae55 | The host_license is not a predfined value | | 277dc98d43e7840d9f296cce1bc3ec2c | The hostid is missing or is set to 0 | | 93fcc22d0c5ee3fac35e6d658db76059 | Could not get the MAX(hostid) from the Database | | a0f6cae871b85cb66f85d7ed5e91d1bb | The host id is not an int, or is not in the correct range | | 6d4f180c49ff9b9154bd80070ec2c1f3 | The url is not set or is not the correct length | | 9c307efe37146015a35e2d928c2c0f69 | The url has been altered | | d4250c369bd81b27cdc53d0d53321ecd | The upload dir already exists | | 804c4be123ca0327840b76bf4f8eb19e | Unable to create upload dir | | 33370d1c5c19a6ca4ef3f3ce59158e57 | The shownotes txt file already exists | | 85c8df74d172794c49233c1a94c299fd | The shownotes json file already exists | | a1534e6d525352dce7183a2e22862049 | The dir_structure is missing after write | | ab8051b531c120b8bffd2a5b25a19cc3 | The shownotes.txt is missing after write | | 3eb02d6b9ea801d4c5909b4fac0ccd96 | The shownotes.json is missing after write | | c1381f1d2492f81074d8cb70c85f5fc8 | The host photo, has too long type | | 76ec33229ca023336a2b1c649b0491f5 | Could not update Database | > The website provides a form to upload the show, and to change the host profile. ![The upload confirmation form](submission_thank_you.png) # Upload Confirmation Email > The Host receives an email telling them that their show has been successfully uploaded. ![The email containing the confirmation](email_thank_you_for_uploading.png)