diff --git a/.gitignore b/.gitignore
index 9d1ae46e..cc2e9938 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,21 +1,24 @@
 # Commonly ignored files list. For locally ignored files (e.g. local IDE
 # settings), use .git/info/exclude file. Keep the lines in this file sorted.
 
-/lib/htmlpurifier-4.2.0/library/HTMLPurifier/DefinitionCache/Serializer/CSS/*
-/lib/htmlpurifier-4.2.0/library/HTMLPurifier/DefinitionCache/Serializer/HTML/*
-/lib/htmlpurifier-4.2.0/library/HTMLPurifier/DefinitionCache/Serializer/URI/*
-/htdocs/cache/*
-/htdocs/cache2/*
+# settings files
 /htdocs/config2/settings.inc.php
-/htdocs/download/*
-/htdocs/images/statpics/*
-/htdocs/images/uploads/*
 /htdocs/lib/settings.inc.php
-/htdocs/resource2/tinymce/tiny_mce_*.gz
-/htdocs/util-local/ocxml11client/data-files
-/htdocs/util-local/ocxml11client/tmp
 /htdocs/util/mysql_root/settings.inc.php
 /htdocs/util/notification/settings.inc.php
 /htdocs/util/publish_caches/settings.inc.php
 /htdocs/util/watchlist/settings.inc.php
+
+# other data
+/htdocs/cache/*
+/htdocs/cache2/*
+/htdocs/download/*
+/htdocs/images/statpics/*
+/htdocs/images/uploads/*
+/htdocs/resource2/tinymce/tiny_mce_*.gz
+/htdocs/util-local/ocxml11client/data-files
+/htdocs/util-local/ocxml11client/tmp
 /htdocs/var/*
+/lib/htmlpurifier-4.2.0/library/HTMLPurifier/DefinitionCache/Serializer/CSS/*
+/lib/htmlpurifier-4.2.0/library/HTMLPurifier/DefinitionCache/Serializer/HTML/*
+/lib/htmlpurifier-4.2.0/library/HTMLPurifier/DefinitionCache/Serializer/URI/*
diff --git a/htdocs/doc/sql/db-changes.txt b/htdocs/doc/sql/db-changes.txt
index adacf30f..5b6df428 100644
--- a/htdocs/doc/sql/db-changes.txt
+++ b/htdocs/doc/sql/db-changes.txt
@@ -8,3 +8,10 @@ date         commit ID    change
 2012-08-06   1ba2be52     changed triggers sysTransBeforeInsert and sysTransTextBeforeInsert
 2012-08-07   eda58c51     new field caches.is_publishdate; changed trigger cachesBeforeUpdate
 2012-08-08   fc481334     changed trigger cachesBeforeInsert
+
+2012-08-18   56b80e02     OKAPI will do these changes AUTOMATICALLY upon installation:
+                            - add okapi_* tables
+                            - add caches.okapi_syncbase, initialize it and add corresponding index
+                            - change cache_logs.last_modified and cache_logs_archived.last_modified
+                              field type from 'datetime' to 'timestamp'
+                          See installation instructions at http://code.google.com/p/opencaching-api
diff --git a/htdocs/doc/sql/tables/okapi_authorizations.sql b/htdocs/doc/sql/tables/okapi_authorizations.sql
new file mode 100644
index 00000000..642573dd
--- /dev/null
+++ b/htdocs/doc/sql/tables/okapi_authorizations.sql
@@ -0,0 +1,8 @@
+SET NAMES 'utf8';
+DROP TABLE IF EXISTS `okapi_authorizations`;
+CREATE TABLE `okapi_authorizations` (
+  `consumer_key` varchar(20) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
+  `user_id` int(11) NOT NULL,
+  `last_access_token` datetime DEFAULT NULL,
+  PRIMARY KEY (`consumer_key`,`user_id`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;
diff --git a/htdocs/doc/sql/tables/okapi_cache.sql b/htdocs/doc/sql/tables/okapi_cache.sql
new file mode 100644
index 00000000..4e2df304
--- /dev/null
+++ b/htdocs/doc/sql/tables/okapi_cache.sql
@@ -0,0 +1,8 @@
+SET NAMES 'utf8';
+DROP TABLE IF EXISTS `okapi_cache`;
+CREATE TABLE `okapi_cache` (
+  `key` varchar(64) NOT NULL,
+  `value` mediumblob,
+  `expires` datetime DEFAULT NULL,
+  PRIMARY KEY (`key`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;
diff --git a/htdocs/doc/sql/tables/okapi_cache_logs.sql b/htdocs/doc/sql/tables/okapi_cache_logs.sql
new file mode 100644
index 00000000..aefd67bc
--- /dev/null
+++ b/htdocs/doc/sql/tables/okapi_cache_logs.sql
@@ -0,0 +1,8 @@
+SET NAMES 'utf8';
+DROP TABLE IF EXISTS `okapi_cache_logs`;
+CREATE TABLE `okapi_cache_logs` (
+  `log_id` int(11) NOT NULL,
+  `consumer_key` varchar(20) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
+  PRIMARY KEY (`log_id`),
+  KEY `by_consumer` (`consumer_key`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;
diff --git a/htdocs/doc/sql/tables/okapi_clog.sql b/htdocs/doc/sql/tables/okapi_clog.sql
new file mode 100644
index 00000000..081c22ce
--- /dev/null
+++ b/htdocs/doc/sql/tables/okapi_clog.sql
@@ -0,0 +1,7 @@
+SET NAMES 'utf8';
+DROP TABLE IF EXISTS `okapi_clog`;
+CREATE TABLE `okapi_clog` (
+  `id` int(10) NOT NULL AUTO_INCREMENT,
+  `data` mediumblob,
+  PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;
diff --git a/htdocs/doc/sql/tables/okapi_consumers.sql b/htdocs/doc/sql/tables/okapi_consumers.sql
new file mode 100644
index 00000000..946f9efd
--- /dev/null
+++ b/htdocs/doc/sql/tables/okapi_consumers.sql
@@ -0,0 +1,11 @@
+SET NAMES 'utf8';
+DROP TABLE IF EXISTS `okapi_consumers`;
+CREATE TABLE `okapi_consumers` (
+  `key` varchar(20) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
+  `name` varchar(100) NOT NULL,
+  `secret` varchar(40) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
+  `url` varchar(250) DEFAULT NULL,
+  `email` varchar(70) DEFAULT NULL,
+  `date_created` datetime NOT NULL,
+  PRIMARY KEY (`key`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;
diff --git a/htdocs/doc/sql/tables/okapi_nonces.sql b/htdocs/doc/sql/tables/okapi_nonces.sql
new file mode 100644
index 00000000..37fe404f
--- /dev/null
+++ b/htdocs/doc/sql/tables/okapi_nonces.sql
@@ -0,0 +1,8 @@
+SET NAMES 'utf8';
+DROP TABLE IF EXISTS `okapi_nonces`;
+CREATE TABLE `okapi_nonces` (
+  `consumer_key` varchar(20) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
+  `key` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
+  `timestamp` int(10) NOT NULL,
+  PRIMARY KEY (`consumer_key`,`key`,`timestamp`)
+) ENGINE=MEMORY DEFAULT CHARSET=utf8 ;
diff --git a/htdocs/doc/sql/tables/okapi_stats_hourly.sql b/htdocs/doc/sql/tables/okapi_stats_hourly.sql
new file mode 100644
index 00000000..ea104ac6
--- /dev/null
+++ b/htdocs/doc/sql/tables/okapi_stats_hourly.sql
@@ -0,0 +1,13 @@
+SET NAMES 'utf8';
+DROP TABLE IF EXISTS `okapi_stats_hourly`;
+CREATE TABLE `okapi_stats_hourly` (
+  `consumer_key` varchar(32) NOT NULL,
+  `user_id` int(10) NOT NULL,
+  `period_start` datetime NOT NULL,
+  `service_name` varchar(80) NOT NULL,
+  `total_calls` int(10) NOT NULL,
+  `http_calls` int(10) NOT NULL,
+  `total_runtime` float NOT NULL DEFAULT '0',
+  `http_runtime` float NOT NULL DEFAULT '0',
+  PRIMARY KEY (`consumer_key`,`user_id`,`period_start`,`service_name`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;
diff --git a/htdocs/doc/sql/tables/okapi_stats_temp.sql b/htdocs/doc/sql/tables/okapi_stats_temp.sql
new file mode 100644
index 00000000..a93b88aa
--- /dev/null
+++ b/htdocs/doc/sql/tables/okapi_stats_temp.sql
@@ -0,0 +1,10 @@
+SET NAMES 'utf8';
+DROP TABLE IF EXISTS `okapi_stats_temp`;
+CREATE TABLE `okapi_stats_temp` (
+  `datetime` datetime NOT NULL,
+  `consumer_key` varchar(32) NOT NULL DEFAULT 'internal',
+  `user_id` int(10) NOT NULL DEFAULT '-1',
+  `service_name` varchar(80) NOT NULL,
+  `calltype` enum('internal','http') NOT NULL,
+  `runtime` float NOT NULL DEFAULT '0'
+) ENGINE=MEMORY DEFAULT CHARSET=utf8 ;
diff --git a/htdocs/doc/sql/tables/okapi_tokens.sql b/htdocs/doc/sql/tables/okapi_tokens.sql
new file mode 100644
index 00000000..77773f6b
--- /dev/null
+++ b/htdocs/doc/sql/tables/okapi_tokens.sql
@@ -0,0 +1,14 @@
+SET NAMES 'utf8';
+DROP TABLE IF EXISTS `okapi_tokens`;
+CREATE TABLE `okapi_tokens` (
+  `key` varchar(20) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
+  `secret` varchar(40) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
+  `token_type` enum('request','access') NOT NULL,
+  `timestamp` int(10) NOT NULL,
+  `user_id` int(10) DEFAULT NULL,
+  `consumer_key` varchar(20) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
+  `verifier` varchar(10) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
+  `callback` varchar(2083) DEFAULT NULL,
+  PRIMARY KEY (`key`),
+  KEY `by_consumer` (`consumer_key`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;
diff --git a/htdocs/doc/sql/tables/okapi_vars.sql b/htdocs/doc/sql/tables/okapi_vars.sql
new file mode 100644
index 00000000..2a4724ad
--- /dev/null
+++ b/htdocs/doc/sql/tables/okapi_vars.sql
@@ -0,0 +1,7 @@
+SET NAMES 'utf8';
+DROP TABLE IF EXISTS `okapi_vars`;
+CREATE TABLE `okapi_vars` (
+  `var` varchar(32) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
+  `value` text,
+  PRIMARY KEY (`var`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;
diff --git a/htdocs/lib/settings-dev.inc.php b/htdocs/lib/settings-dev.inc.php
index c487a45a..2077ee40 100644
--- a/htdocs/lib/settings-dev.inc.php
+++ b/htdocs/lib/settings-dev.inc.php
@@ -61,7 +61,7 @@
 	$absolute_server_URI = $dev_baseurl . '/';
 	
 	// EMail address of the sender
-	if (!isset($emailaddr)) $emailaddr = 'contact@mail.opencaching.de';
+	if (!isset($emailaddr)) $emailaddr = 'noreply@opencaching.de';
 	
 	// location of cache images
 	if (!isset($picdir)) $picdir = $rootpath . 'images/uploads';
@@ -235,7 +235,7 @@
 	$OKAPI_SETTINGS = array(
 		'OC_BRANCH' => 'oc.de',
 		'SITELANG' => 'de',
-		'VAR_DIR' => $opt['rootpath'].'var',
+		'VAR_DIR' => $rootpath.'var',
 	);
 
 ?>
diff --git a/htdocs/lib/settings-dist.inc.php b/htdocs/lib/settings-dist.inc.php
index f9e161da..9ac3cb30 100644
--- a/htdocs/lib/settings-dist.inc.php
+++ b/htdocs/lib/settings-dist.inc.php
@@ -301,7 +301,7 @@ function post_config()
 $OKAPI_SETTINGS = array(
 	'OC_BRANCH' => 'oc.de',
 	'SITELANG' => 'de',
-	'VAR_DIR' => $opt['rootpath'].'var',
+	'VAR_DIR' => $rootpath.'var',
 );
 
 ?>