Cached Calendar Updates

Redesigned the database structure for the calendar caches to expose less (or none at all, if possible) personal information, and for ease of checking for updates. If the event_hash has changed, the old event will not be matched and will be deleted (there's just not enough information in an event to make it worthwhile to go through and compare them and do "real" updates. Bah.) Put the documentation for the database tables both in the tables (of course) and in the script, for easy reference.

Updated script-ui.css to treat checkboxes like radio buttons: inline.

Updated the debugging output for MySQL queries to be more informative.

Signed-off-by: Seth Battis <SethBattis@stmarksschool.org>
Object, not Array

Oh, right… mysqli returns an object, not an array — re-improved debugging output for mysql.inc.php.

Signed-off-by: Seth Battis <SethBattis@stmarksschool.org>
Sync Deleted/Modified Events

In theory, once the Canvas API starts accepting that I am, in fact, correct, I believe that this should parse the ICS feed, check it against the cache of what's already been put in Canvas, insert any new/changed events and delete any old/deleted events.

That is, it should sync the Canvas with the ICS feed.

However, [I'm getting odd permissions issues from the API trying to delete the old/changed events](https://help.instructure.com/requests/213580).

Meanwhile, I realized that the current architecture would allow you to sync unlimited ICS feeds into the same course… and that you could keep changing events created in Canvas without affecting that sync. (Woe betide you, however, if you change the events synced by the script!)

Also did some fancification of the debug.inc.php to create levels of debugging reporting. Because I can.

Signed-off-by: Seth Battis <SethBattis@stmarksschool.org>
DisplayError and Debugging

Updated displayError to be DEBUGGING-sensitive, allowing yours truly to flag some displayError calls with a debugging level, for easier toggling on and off of debugging messages.

Also standardized on '%' as my regexp delimiter across the board (since '|' is useful as an OR operator, which, for whatever reason, I hadn't needed until now).

Fixed a typo in the displayPage footer.

Signed-off-by: Seth Battis <SethBattis@stmarksschool.org>
API-like File Access

Updated the main .htaccess file to rewrite file requests so that I can call pages without their .php file extensions.

Also pushed the blackboard-import-specific Apache directives into a separate .htaccess file in that directory.

Signed-off-by: Seth Battis <SethBattis@stmarksschool.org>
Syncing

Hourly, daily and weekly syncing are now available options. Choosing one of these options will schedule a crontab job (if it does not already exist) to trigger the scheduled import (via sync.php).

There is room in here to update the form to create custom schedules as well, but I haven't bothered with that yet.

OAuth is becoming increasingly… pertinent (as is the DELETEing of calendar events)...

Signed-off-by: Seth Battis <SethBattis@stmarksschool.org>
Sync Fix

Realized that, for the PHP includes to work, the crontab commands would need to come from within our script directory. Added shell script sync.sh that resolves this and tweaked the sync scheduling to call sync.sh instead of 'php sync.php'.

Added in an attempt to ensure that sync.sh is executable (probably will be, if normal web directory permissions of 0775 are set, I hope…).

Added some clean-up to the scheduler, so that unused crontabs are deleted.

Also, if you leave me with too much time to fiddle around with the debugger, I'll go overboard… and now I've got a nicer way of identifying which instance of the script is posting to the log file. Doubtless, I'll keep fiddling with this indefinitely.

Signed-off-by: Seth Battis <SethBattis@stmarksschool.org>
More Debug Fun

Sigh. Just cleaning things up for my own amusement.

Signed-off-by: Seth Battis <SethBattis@stmarksschool.org>
Deletions DELETE

Turns out, Pest's delete() did not support parameters. Now it does. (Should resolve [this bug](issues/14).)

Got rid of phpicalendar's caching — conflicting caches would, of course, make updates less… timely.

Fixed some MySQL syntax errors.

Signed-off-by: Seth Battis <SethBattis@stmarksschool.org>
Live!

Preparing to bring this online for our live instance. We now require HTTP authentication for the entire script, not just the phpicalendar component.

sync.php assumes an HTTP user that matches the MySQL username and password set in the authentication file.

Signed-off-by: Seth Battis <SethBattis@stmarksschool.org>
Merge branch 'refs/heads/dev-calendar-ics'

Signed-off-by: Seth Battis <SethBattis@stmarksschool.org>

Conflicts:
	www/api/archive-discussions/index.php