summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--controllers/auth.php3
-rw-r--r--controllers/controllers.php20
-rw-r--r--lib/config.template.php5
-rw-r--r--lib/helpers.php10
-rw-r--r--schema/mysql.sql (renamed from schema/schema.sql)0
-rw-r--r--schema/sqlite.sql22
6 files changed, 48 insertions, 12 deletions
diff --git a/controllers/auth.php b/controllers/auth.php
index 3611416..33baa3e 100644
--- a/controllers/auth.php
+++ b/controllers/auth.php
@@ -64,7 +64,8 @@ $app->get('/', function($format='html') use($app) {
ob_start();
render('index', array(
'title' => 'Quill',
- 'meta' => ''
+ 'meta' => '',
+ 'authorizing' => false
));
$html = ob_get_clean();
$res->body($html);
diff --git a/controllers/controllers.php b/controllers/controllers.php
index 337f780..72ac2b8 100644
--- a/controllers/controllers.php
+++ b/controllers/controllers.php
@@ -72,7 +72,8 @@ $app->get('/new', function() use($app) {
'response_date' => $user->last_micropub_response_date,
'syndication_targets' => json_decode($user->syndication_targets, true),
'test_response' => $test_response,
- 'location_enabled' => $user->location_enabled
+ 'location_enabled' => $user->location_enabled,
+ 'authorizing' => false
));
$app->response()->body($html);
}
@@ -103,7 +104,8 @@ $app->get('/bookmark', function() use($app) {
'bookmark_content' => $content,
'bookmark_tags' => $tags,
'token' => generate_login_token(),
- 'syndication_targets' => json_decode($user->syndication_targets, true)
+ 'syndication_targets' => json_decode($user->syndication_targets, true),
+ 'authorizing' => false
));
$app->response()->body($html);
}
@@ -121,7 +123,8 @@ $app->get('/favorite', function() use($app) {
$html = render('new-favorite', array(
'title' => 'New Favorite',
'url' => $url,
- 'token' => generate_login_token()
+ 'token' => generate_login_token(),
+ 'authorizing' => false
));
$app->response()->body($html);
}
@@ -152,7 +155,8 @@ $app->get('/repost', function() use($app) {
$html = render('new-repost', array(
'title' => 'New Repost',
'url' => $url,
- 'token' => generate_login_token()
+ 'token' => generate_login_token(),
+ 'authorizing' => false
));
$app->response()->body($html);
}
@@ -173,17 +177,17 @@ $app->get('/creating-a-token-endpoint', function() use($app) {
$app->redirect('http://indiewebcamp.com/token-endpoint', 301);
});
$app->get('/creating-a-micropub-endpoint', function() use($app) {
- $html = render('creating-a-micropub-endpoint', array('title' => 'Creating a Micropub Endpoint'));
+ $html = render('creating-a-micropub-endpoint', array('title' => 'Creating a Micropub Endpoint', 'authorizing' => false));
$app->response()->body($html);
});
$app->get('/docs', function() use($app) {
- $html = render('docs', array('title' => 'Documentation'));
+ $html = render('docs', array('title' => 'Documentation', 'authorizing' => false));
$app->response()->body($html);
});
$app->get('/privacy', function() use($app) {
- $html = render('privacy', array('title' => 'Quill Privacy Policy'));
+ $html = render('privacy', array('title' => 'Quill Privacy Policy', 'authorizing' => false));
$app->response()->body($html);
});
@@ -230,7 +234,7 @@ $app->get('/add-to-home', function() use($app) {
$app->get('/settings', function() use($app) {
if($user=require_login($app)) {
- $html = render('settings', array('title' => 'Settings', 'include_facebook' => true));
+ $html = render('settings', array('title' => 'Settings', 'include_facebook' => true, 'authorizing' => false));
$app->response()->body($html);
}
});
diff --git a/lib/config.template.php b/lib/config.template.php
index dae8968..ee822bb 100644
--- a/lib/config.template.php
+++ b/lib/config.template.php
@@ -4,11 +4,16 @@ class Config {
public static $base_url = 'http://quill.dev/';
public static $gaid = '';
+ // MySQL (default)
public static $dbHost = '127.0.0.1';
public static $dbName = 'quill';
public static $dbUsername = 'quill';
public static $dbPassword = '';
+ // Sqlite
+ // public static $dbType = 'sqlite';
+ // public static $dbFilePath = './example.db';
+
public static $jwtSecret = 'xxx';
public static $fbClientID = '';
diff --git a/lib/helpers.php b/lib/helpers.php
index ad16e1b..eb8994c 100644
--- a/lib/helpers.php
+++ b/lib/helpers.php
@@ -1,8 +1,12 @@
<?php
-ORM::configure('mysql:host=' . Config::$dbHost . ';dbname=' . Config::$dbName);
-ORM::configure('username', Config::$dbUsername);
-ORM::configure('password', Config::$dbPassword);
+if(Config::$dbType == 'sqlite') {
+ ORM::configure('sqlite:' . Config::$dbFilePath);
+} else {
+ ORM::configure('mysql:host=' . Config::$dbHost . ';dbname=' . Config::$dbName);
+ ORM::configure('username', Config::$dbUsername);
+ ORM::configure('password', Config::$dbPassword);
+}
function render($page, $data) {
global $app;
diff --git a/schema/schema.sql b/schema/mysql.sql
index 5f33ce6..5f33ce6 100644
--- a/schema/schema.sql
+++ b/schema/mysql.sql
diff --git a/schema/sqlite.sql b/schema/sqlite.sql
new file mode 100644
index 0000000..ac691e3
--- /dev/null
+++ b/schema/sqlite.sql
@@ -0,0 +1,22 @@
+CREATE TABLE users (
+ id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
+ url TEXT,
+ authorization_endpoint TEXT,
+ token_endpoint TEXT,
+ micropub_endpoint TEXT,
+ micropub_access_token TEXT,
+ micropub_scope TEXT,
+ micropub_response TEXT,
+ micropub_success INTEGER default 0,
+ date_created datetime,
+ last_login datetime,
+ last_micropub_response TEXT,
+ last_micropub_response_date datetime,
+ location_enabled INTEGER NOT NULL default 0,
+ syndication_targets TEXT,
+ facebook_access_token TEXT,
+ twitter_access_token TEXT,
+ twitter_token_secret TEXT,
+ twitter_username TEXT,
+ instagram_access_token TEXT
+); \ No newline at end of file