diff --git a/TODO.txt b/TODO.txt index 923a9ad..8d152ad 100644 --- a/TODO.txt +++ b/TODO.txt @@ -12,6 +12,9 @@ High: - Change 'Jump To' in column back to being a single drop-down. - Allow data currently stored in session to be loaded from the DB or a file. - Update search logging/reporting so that it knows keywords can only be up to 255 characters. +- Improve description on export page. +- For upgradedb.php make sure 'int(11)' is aliased to 'int'. +- Change fields to NotNull. Many fields are allowed to be null. Low: - Assign DB results by reference. Example: $var =& DBQuery(...) or $results =& $db->query(...) @@ -24,7 +27,6 @@ Low: - "Send event to a friend" form. - Allow week/month to be viewed as a list of events (like upcoming view). - A 'comments' field for sponsors where additional information (e.g. mailing address or phone number) could be stored. -- Include file from static-includes before sub-calendar headers, and after sub-calendar footers. - Develop tool for assisting with translations. - Store IP if logged in and logout if IP changes. @@ -35,6 +37,7 @@ Future: When the event is accepted or rejected, a confirmation e-mail will be sent to the submitter as well. Finished: +- Include file from static-includes before sub-calendar headers, and after sub-calendar footers. - Improve 'Upcoming' print view (Finished 08-10-15) - Disable admin buttons/icons in print view (Finished 08-10-15) - Disable AJAX in month view for little calendar month-navigation arrows. diff --git a/config-defaults.inc.php b/config-defaults.inc.php index c0f3ef3..f6ea680 100644 --- a/config-defaults.inc.php +++ b/config-defaults.inc.php @@ -306,13 +306,6 @@ // END GENERATED -//define("ALLOWED_YEARS_AHEAD", 3); - -//define("INCLUDE_STATIC_PRE_HEADER", false); -//define("INCLUDE_STATIC_POST_HEADER", false); -//define("INCLUDE_STATIC_PRE_FOOTER", false); -//define("INCLUDE_STATIC_POST_FOOTER", false); - // TODO: Disabled feature. define("AUTH_HTTP_CACHE", false); define("AUTH_HTTP_CACHE_EXPIRATIONDAYS", 4); @@ -334,16 +327,9 @@ // ---------- The following functions allow you to customize processing based on your database ------- -/*// escapes a value to make it safe for a SQL query -if (!function_exists('sqlescape')) { - function sqlescape($value) { - if (preg_match("/^pgsql/",DATABASE)) { - return pg_escape_string($value); - } - else { - return mysql_escape_string($value); - } - } +// Escapes a value to make it safe for a SQL query +/*function sqlescape($value) { + }*/ // --------------- The following functions allow you to customize the date format display ------------ diff --git a/install/upgradedb-data.php b/install/upgradedb-data.php index 6d8d912..33e37e6 100644 --- a/install/upgradedb-data.php +++ b/install/upgradedb-data.php @@ -356,7 +356,7 @@ $FinalTables['vtcal_event_repeat']['Fields']['enddate']['NotNull'] = false; $FinalTables['vtcal_event_repeat']['Fields']['enddate']['AutoIncrement'] = false; $FinalTables['vtcal_event_repeat']['Fields']['recordchangedtime']['Type'] = "timestamp"; -$FinalTables['vtcal_event_repeat']['Fields']['recordchangedtime']['NotNull'] = false; +$FinalTables['vtcal_event_repeat']['Fields']['recordchangedtime']['NotNull'] = true; $FinalTables['vtcal_event_repeat']['Fields']['recordchangedtime']['AutoIncrement'] = false; $FinalTables['vtcal_event_repeat']['Fields']['recordchangeduser']['Type'] = "text"; $FinalTables['vtcal_event_repeat']['Fields']['recordchangeduser']['NotNull'] = false; diff --git a/install/upgradedb-functions.php b/install/upgradedb-functions.php index c32b4b1..f0664cf 100644 --- a/install/upgradedb-functions.php +++ b/install/upgradedb-functions.php @@ -43,7 +43,7 @@ function GetTableData(&$TableData, $TableName) { for ($i = 0; $i < $count; $i++) { $record =& $result->fetchRow(DB_FETCHMODE_ASSOC, $i); - $TableData[$TableName]['Fields'][$record['Field']]['Type'] = $record['Type']; + $TableData[$TableName]['Fields'][$record['Field']]['Type'] = GetCommonType($record['Type']); $TableData[$TableName]['Fields'][$record['Field']]['NotNull'] = strtolower($record['Null']) != "yes"; $TableData[$TableName]['Fields'][$record['Field']]['AutoIncrement'] = strpos($record['Extra'],"auto_increment") !== false; } @@ -312,4 +312,14 @@ function GetIndexFieldSQL(&$TableData, $TableName, $IndexName) { } } } + +function GetCommonType($type) { + switch ($type) { + case 'character varying': return 'varchar'; + case 'integer': return 'int'; + case 'int(11)': return 'int'; + case 'timestamp without time zone': return 'timestamp'; + } + return $type; +} ?> \ No newline at end of file diff --git a/install/upgradedb.php b/install/upgradedb.php index 3d08191..6ff6d6f 100644 --- a/install/upgradedb.php +++ b/install/upgradedb.php @@ -99,57 +99,94 @@ function verifyUpgrade() { ?>

