From 79fd68680b2a04240af206025fd96acd239c41a0 Mon Sep 17 00:00:00 2001 From: jaquer Date: Wed, 26 Jan 2022 09:06:25 -0800 Subject: Ignore changes to the config file. --- .gitignore | 3 ++- README.md | 2 +- config-dist.php | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ config.php | 53 ----------------------------------------------------- 4 files changed, 56 insertions(+), 55 deletions(-) create mode 100644 config-dist.php delete mode 100644 config.php diff --git a/.gitignore b/.gitignore index d952016..424fcc9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ *.db -feed.json \ No newline at end of file +config.php +feed.json diff --git a/README.md b/README.md index 6f5588d..6ea060f 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ For crossposting to twitter, the app uses code from [J7mbo/twitter-api-php](http ### Installation - Copy the files to a directory on your webserver -- edit [config.php](config.php) and adjust the settings if you like (at least set a new password!) +- copy (or rename) [config-dist.php](config-dist.php) to config.php and adjust the settings if you like (at least set a new password!) - for Apache: edit [.htaccess](.htaccess) and set `RewriteBase` to a path matching your installation directory - for nginx: have a rule similar to `try_files $uri $uri/ /index.php?$args;` for the microblog-location - optional: modify the theme file [microblog.css](microblog.css) diff --git a/config-dist.php b/config-dist.php new file mode 100644 index 0000000..41c6430 --- /dev/null +++ b/config-dist.php @@ -0,0 +1,53 @@ +"); +DEFINE('NOW', time()); + +date_default_timezone_set('Europe/Berlin'); + +/* make the path easier to read */ +$path_fragments = (parse_url(str_replace(dirname($_SERVER['SCRIPT_NAME']), '', $_SERVER['REQUEST_URI']), PHP_URL_PATH)); +$path = explode('/', trim($path_fragments, '/')); +if(mb_strlen($path[0]) == 0) $path = array(); + +// (mostly) user settings +$config = array( + 'url' => 'http'.(!empty($_SERVER['HTTPS']) ? 's' : '').'://'.$_SERVER['SERVER_NAME'].dirname($_SERVER['SCRIPT_NAME']), + 'path' => $path, + 'language' => 'en', + 'max_characters' => 280, + 'posts_per_page' => 10, + 'microblog_account' => '', // fill in a @username if you like + 'admin_user' => 'admin', + 'admin_pass' => 'dove-life-bird-lust', + 'cookie_life' => 60*60*24*7*4, // cookie life in seconds + 'ping' => true, // enable automatic pinging of the micro.blog service + 'crosspost_to_twitter' => false, // set this to true to automatically crosspost to a twitter account (requires app credentials, see below) + 'twitter' => array( // get your tokens over at https://dev.twitter.com/apps + 'oauth_access_token' => '', + 'oauth_access_token_secret' => '', + 'consumer_key' => '', + 'consumer_secret' => '' + ) +); + +//connect or create the database and tables +try { + $db = new PDO('sqlite:'.ROOT.DS.'posts.db'); + $db->exec("CREATE TABLE IF NOT EXISTS posts ( + id integer PRIMARY KEY NOT NULL, + post_content TEXT, + post_timestamp integer(128) + );"); +} catch(PDOException $e) { + print 'Exception : '.$e->getMessage(); + die('cannot connect to or open the database'); +} + +// load functions +require_once(ROOT.DS.'functions.php'); \ No newline at end of file diff --git a/config.php b/config.php deleted file mode 100644 index 41c6430..0000000 --- a/config.php +++ /dev/null @@ -1,53 +0,0 @@ -"); -DEFINE('NOW', time()); - -date_default_timezone_set('Europe/Berlin'); - -/* make the path easier to read */ -$path_fragments = (parse_url(str_replace(dirname($_SERVER['SCRIPT_NAME']), '', $_SERVER['REQUEST_URI']), PHP_URL_PATH)); -$path = explode('/', trim($path_fragments, '/')); -if(mb_strlen($path[0]) == 0) $path = array(); - -// (mostly) user settings -$config = array( - 'url' => 'http'.(!empty($_SERVER['HTTPS']) ? 's' : '').'://'.$_SERVER['SERVER_NAME'].dirname($_SERVER['SCRIPT_NAME']), - 'path' => $path, - 'language' => 'en', - 'max_characters' => 280, - 'posts_per_page' => 10, - 'microblog_account' => '', // fill in a @username if you like - 'admin_user' => 'admin', - 'admin_pass' => 'dove-life-bird-lust', - 'cookie_life' => 60*60*24*7*4, // cookie life in seconds - 'ping' => true, // enable automatic pinging of the micro.blog service - 'crosspost_to_twitter' => false, // set this to true to automatically crosspost to a twitter account (requires app credentials, see below) - 'twitter' => array( // get your tokens over at https://dev.twitter.com/apps - 'oauth_access_token' => '', - 'oauth_access_token_secret' => '', - 'consumer_key' => '', - 'consumer_secret' => '' - ) -); - -//connect or create the database and tables -try { - $db = new PDO('sqlite:'.ROOT.DS.'posts.db'); - $db->exec("CREATE TABLE IF NOT EXISTS posts ( - id integer PRIMARY KEY NOT NULL, - post_content TEXT, - post_timestamp integer(128) - );"); -} catch(PDOException $e) { - print 'Exception : '.$e->getMessage(); - die('cannot connect to or open the database'); -} - -// load functions -require_once(ROOT.DS.'functions.php'); \ No newline at end of file -- cgit v1.2.3