*/
public function __construct()
{
- $filename = $this->getFileName(Banana::$group);
+ $filename = $this->getFileName();
if (is_null($filename)) {
return;
}
- $this->filesize = filesize($filename);
$this->file = @fopen($filename, 'r');
if (!$this->file) {
- $this->_lasterrno = 1;
- $this->_lasterror = _b_('Can\'t open file');
$this->file = null;
+ $this->filesize = 0;
+ } else {
+ $this->filesize = filesize($filename);
}
$this->current_id = 0;
$this->at_beginning = true;
*/
public function isValid()
{
- return !Banana::$group || $this->file;
+ return true;
+ //!Banana::$group || $this->file;
}
/** Indicate last error n°
public function &getMessage($id)
{
$message = null;
+ if (is_null($this->file)) {
+ return $message;
+ }
if (!is_numeric($id)) {
if (!Banana::$spool) {
return $message;
public function getMessageSource($id)
{
$message = null;
+ if (is_null($this->file)) {
+ return $message;
+ }
if (!is_numeric($id)) {
if (!Banana::$spool) {
return $message;
*/
public function getIndexes()
{
+ if (is_null($this->file)) {
+ return array(0, 0, 0);
+ }
if (is_null($this->count)) {
$this->getCount();
}
$messages =& $this->readMessages(range($firstid, $lastid), true);
$msg_headers = array_map('strtolower', $msg_headers);
$headers = array();
+ if (is_null($this->file)) {
+ return $headers;
+ }
foreach ($msg_headers as $header) {
foreach ($messages as $id=>&$message) {
if (!isset($headers[$id])) {
*/
public function getNewIndexes($since)
{
+ if (is_null($this->file)) {
+ return array();
+ }
if (is_null($this->new_messages)) {
$this->getCount();
}
# Filesystem functions
#######
- protected function getFileName($box)
+ protected function getFileName()
{
- if (is_null($box)) {
+ if (is_null(Banana::$group)) {
return null;
}
- @list($mail, $domain) = explode('@', $box);
+ @list($mail, $domain) = explode('@', Banana::$group);
return Banana::$mbox_path . '/' . $mail;
}