mirror of
https://github.com/ivuorinen/xkcd-Mailer.git
synced 2026-03-04 17:00:00 +00:00
Configuration file example, reflecting README and .gitignore.
You can now configure xkcd-Mailer without touching the script itself. Yay!
This commit is contained in:
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
config.php
|
||||||
|
.DS_Store
|
||||||
22
README.md
22
README.md
@@ -2,6 +2,27 @@
|
|||||||
|
|
||||||
Takes the first/latest item from the [xkcd](http://xkcd.com/) atom-feed and mails the image and punchline to a specified email address.
|
Takes the first/latest item from the [xkcd](http://xkcd.com/) atom-feed and mails the image and punchline to a specified email address.
|
||||||
|
|
||||||
|
## configuration ##
|
||||||
|
|
||||||
|
The script needs a simple configuration. Modify ``config.example.php`` to fit your needs and save as ``config.php``
|
||||||
|
|
||||||
|
```php
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* xkcd-Mailer configuration example
|
||||||
|
* Save me as config.php
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Your timezone, PHP5 required.
|
||||||
|
// See full list: http://www.php.net/manual/en/timezones.php
|
||||||
|
date_default_timezone_set("Europe/Helsinki");
|
||||||
|
|
||||||
|
// Your destination
|
||||||
|
$mail = "your@email.com";
|
||||||
|
$from = "xkcd mailer <xkcdmailer@example.com>";
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
## crontab example ##
|
## crontab example ##
|
||||||
|
|
||||||
15 minutes over 7am on monday, wednesday and friday.
|
15 minutes over 7am on monday, wednesday and friday.
|
||||||
@@ -12,7 +33,6 @@ Takes the first/latest item from the [xkcd](http://xkcd.com/) atom-feed and mail
|
|||||||
## caveats ##
|
## caveats ##
|
||||||
|
|
||||||
- Script doesn't check has the feed been updated, possibly causing old strip delivery
|
- Script doesn't check has the feed been updated, possibly causing old strip delivery
|
||||||
- You have to modify script to change delivery address, config file could be the solution
|
|
||||||
|
|
||||||
|
|
||||||
## contributing ##
|
## contributing ##
|
||||||
|
|||||||
15
config.example.php
Normal file
15
config.example.php
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
<?php if ( empty($here) ) exit('No direct script access allowed');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xkcd-Mailer configuration example
|
||||||
|
* Save me as config.php
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Your timezone, PHP5 required.
|
||||||
|
// See full list: http://www.php.net/manual/en/timezones.php
|
||||||
|
date_default_timezone_set("Europe/Helsinki");
|
||||||
|
|
||||||
|
// Your destination
|
||||||
|
$mail = "your@email.com";
|
||||||
|
$from = "xkcd mailer <xkcdmailer@example.com>";
|
||||||
|
|
||||||
@@ -6,17 +6,18 @@
|
|||||||
* strip with alt/title-text underneath the image.
|
* strip with alt/title-text underneath the image.
|
||||||
*
|
*
|
||||||
* @author Ismo Vuorinen
|
* @author Ismo Vuorinen
|
||||||
* @version 23 August, 2010
|
* @version 1.0.20130619
|
||||||
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
||||||
* @package default
|
* @package default
|
||||||
**/
|
**/
|
||||||
|
|
||||||
// Your timezone, PHP5 required.
|
// Use config.example.php as base for your configurations.
|
||||||
date_default_timezone_set("Europe/Helsinki");
|
$here = dirname( __FILE__ );
|
||||||
|
if( !is_readable($here . '/config.php') ) {
|
||||||
// Your destination
|
die("Please configure me. I don't know where I should sent the comic. (Config file {$here}/config.php missing.)");
|
||||||
$mail = "ivuorinen@me.com";
|
} else {
|
||||||
$from = "xkcd mailer <xkcdmailer@example.com>";
|
include_once($here . '/config.php');
|
||||||
|
}
|
||||||
|
|
||||||
$feed = "http://xkcd.com/atom.xml";
|
$feed = "http://xkcd.com/atom.xml";
|
||||||
$data = simplexml_load_file($feed);
|
$data = simplexml_load_file($feed);
|
||||||
|
|||||||
Reference in New Issue
Block a user