diff options
| author | Horus | 2016-07-04 13:52:16 +0200 |
|---|---|---|
| committer | Horus | 2016-07-04 13:52:16 +0200 |
| commit | 366f2499027b5af5851d44ba00f679b1b27631c1 (patch) | |
| tree | e38fdfe8238265154da0a09ab0362a006421951b /index.php | |
| parent | f95af4211bc24e5cf0b5b017c7d50113e4000968 (diff) | |
| download | imap2rss-366f2499027b5af5851d44ba00f679b1b27631c1.tar.gz | |
Params are passed via HTTP.
Diffstat (limited to 'index.php')
| -rw-r--r-- | index.php | 28 |
1 files changed, 23 insertions, 5 deletions
@@ -1,13 +1,31 @@ <?php require_once __DIR__ . '/bootstrap.php'; -$user = "feed@maxmail.xyz"; -$pass = "1234abc"; -#$inbox = array("INBOX", "Trash"); -$inbox = array("INBOX"); -$max_items = 10; +$user = $_REQUEST['user']; +$pass = $_REQUEST['token']; +$inbox = strtoupper($_REQUEST['mailbox']); +$max_items = intval($_REQUEST['max_items']); $ttl = 60*60; +if ( "" === $_REQUEST['user'] || "" === $_REQUEST['token'] ) { + header( $_SERVER['SERVER_PROTOCOL'] . ' 400 Invalid Request.'); + echo "Invalid user or token supplied."; + exit; +} + +if ( "" === $_REQUEST['mailbox'] ) { + $inbox = "INBOX"; +} +$inbox = explode(",", $inbox); + +if ( 0 <= $_REQUEST['max_items'] ) { + $max_items = 10; +} +if ( $max_items > 100 ) { + $max_items = 100; +} + +#var_dump($user, $pass, $inbox, $max_items); exit; $mail = getMail($user, $pass, $inbox, $max_items); $inbox_string = implode(",", $inbox); |
