Skip to content

Commit

Permalink
2.3.0 Alpha Rev. 382 from SourceForge
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronbean committed Sep 2, 2014
1 parent a6b2ae9 commit 3d6d518
Show file tree
Hide file tree
Showing 6 changed files with 86 additions and 50 deletions.
5 changes: 4 additions & 1 deletion TODO.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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(...)
Expand All @@ -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.

Expand All @@ -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.
Expand Down
20 changes: 3 additions & 17 deletions config-defaults.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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 ------------
Expand Down
2 changes: 1 addition & 1 deletion install/upgradedb-data.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
12 changes: 11 additions & 1 deletion install/upgradedb-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
?>
95 changes: 66 additions & 29 deletions install/upgradedb.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,57 +99,94 @@ function verifyUpgrade() {

?><h3>Records</h3><blockquote><?php

$InsertDefaultRecord_Calendar = false;
$InsertDefaultRecord_Category = false;
$InsertDefaultRecord_Sponsor = false;

// Check if the default calendar records exist
$result =& DBQuery("SELECT id FROM vtcal_calendar WHERE id='default'");
if (is_string($result)) {
echo "<div class='Error'><b>Error:</b> Could not SELECT from vtcal_calendar to determine if default calendar exists: " . $result . "</div>";
if (!array_key_exists('vtcal_calendar', $CurrentTables)) {
echo "<div class='Create Record'><b>Insert Record:</b> The <b>default calendar</b> is missing and will be created.</div>";
$InsertDefaultRecord_Calendar = true;
}
else {
if ($result->numRows() == 0) {
echo "<div class='Create Record'><b>Insert Record:</b> The <b>default calendar</b> is missing and will be created.</div>";
$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 "<div class='Error'><b>Error:</b> Could not SELECT from vtcal_calendar to determine if default calendar exists: " . $result . "</div>";
$changes += 0.0001;
}
else {
echo "<div class='Success'><b>OK:</b> Default calendar exists.</div>";
if ($result->numRows() == 0) {
echo "<div class='Create Record'><b>Insert Record:</b> The <b>default calendar</b> is missing and will be created.</div>";
$InsertDefaultRecord_Calendar = true;
}
else {
echo "<div class='Success'><b>OK:</b> Default calendar exists.</div>";
}
$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 "<div class='Error'><b>Error:</b> Could not SELECT from vtcal_category to determine if categories exist for the default: " . $result . "</div>";
if (!array_key_exists('vtcal_category', $CurrentTables)) {
echo "<div class='Create Record'><b>Insert Record:</b> The default calendar is missing <b>categories</b>, so one will be created.</div>";
$InsertDefaultRecord_Category = true;
}
else {
if ($result->numRows() == 0) {
echo "<div class='Create Record'><b>Insert Record:</b> The default calendar is missing <b>categories</b>, so one will be created.</div>";
$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 "<div class='Error'><b>Error:</b> Could not SELECT from vtcal_category to determine if categories exist for the default: " . $result . "</div>";
$changes += 0.0001;
}
else {
echo "<div class='Success'><b>OK:</b> At least one category exists for the default calendar.</div>";
if ($result->numRows() == 0) {
echo "<div class='Create Record'><b>Insert Record:</b> The default calendar is missing <b>categories</b>, so one will be created.</div>";
$InsertDefaultRecord_Category = true;
}
else {
echo "<div class='Success'><b>OK:</b> At least one category exists for the default calendar.</div>";
}
$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 "<div class='Error'><b>Error:</b> Could not SELECT from vtcal_sponsor to determine if the admin sponsor exists for the default calendar: " . $result . "</div>";
if (!array_key_exists('vtcal_sponsor', $CurrentTables)) {
echo "<div class='Create Record'><b>Insert Record:</b> The default calendar is missing the <b>admin sponsor</b>, so it will be created.</div>";
$InsertDefaultRecord_Sponsor = true;
}
else {
if ($result->numRows() == 0) {
echo "<div class='Create Record'><b>Insert Record:</b> The default calendar is missing the <b>admin sponsor</b>, so it will be created.</div>";
$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 "<div class='Error'><b>Error:</b> Could not SELECT from vtcal_sponsor to determine if the admin sponsor exists for the default calendar: " . $result . "</div>";
$changes += 0.0001;
}
else {
echo "<div class='Success'><b>OK:</b> The admin sponsor exists for the default calendar.</div>";
if ($result->numRows() == 0) {
echo "<div class='Create Record'><b>Insert Record:</b> The default calendar is missing the <b>admin sponsor</b>, so it will be created.</div>";
$InsertDefaultRecord_Sponsor = true;
}
else {
echo "<div class='Success'><b>OK:</b> The admin sponsor exists for the default calendar.</div>";
}
$result->free();
}
$result->free();
}

if ($InsertDefaultRecord_Sponsor) {
$FinalSQL .= "INSERT INTO vtcal_sponsor (calendarid, name, url, email, admin) VALUES ('default', 'Administration', '', '', 1);\n\n";
$changes++;
}

?></blockquote><?php
Expand Down
2 changes: 1 addition & 1 deletion version.inc.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
define('VERSION', '2.3.0.375');
define('VERSION', '2.3.0.382');
define('VERSION_EXTENSION', ' Alpha');
?>

0 comments on commit 3d6d518

Please sign in to comment.