Records

Error: Could not SELECT from vtcal_calendar to determine if default calendar exists: " . $result . ""; + if (!array_key_exists('vtcal_calendar', $CurrentTables)) { + echo "
Insert Record: The default calendar is missing and will be created.
"; + $InsertDefaultRecord_Calendar = true; } else { - if ($result->numRows() == 0) { - echo "
Insert Record: The default calendar is missing and will be created.
"; - $FinalSQL .= "INSERT INTO vtcal_calendar " - . "(id, name, title, header, footer, viewauthrequired, forwardeventdefault) " - . "VALUES ('default', 'Default Calendar', 'Events Calendar', '', '', 0, 0);\n\n"; - $changes++; + $result =& DBQuery("SELECT id FROM vtcal_calendar WHERE id='default'"); + if (is_string($result)) { + echo "
Error: Could not SELECT from vtcal_calendar to determine if default calendar exists: " . $result . "
"; + $changes += 0.0001; } else { - echo "
OK: Default calendar exists.
"; + if ($result->numRows() == 0) { + echo "
Insert Record: The default calendar is missing and will be created.
"; + $InsertDefaultRecord_Calendar = true; + } + else { + echo "
OK: Default calendar exists.
"; + } + $result->free(); } - $result->free(); + } + + if ($InsertDefaultRecord_Calendar) { + $FinalSQL .= "INSERT INTO vtcal_calendar " + . "(id, name, title, header, footer, viewauthrequired, forwardeventdefault) " + . "VALUES ('default', 'Default Calendar', 'Events Calendar', '', '', 0, 0);\n\n"; + $changes++; } // Check if the default calendar has categories - $result =& DBQuery("SELECT id FROM vtcal_category WHERE calendarid='default'"); - if (is_string($result)) { - echo "
Error: Could not SELECT from vtcal_category to determine if categories exist for the default: " . $result . "
"; + if (!array_key_exists('vtcal_category', $CurrentTables)) { + echo "
Insert Record: The default calendar is missing categories, so one will be created.
"; + $InsertDefaultRecord_Category = true; } else { - if ($result->numRows() == 0) { - echo "
Insert Record: The default calendar is missing categories, so one will be created.
"; - $FinalSQL .= "INSERT INTO vtcal_category (calendarid, name) VALUES ('default', 'General');\n\n"; - $changes++; + $result =& DBQuery("SELECT id FROM vtcal_category WHERE calendarid='default'"); + if (is_string($result)) { + echo "
Error: Could not SELECT from vtcal_category to determine if categories exist for the default: " . $result . "
"; + $changes += 0.0001; } else { - echo "
OK: At least one category exists for the default calendar.
"; + if ($result->numRows() == 0) { + echo "
Insert Record: The default calendar is missing categories, so one will be created.
"; + $InsertDefaultRecord_Category = true; + } + else { + echo "
OK: At least one category exists for the default calendar.
"; + } + $result->free(); } - $result->free(); + } + + if ($InsertDefaultRecord_Category) { + $FinalSQL .= "INSERT INTO vtcal_category (calendarid, name) VALUES ('default', 'General');\n\n"; + $changes++; } // Check if the default calendar has an admin sponsor. - $result =& DBQuery("SELECT id FROM vtcal_sponsor WHERE calendarid='default' AND admin='1'"); - if (is_string($result)) { - echo "
Error: Could not SELECT from vtcal_sponsor to determine if the admin sponsor exists for the default calendar: " . $result . "
"; + if (!array_key_exists('vtcal_sponsor', $CurrentTables)) { + echo "
Insert Record: The default calendar is missing the admin sponsor, so it will be created.
"; + $InsertDefaultRecord_Sponsor = true; } else { - if ($result->numRows() == 0) { - echo "
Insert Record: The default calendar is missing the admin sponsor, so it will be created.
"; - $FinalSQL .= "INSERT INTO vtcal_sponsor (calendarid, name, url, email, admin) VALUES ('default', 'Administration', '', '', 1);\n\n"; - $changes++; + $result =& DBQuery("SELECT id FROM vtcal_sponsor WHERE calendarid='default' AND admin='1'"); + if (is_string($result)) { + echo "
Error: Could not SELECT from vtcal_sponsor to determine if the admin sponsor exists for the default calendar: " . $result . "
"; + $changes += 0.0001; } else { - echo "
OK: The admin sponsor exists for the default calendar.
"; + if ($result->numRows() == 0) { + echo "
Insert Record: The default calendar is missing the admin sponsor, so it will be created.
"; + $InsertDefaultRecord_Sponsor = true; + } + else { + echo "
OK: The admin sponsor exists for the default calendar.
"; + } + $result->free(); } - $result->free(); + } + + if ($InsertDefaultRecord_Sponsor) { + $FinalSQL .= "INSERT INTO vtcal_sponsor (calendarid, name, url, email, admin) VALUES ('default', 'Administration', '', '', 1);\n\n"; + $changes++; } ?>
\ No newline at end of file