mirror of
https://github.com/ivuorinen/xkcd-Mailer.git
synced 2026-03-05 01:00:00 +00:00
Indenting and PSR2 styling
This commit is contained in:
@@ -14,8 +14,8 @@
|
|||||||
// Use config.example.php as base for your configurations.
|
// Use config.example.php as base for your configurations.
|
||||||
$lastfile = "last.txt";
|
$lastfile = "last.txt";
|
||||||
|
|
||||||
$here = dirname( __FILE__ );
|
$here = dirname(__FILE__);
|
||||||
if( !is_readable($here . '/config.php') ) {
|
if (! is_readable($here . '/config.php')) {
|
||||||
die("Please configure me. I don't know where I should sent the comic. (Config file {$here}/config.php missing.)");
|
die("Please configure me. I don't know where I should sent the comic. (Config file {$here}/config.php missing.)");
|
||||||
} else {
|
} else {
|
||||||
include_once($here . '/config.php');
|
include_once($here . '/config.php');
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
$feed = "http://xkcd.com/atom.xml";
|
$feed = "http://xkcd.com/atom.xml";
|
||||||
|
|
||||||
// Check if http:// wrapper is allowed
|
// Check if http:// wrapper is allowed
|
||||||
if( ini_get('allow_url_fopen') ) {
|
if (ini_get('allow_url_fopen')) {
|
||||||
$data = simplexml_load_file($feed);
|
$data = simplexml_load_file($feed);
|
||||||
} else {
|
} else {
|
||||||
// If http:// wrapper is disabled (by allow_url_fopen=0, for example), then fall back on cURL
|
// If http:// wrapper is disabled (by allow_url_fopen=0, for example), then fall back on cURL
|
||||||
@@ -43,14 +43,14 @@
|
|||||||
$item = $data->entry[0];
|
$item = $data->entry[0];
|
||||||
|
|
||||||
if (file_exists($lastfile)) {
|
if (file_exists($lastfile)) {
|
||||||
$f = fopen($lastfile, 'r');
|
$f = fopen($lastfile, 'r');
|
||||||
$last = (int) fread($f, 1024);
|
$last = (int) fread($f, 1024);
|
||||||
fclose($f);
|
fclose($f);
|
||||||
} else {
|
} else {
|
||||||
$last = 0;
|
$last = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$parts = explode('/', $item->id);
|
$parts = explode('/', $item->id);
|
||||||
$current = (int) $parts[3];
|
$current = (int) $parts[3];
|
||||||
|
|
||||||
if ($current > $last) {
|
if ($current > $last) {
|
||||||
|
|||||||
Reference in New Issue
Block a user