Skip to content

Commit

Permalink
Cleaned Up Config
Browse files Browse the repository at this point in the history
Array needed simplifying.
  • Loading branch information
Brendan Farr-Gaynor committed Dec 24, 2012
1 parent 12e5c65 commit befe82f
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 32 deletions.
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,19 @@ Simply set the configuration file with the details for your account and path to

require("BitFunnel.php");

$config = array();

$config['account'][0]['server']['host'] = "imap.gmail.com"; //eg. imap.gmail.com
$config['account'][0]['server']['port'] = "993"; //eg IMAP SSL (Gmail Default)
$config['account'][0]['server']['user'] = "foo";
$config['account'][0]['server']['password'] = "bar";
$config['account'][0]['server']['flags'][] = "imap"; //Gmail defaults
$config['account'][0]['server']['flags'][] = "ssl"; //Gmail defaults
$config['account'][0]['server']['mailbox'] = "INBOX"; // eg. INBOX (Gmail Default)
$config['account'][0]['savePath'] = "attachments/";


$myAccount = $config['account'][0];
$myAccount = array(
'account' => array(
'server' => array(
'host' => 'imap.gmail.com'
, 'port' => '993'
, 'user' => 'youruser'
, 'password' => 'swordfish'
, 'flags' => array('imap', 'ssl')
, 'mailbox' => "INBOX"
)
, 'savepath' => 'attachments/'
)
);

//grab the attachments
$bitFunnel = new BitFunnel($myAccount);
Expand Down
44 changes: 27 additions & 17 deletions config.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,17 @@
config.php - Sets an array with connection details for your remote IMAP server.
*/
HOST - Internet domain name or bracketed IP address of server.
//HOST - Internet domain name or bracketed IP address of server.
$config['account'][0]['server']['host'] = "imap.gmail.com"; //eg. imap.gmail.com
PORT - optional TCP port number, default is the default port for that service
//PORT - optional TCP port number, default is the default port for that service
$config['account'][0]['server']['port'] = "993"; //eg IMAP SSL (Gmail Default)
USER - your account name
//USERNAME - your account name
$config['account'][0]['server']['user'] = "";
//PASSWORD - your account password
$config['account'][0]['server']['password'] = "";
PASSWORD - your account password
/*
FLAGS - optional flags, see following table.
/service=service mailbox access service, default is "imap"
Expand All @@ -38,14 +33,29 @@
/tls force use of start-TLS to encrypt the session, and reject connection to servers that do not support it
/notls do not do start-TLS to encrypt the session, even with servers that support it
/readonly request read-only mailbox open (IMAP only; ignored on NNTP, and an error with SMTP and POP3)
*/
$config['account'][0]['server']['flags'][] = "imap"; //Gmail defaults
$config['account'][0]['server']['flags'][] = "ssl"; //Gmail defaults
//MAILBOX - remote mailbox name, default is INBOX
$config['account'][0]['server']['mailbox'] = "INBOX"; // eg. INBOX (Gmail Default)
//SAVEPATH - where to save attachments on the local server
$config['account'][0]['savePath'] = "attachments/";
MAILBOX - remote mailbox name, default is INBOX
SAVEPATH - where to save attachments on the local server
*/

return array(
'account' => array(
'server' => array(
'host' => 'imap.gmail.com'
, 'port' => '993'
, 'user' => 'youruser'
, 'password' => 'swordfish'
, 'flags' => array('imap', 'ssl')
, 'mailbox' => "INBOX"
)
, 'savepath' => 'attachments/'
)
);

7 changes: 5 additions & 2 deletions example.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
<?php

//include the deps
require("config.php");

require("BitFunnel.php");

$check = __DIR__ . DIRECTORY_SEPARATOR . 'config.php';
$account = (is_file($check) ? require $check : array());

//go!
$bitFunnel = new BitFunnel($config['account'][0]);
$bitFunnel = new BitFunnel($account);

0 comments on commit befe82f

Please sign in to comment.